Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/midjourney-api-the-next-leg/tnl-midjourney-api
Node Module for interacting with Midjourney via The Next Leg
https://github.com/midjourney-api-the-next-leg/tnl-midjourney-api
Last synced: about 2 months ago
JSON representation
Node Module for interacting with Midjourney via The Next Leg
- Host: GitHub
- URL: https://github.com/midjourney-api-the-next-leg/tnl-midjourney-api
- Owner: midjourney-api-the-next-leg
- License: bsd-3-clause
- Created: 2023-05-01T01:36:53.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-09-17T13:54:34.000Z (about 1 year ago)
- Last Synced: 2024-08-01T08:13:34.673Z (4 months ago)
- Language: TypeScript
- Size: 14.6 KB
- Stars: 7
- Watchers: 3
- Forks: 4
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome - midjourney-api-the-next-leg/tnl-midjourney-api - Node Module for interacting with Midjourney via The Next Leg (TypeScript)
README
# 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 account settings.
## Installation
To use this module, you need to have Node.js installed on your machine. To install this module, run the following command:
```sh
npm install tnl-midjourney-api
```## Usage
Here is an example of how to use the module to create an image from a prompt:
```javascript
import { TNL } from 'tnl-midjourney-api';const TNL_API_KEY = 'your_api_key_here';
const tnl = new TNL(TNL_API_KEY);const prompt = 'a cat playing the piano';
const response = await tnl.imagine(prompt);console.log(response);
```## API
### `new TNL(apiKey: string)`
Creates a new instance of `TNL` with the provided `apiKey`.
### Imagine
`tnl.imagine(prompt: string, ref?: string, webhookOverride?: string): Promise`
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.
- `webhookOverride` (optional) - A webhook URL that will be used instead of the one set in the dashboard.### Get Progress and Message Result
`tnl.getMessageAndProgress(messageId: string, expireMins?: number): Promise`
Gets the progress and response of a message.
- `messageId` - The message ID of the message you want to get the progress and response for.
- `expireMins` (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: string, imgUrl: string, ref?: string, webhookOverride?: string): Promise`
Creates an image from a prompt and an image.
- `prompt` - The prompt you want to use to generate the image.
- `imgUrl` - 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.
- `webhookOverride` (optional) - A webhook URL that will be used instead of the one set in the dashboard.### Describe
`tnl.describe(imgUrl: string, ref?: string, webhookOverride?: string): Promise`
Describes an image.
- `imgUrl` - The URL of the image you want to describe.
- `ref` (optional) - A reference string that will be returned in the webhook response.
- `webhookOverride` (optional) - A webhook URL that will be used instead of the one set in the dashboard.### Button
`tnl.button(button: TNLTypes.ButtonTypes, buttonMessageId: string, ref?: string, webhookOverride?: string): Promise`
Uses a button on an image.
- `button` - A button type.
- `buttonMessageId` - The buttonMessageId of the message that contains the button.
- `ref` (optional) - A reference string that will be returned in the webhook response.
- `webhookOverride` (optional) - A webhook URL that will be used instead of the one set in the dashboard.### Get Seed
`tnl.getSeed(messageId: string): Promise`
Gets a seed of a message.
- `messageId` - The message ID of the message you want to get the seed for.
### Slash Command
`tnl.slashCommand(slashCommand: TNLTypes.SlashCommands, ref?: string, webhookOverride?: string): Promise`
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.
- `webhookOverride` (optional) - A webhook URL that will be used instead of the one set in the dashboard.### Get Settings
`tnl.getSettings(): Promise`
Gets the settings available for your account.
### Set Settings
`tnl.setSettings(settings: TNLTypes.Settings, ref?: string, webhookOverride?: string): Promise`
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.
- `webhookOverride` (optional) - A webhook URL that will be used instead of the one set in the dashboard.### Get Info
`tnl.getInfo(ref?: string, webhookOverride?: string): Promise`
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.
- `webhookOverride` (optional) - A webhook URL that will be used instead of the one set in the dashboard.