Text to Image

Create images from a text input prompt. Supports few aspect ratios.

Create Text to Image Task

This endpoint allows you to create a text to image task.

POST/v1/tasks/text-to-image

Required parameters

  • Name
    prompt
    Type
    string
    Description
    Positive text prompt that describes what the outpush mesh should look like. Values must be between 1 and 500 characters.
  • Name
    ratio
    Type
    ImageRatio
    Description
    The aspect ratio of the output image. Must be one of the enum values.

Optional parameters

  • Name
    negativePrompt
    Type
    string | null
    Description
    The negative text prompt uesd when creating the task. 500 characters or less.
  • Name
    seed
    Type
    integer | null
    Description
    When you use the same prompt and seed, you will generate the same result. If null or omitted, the server chooses a random seed.

Request

POST/v1/tasks/text-to-image
curl --request POST \
  --url https://api.goneural.ai/v1/tasks/text-to-image \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer 123' \
  --header 'Content-Type: application/json' \
  --data '{
  "prompt": "string",
  "ratio": "1:1 square 1024x1024",
  "seed": 42
}'

Response body parameters

This endpoint returns the task object.

  • Name
    id
    Type
    string
    Description
    Unique identifier for the task.
  • Name
    status
    Type
    TaskStatus
    Description
    The status of the task.
  • Name
    type
    Type
    TaskType
    Description
    The type of task.
  • Name
    seed
    Type
    integer
    Description
    The seed used to create the task.
  • Name
    input
    Type
    Record<string, string>
    Description
    The input used to create the task.
  • Name
    output
    Type
    Record<string, string>
    Description
    A key-value pair of output type to asset URL.
  • Name
    creditUsed
    Type
    integer
    Description
    The amount of credits used by creating this task.
  • Name
    refunded
    Type
    boolean
    Description
    Whether the task was refunded.
  • Name
    userId
    Type
    integer
    Description
    The ID of the user who created the task.
  • Name
    finishedAt
    Type
    string<date-time> | null
    Description
    The timestamp of when the task finished processing.
  • Name
    createdAt
    Type
    string<date-time> | null
    Description
    The timestamp of when the task was created.
  • Name
    asset
    Type
    AssetData | null
    Description
    The asset associated with the task.
  • Name
    assetId
    Type
    string | null
    Description
    The ID of the asset associated with the task.
  • Name
    meta
    Type
    object | null
    Description
    The metadata associated with the task.

Response

{
  "id": "string",
  "status": "queued",
  "type": "text-to-image",
  "seed": 42,
  "input": {
    "prompt": "string"
  },
  "output": {
    "image": "https://..."
  },
  "creditUsed": 0,
  "refunded": true,
  "userId": 0,
  "finishedAt": "2019-08-24T14:15:22Z",
  "createdAt": "2019-08-24T14:15:22Z",
  "asset": {
    "id": "string",
    "type": "model",
    "userId": 0,
    "user": {
      "id": 0,
      "name": "string"
    },
    "name": "string",
    "description": "string",
    "isPublic": true,
    "likes": "string",
    "tags": [
      "string"
    ],
    "permissions": {
      "canEdit": true
    }
  }
}

Was this page helpful?