midjourney-api


Namemidjourney-api JSON
Version 1.0.7 PyPI version JSON
download
home_pagehttps://github.com/midjourney-api-the-next-leg/python-midjourney-api
SummaryMidjourney API wrapper by The Next Leg
upload_time2023-05-16 01:27:02
maintainer
docs_urlNone
authorThe Next leg
requires_python
licenseMIT
keywords midjourney api the_next_leg
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            The Next Leg
============

The Next Leg is a module that provides functionality for creating
AI-generated images with Midjourney. It provides a simple interface for
interacting with Midjourney�s API and performing various actions such as
creating images from prompts or URLs, describing images, using buttons
or slash commands, and getting/setting account settings.

Installation
------------

To use this package, you need to have Python installed on your machine.
You can install TNL using pip:

.. code:: sh

   pip install midjourney-api

Usage
-----

Here is an example of how to use the TNL package to create an image from
a prompt:

::

   from midjourney_api import TNL

   TNL_API_KEY = 'your_api_key_here'
   tnl = TNL(TNL_API_KEY)

   prompt = 'a cat playing the piano'
   response = tnl.imagine(prompt)

   print(response)

API
---

\`TNL(api_key: str)
~~~~~~~~~~~~~~~~~~~

Creates a new instance of ``TNL`` with the provided ``apiKey``.

Imagine
~~~~~~~

``tnl.imagine(prompt: str, ref: str = '', webhook_override: str = '')``

Creates a new image from a prompt.

-  ``prompt`` - The prompt you want to use to generate the image.
-  ``ref`` (optional) - A reference string that will be returned in the
   webhook response.
-  ``webhook_override`` (optional) - A webhook URL that will be used
   instead of the one set in the dashboard.

Get Progress and Message Result
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

``tnl.get_message_and_progress(message_id: str, expire_mins: Optional[int] = None)``

Gets the progress and response of a message.

-  ``message_id`` - The message ID of the message you want to get the
   progress and response for.
-  ``expire_mins`` (optional) - A timeout for the request in minutes. If
   the request takes longer than this, it will return as �incomplete�

Img 2 Img
~~~~~~~~~

``tnl.img2img(prompt: str, img_url: str, ref: str = '', webhook_override: str = '')``

Creates an image from a prompt and an image.

-  ``prompt`` - The prompt you want to use to generate the image.
-  ``img_url`` - The URL of the image you want to use as the base image.
-  ``ref`` (optional) - A reference string that will be returned in the
   webhook response.
-  ``webhook_override`` (optional) - A webhook URL that will be used
   instead of the one set in the dashboard.

Describe
~~~~~~~~

``tnl.describe(img_url: str, ref: str = '', webhook_override: str = '')``

Describes an image.

-  ``img_url`` - The URL of the image you want to describe.
-  ``ref`` (optional) - A reference string that will be returned in the
   webhook response.
-  ``webhook_override`` (optional) - A webhook URL that will be used
   instead of the one set in the dashboard.

Button
~~~~~~

``tnl.button(button: TNLTypes.ButtonTypes, button_message_id: str, ref: str = '', webhook_override: str = '')``

Uses a button on an image.

-  ``button`` - A button type.
-  ``button_message_id`` - The button_message_id of the message that
   contains the button.
-  ``ref`` (optional) - A reference string that will be returned in the
   webhook response.
-  ``webhook_override`` (optional) - A webhook URL that will be used
   instead of the one set in the dashboard.

Get Seed
~~~~~~~~

``tnl.getSeed(message_id: string): Promise<TNLTypes.Response.Seed>``

Gets a seed of a message.

-  ``message_id`` - The message ID of the message you want to get the
   seed for.

Slash Command
~~~~~~~~~~~~~

``tnl.slashCommand(slashCommand: TNLTypes.SlashCommands, ref?: string, webhook_override?: string)``

Uses a slash command such as relax, fast, private, or stealth.

-  ``slashCommand`` - A slash command type.
-  ``ref`` (optional) - A reference string that will be returned in the
   webhook response.
-  ``webhook_override`` (optional) - A webhook URL that will be used
   instead of the one set in the dashboard.

Get Settings
~~~~~~~~~~~~

``tnl.getSettings(): Promise<TNLTypes.Response.Message>``

Gets the settings available for your account.

Set Settings
~~~~~~~~~~~~

``tnl.setSettings(settings: TNLTypes.Settings, ref?: string, webhook_override?: string)``

Sets the settings for your account.

-  ``settings`` - The settings you want to set.
-  ``ref`` (optional) - A reference string that will be returned in the
   webhook response.
-  ``webhook_override`` (optional) - A webhook URL that will be used
   instead of the one set in the dashboard.

Get Info
~~~~~~~~

``tnl.getInfo(ref?: string, webhook_override?: string)``

Gets information about your account including Fast Time Remaining, Job
Mode, Queued Jobs and more.

-  ``ref`` (optional) - A reference string that will be returned in the
   webhook response.
-  ``webhook_override`` (optional) - A webhook URL that will be used
   instead of the one set in the dashboard.

.. _get-seed-1:

Get Seed
~~~~~~~~

``tnl.getSeed(message_id: str)``

Gets a seed of a message.

-  ``message_id`` - The message ID of the message you want to get the
   seed for.

.. _slash-command-1:

Slash Command
~~~~~~~~~~~~~

``tnl.slashCommand(slash_command: TNLTypes.SlashCommands, ref: str = '', webhook_override: str = '')``

Uses a slash command such as relax, fast, private, or stealth.

-  ``slash_command`` - A slash command type.
-  ``ref`` (optional) - A reference string that will be returned in the
   webhook response.
-  ``webhook_override`` (optional) - A webhook URL that will be used
   instead of the one set in the dashboard.

.. _get-settings-1:

Get Settings
~~~~~~~~~~~~

``tnl.getSettings()``

Gets the settings available for your account.

.. _set-settings-1:

Set Settings
~~~~~~~~~~~~

``tnl.setSettings(settings: TNLTypes.Settings, ref: str = '', webhook_override: str = '')``

Sets the settings for your account.

-  ``settings`` - The settings you want to set.
-  ``ref`` (optional) - A reference string that will be returned in the
   webhook response.
-  ``webhook_override`` (optional) - A webhook URL that will be used
   instead of the one set in the dashboard.

.. _get-info-1:

Get Info
~~~~~~~~

``tnl.getInfo(ref: str = '', webhook_override: str = '')``

Gets information about your account including Fast Time Remaining, Job
Mode, Queued Jobs and more.

-  ``ref`` (optional) - A reference string that will be returned in the
   webhook response.
-  ``webhook_override`` (optional) - A webhook URL that will be used
   instead of the one set in the dashboard.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/midjourney-api-the-next-leg/python-midjourney-api",
    "name": "midjourney-api",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "MIDJOURNEY,API,THE_NEXT_LEG",
    "author": "The Next leg",
    "author_email": "support@thenextleg.io",
    "download_url": "https://files.pythonhosted.org/packages/b6/65/0d0c24a63d67d8117ec1f16914324a59c2b03417110bcad86e36fc3e1b44/midjourney_api-1.0.7.tar.gz",
    "platform": null,
    "description": "The Next Leg\r\n============\r\n\r\nThe Next Leg is a module that provides functionality for creating\r\nAI-generated images with Midjourney. It provides a simple interface for\r\ninteracting with Midjourney\u00ef\u00bf\u00bds API and performing various actions such as\r\ncreating images from prompts or URLs, describing images, using buttons\r\nor slash commands, and getting/setting account settings.\r\n\r\nInstallation\r\n------------\r\n\r\nTo use this package, you need to have Python installed on your machine.\r\nYou can install TNL using pip:\r\n\r\n.. code:: sh\r\n\r\n   pip install midjourney-api\r\n\r\nUsage\r\n-----\r\n\r\nHere is an example of how to use the TNL package to create an image from\r\na prompt:\r\n\r\n::\r\n\r\n   from midjourney_api import TNL\r\n\r\n   TNL_API_KEY = 'your_api_key_here'\r\n   tnl = TNL(TNL_API_KEY)\r\n\r\n   prompt = 'a cat playing the piano'\r\n   response = tnl.imagine(prompt)\r\n\r\n   print(response)\r\n\r\nAPI\r\n---\r\n\r\n\\`TNL(api_key: str)\r\n~~~~~~~~~~~~~~~~~~~\r\n\r\nCreates a new instance of ``TNL`` with the provided ``apiKey``.\r\n\r\nImagine\r\n~~~~~~~\r\n\r\n``tnl.imagine(prompt: str, ref: str = '', webhook_override: str = '')``\r\n\r\nCreates a new image from a prompt.\r\n\r\n-  ``prompt`` - The prompt you want to use to generate the image.\r\n-  ``ref`` (optional) - A reference string that will be returned in the\r\n   webhook response.\r\n-  ``webhook_override`` (optional) - A webhook URL that will be used\r\n   instead of the one set in the dashboard.\r\n\r\nGet Progress and Message Result\r\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n\r\n``tnl.get_message_and_progress(message_id: str, expire_mins: Optional[int] = None)``\r\n\r\nGets the progress and response of a message.\r\n\r\n-  ``message_id`` - The message ID of the message you want to get the\r\n   progress and response for.\r\n-  ``expire_mins`` (optional) - A timeout for the request in minutes. If\r\n   the request takes longer than this, it will return as \u00ef\u00bf\u00bdincomplete\u00ef\u00bf\u00bd\r\n\r\nImg 2 Img\r\n~~~~~~~~~\r\n\r\n``tnl.img2img(prompt: str, img_url: str, ref: str = '', webhook_override: str = '')``\r\n\r\nCreates an image from a prompt and an image.\r\n\r\n-  ``prompt`` - The prompt you want to use to generate the image.\r\n-  ``img_url`` - The URL of the image you want to use as the base image.\r\n-  ``ref`` (optional) - A reference string that will be returned in the\r\n   webhook response.\r\n-  ``webhook_override`` (optional) - A webhook URL that will be used\r\n   instead of the one set in the dashboard.\r\n\r\nDescribe\r\n~~~~~~~~\r\n\r\n``tnl.describe(img_url: str, ref: str = '', webhook_override: str = '')``\r\n\r\nDescribes an image.\r\n\r\n-  ``img_url`` - The URL of the image you want to describe.\r\n-  ``ref`` (optional) - A reference string that will be returned in the\r\n   webhook response.\r\n-  ``webhook_override`` (optional) - A webhook URL that will be used\r\n   instead of the one set in the dashboard.\r\n\r\nButton\r\n~~~~~~\r\n\r\n``tnl.button(button: TNLTypes.ButtonTypes, button_message_id: str, ref: str = '', webhook_override: str = '')``\r\n\r\nUses a button on an image.\r\n\r\n-  ``button`` - A button type.\r\n-  ``button_message_id`` - The button_message_id of the message that\r\n   contains the button.\r\n-  ``ref`` (optional) - A reference string that will be returned in the\r\n   webhook response.\r\n-  ``webhook_override`` (optional) - A webhook URL that will be used\r\n   instead of the one set in the dashboard.\r\n\r\nGet Seed\r\n~~~~~~~~\r\n\r\n``tnl.getSeed(message_id: string): Promise<TNLTypes.Response.Seed>``\r\n\r\nGets a seed of a message.\r\n\r\n-  ``message_id`` - The message ID of the message you want to get the\r\n   seed for.\r\n\r\nSlash Command\r\n~~~~~~~~~~~~~\r\n\r\n``tnl.slashCommand(slashCommand: TNLTypes.SlashCommands, ref?: string, webhook_override?: string)``\r\n\r\nUses a slash command such as relax, fast, private, or stealth.\r\n\r\n-  ``slashCommand`` - A slash command type.\r\n-  ``ref`` (optional) - A reference string that will be returned in the\r\n   webhook response.\r\n-  ``webhook_override`` (optional) - A webhook URL that will be used\r\n   instead of the one set in the dashboard.\r\n\r\nGet Settings\r\n~~~~~~~~~~~~\r\n\r\n``tnl.getSettings(): Promise<TNLTypes.Response.Message>``\r\n\r\nGets the settings available for your account.\r\n\r\nSet Settings\r\n~~~~~~~~~~~~\r\n\r\n``tnl.setSettings(settings: TNLTypes.Settings, ref?: string, webhook_override?: string)``\r\n\r\nSets the settings for your account.\r\n\r\n-  ``settings`` - The settings you want to set.\r\n-  ``ref`` (optional) - A reference string that will be returned in the\r\n   webhook response.\r\n-  ``webhook_override`` (optional) - A webhook URL that will be used\r\n   instead of the one set in the dashboard.\r\n\r\nGet Info\r\n~~~~~~~~\r\n\r\n``tnl.getInfo(ref?: string, webhook_override?: string)``\r\n\r\nGets information about your account including Fast Time Remaining, Job\r\nMode, Queued Jobs and more.\r\n\r\n-  ``ref`` (optional) - A reference string that will be returned in the\r\n   webhook response.\r\n-  ``webhook_override`` (optional) - A webhook URL that will be used\r\n   instead of the one set in the dashboard.\r\n\r\n.. _get-seed-1:\r\n\r\nGet Seed\r\n~~~~~~~~\r\n\r\n``tnl.getSeed(message_id: str)``\r\n\r\nGets a seed of a message.\r\n\r\n-  ``message_id`` - The message ID of the message you want to get the\r\n   seed for.\r\n\r\n.. _slash-command-1:\r\n\r\nSlash Command\r\n~~~~~~~~~~~~~\r\n\r\n``tnl.slashCommand(slash_command: TNLTypes.SlashCommands, ref: str = '', webhook_override: str = '')``\r\n\r\nUses a slash command such as relax, fast, private, or stealth.\r\n\r\n-  ``slash_command`` - A slash command type.\r\n-  ``ref`` (optional) - A reference string that will be returned in the\r\n   webhook response.\r\n-  ``webhook_override`` (optional) - A webhook URL that will be used\r\n   instead of the one set in the dashboard.\r\n\r\n.. _get-settings-1:\r\n\r\nGet Settings\r\n~~~~~~~~~~~~\r\n\r\n``tnl.getSettings()``\r\n\r\nGets the settings available for your account.\r\n\r\n.. _set-settings-1:\r\n\r\nSet Settings\r\n~~~~~~~~~~~~\r\n\r\n``tnl.setSettings(settings: TNLTypes.Settings, ref: str = '', webhook_override: str = '')``\r\n\r\nSets the settings for your account.\r\n\r\n-  ``settings`` - The settings you want to set.\r\n-  ``ref`` (optional) - A reference string that will be returned in the\r\n   webhook response.\r\n-  ``webhook_override`` (optional) - A webhook URL that will be used\r\n   instead of the one set in the dashboard.\r\n\r\n.. _get-info-1:\r\n\r\nGet Info\r\n~~~~~~~~\r\n\r\n``tnl.getInfo(ref: str = '', webhook_override: str = '')``\r\n\r\nGets information about your account including Fast Time Remaining, Job\r\nMode, Queued Jobs and more.\r\n\r\n-  ``ref`` (optional) - A reference string that will be returned in the\r\n   webhook response.\r\n-  ``webhook_override`` (optional) - A webhook URL that will be used\r\n   instead of the one set in the dashboard.\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Midjourney API wrapper by The Next Leg",
    "version": "1.0.7",
    "project_urls": {
        "Download": "https://github.com/midjourney-api-the-next-leg/python-midjourney-api/archive/refs/tags/v1.0.0.tar.gz",
        "Homepage": "https://github.com/midjourney-api-the-next-leg/python-midjourney-api"
    },
    "split_keywords": [
        "midjourney",
        "api",
        "the_next_leg"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b6650d0c24a63d67d8117ec1f16914324a59c2b03417110bcad86e36fc3e1b44",
                "md5": "261d7d39ce54fedc459652a949a0759f",
                "sha256": "b02f71d78895b910445a9800eefb84836f72ab3aa1e60ea780aeac12fa507b14"
            },
            "downloads": -1,
            "filename": "midjourney_api-1.0.7.tar.gz",
            "has_sig": false,
            "md5_digest": "261d7d39ce54fedc459652a949a0759f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 4074,
            "upload_time": "2023-05-16T01:27:02",
            "upload_time_iso_8601": "2023-05-16T01:27:02.691465Z",
            "url": "https://files.pythonhosted.org/packages/b6/65/0d0c24a63d67d8117ec1f16914324a59c2b03417110bcad86e36fc3e1b44/midjourney_api-1.0.7.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-05-16 01:27:02",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "midjourney-api-the-next-leg",
    "github_project": "python-midjourney-api",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "midjourney-api"
}
        
Elapsed time: 0.14204s