> ## Documentation Index
> Fetch the complete documentation index at: https://docs.neural4d.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create image generation tasks

> Creates asynchronous image generation tasks from a prompt and optional image references supplied by file ID or HTTPS URL.

## Authorizations

**Authorization** `string` *required* (default: Bearer \$\{YOUR\_API\_KEY})

Neural4D API key using the Bearer scheme.

## Body application/json

Omitted optional parameters use the selected model's current defaults. Values outside its supported resolutions or aspect ratios return `unsupported_resolution` or `unsupported_aspect_ratio`.

Each reference image must be at most 10 MiB, whether supplied by `file_id` or `url`.

> [tab] gpt-image-2
>
> **model** `enum\<string\>` *required*
>
> GPT Image 2 model identifier.
>
> Available option: `openai/gpt-image-2`.
>
> **prompt** `string` *required*
>
> Text instruction describing the image to generate or edit.
>
> Required string length: `1 - 1000`.
>
> **input\_references** `object[]`
>
> Optional reference images. Set `file_id` to the `id` returned by `POST /openapi/v1/files`, or provide the image's public HTTPS URL directly in `url`. Only JPG, JPEG, PNG, and WEBP images are supported, up to 10 MiB per image. Images must pass content moderation.
>
> Allowed array length: `0 - 6` elements in total. You can mix file IDs and URLs; reference order is preserved. Each item must contain exactly one of `file_id` or `url`.
>
> **Child attributes**
>
> **type** `enum\<string\>` *required*
>
> Reference media type.
>
> Available option: `image`.
>
> **file\_id** `string\<uuid\>`
>
> File ID returned by the file upload endpoint for your account. Required when `url` is omitted; do not provide both fields.
>
> **url** `string\<uri\>`
>
> Public HTTPS file URL on port 443, up to 2,048 characters by default. Required when `file_id` is omitted; do not send both.
>
> The file must be downloadable without cookies or extra authorization headers. Signed URLs are supported; keep them valid during download. Do not include a username, password, or `#...`.
>
> **n** `integer` (default: 1)
>
> Number of image generation tasks to create.
>
> Required range: `1 <= x <= 4`.
>
> **resolution** `enum\<string\>` (default: 2K)
>
> Named output resolution.
>
> Available options: `1K`, `2K`, `4K`.
>
> **aspect\_ratio** `enum\<string\>` (default: 1:1)
>
> Target image width-to-height ratio.
>
> Available options: `1:1`, `16:9`, `9:16`, `4:3`, `3:4`.

> [tab] nano-banana-pro
>
> **model** `enum\<string\>` *required*
>
> Nano Banana Pro model identifier.
>
> Available option: `google/nano-banana-pro`.
>
> **prompt** `string` *required*
>
> Text instruction describing the image to generate or edit.
>
> Required string length: `1 - 1000`.
>
> **input\_references** `object[]`
>
> Optional reference images. Set `file_id` to the `id` returned by `POST /openapi/v1/files`, or provide the image's public HTTPS URL directly in `url`. Only JPG, JPEG, PNG, and WEBP images are supported, up to 10 MiB per image. Images must pass content moderation.
>
> Allowed array length: `0 - 6` elements in total. You can mix file IDs and URLs; reference order is preserved. Each item must contain exactly one of `file_id` or `url`.
>
> **Child attributes**
>
> **type** `enum\<string\>` *required*
>
> Reference media type.
>
> Available option: `image`.
>
> **file\_id** `string\<uuid\>`
>
> File ID returned by the file upload endpoint for your account. Required when `url` is omitted; do not provide both fields.
>
> **url** `string\<uri\>`
>
> Public HTTPS file URL on port 443, up to 2,048 characters by default. Required when `file_id` is omitted; do not send both.
>
> The file must be downloadable without cookies or extra authorization headers. Signed URLs are supported; keep them valid during download. Do not include a username, password, or `#...`.
>
> **n** `integer` (default: 1)
>
> Number of image generation tasks to create.
>
> Required range: `1 <= x <= 4`.
>
> **resolution** `enum\<string\>` (default: 2K)
>
> Named output resolution.
>
> Available options: `1K`, `2K`, `4K`.
>
> **aspect\_ratio** `enum\<string\>` (default: 1:1)
>
> Target image width-to-height ratio.
>
> Available options: `1:1`, `16:9`, `9:16`, `4:3`, `3:4`.

> [tab] nano-banana-2-lite
>
> **model** `enum\<string\>` *required*
>
> Nano Banana 2 Lite model identifier.
>
> Available option: `google/nano-banana-2-lite`.
>
> **prompt** `string` *required*
>
> Text instruction describing the image to generate or edit.
>
> Required string length: `1 - 1000`.
>
> **input\_references** `object[]`
>
> Optional reference images. Set `file_id` to the `id` returned by `POST /openapi/v1/files`, or provide the image's public HTTPS URL directly in `url`. Only JPG, JPEG, PNG, and WEBP images are supported, up to 10 MiB per image. Images must pass content moderation.
>
> Allowed array length: `0 - 6` elements in total. You can mix file IDs and URLs; reference order is preserved. Each item must contain exactly one of `file_id` or `url`.
>
> **Child attributes**
>
> **type** `enum\<string\>` *required*
>
> Reference media type.
>
> Available option: `image`.
>
> **file\_id** `string\<uuid\>`
>
> File ID returned by the file upload endpoint for your account. Required when `url` is omitted; do not provide both fields.
>
> **url** `string\<uri\>`
>
> Public HTTPS file URL on port 443, up to 2,048 characters by default. Required when `file_id` is omitted; do not send both.
>
> The file must be downloadable without cookies or extra authorization headers. Signed URLs are supported; keep them valid during download. Do not include a username, password, or `#...`.
>
> **n** `integer` (default: 1)
>
> Number of image generation tasks to create.
>
> Required range: `1 <= x <= 4`.
>
> **resolution** `enum\<string\>` (default: 1K)
>
> Named output resolution.
>
> Available option: `1K`.
>
> **aspect\_ratio** `enum\<string\>` (default: 1:1)
>
> Target image width-to-height ratio.
>
> Available options: `1:1`, `16:9`, `9:16`, `4:3`, `3:4`.

> [tab] seedream-4.5
>
> **model** `enum\<string\>` *required*
>
> Seedream 4.5 model identifier.
>
> Available option: `bytedance/seedream-4.5`.
>
> **prompt** `string` *required*
>
> Text instruction describing the image to generate or edit.
>
> Required string length: `1 - 1000`.
>
> **input\_references** `object[]`
>
> Optional reference images. Set `file_id` to the `id` returned by `POST /openapi/v1/files`, or provide the image's public HTTPS URL directly in `url`. Only JPG, JPEG, PNG, and WEBP images are supported, up to 10 MiB per image. Images must pass content moderation.
>
> Allowed array length: `0 - 6` elements in total. You can mix file IDs and URLs; reference order is preserved. Each item must contain exactly one of `file_id` or `url`.
>
> **Child attributes**
>
> **type** `enum\<string\>` *required*
>
> Reference media type.
>
> Available option: `image`.
>
> **file\_id** `string\<uuid\>`
>
> File ID returned by the file upload endpoint for your account. Required when `url` is omitted; do not provide both fields.
>
> **url** `string\<uri\>`
>
> Public HTTPS file URL on port 443, up to 2,048 characters by default. Required when `file_id` is omitted; do not send both.
>
> The file must be downloadable without cookies or extra authorization headers. Signed URLs are supported; keep them valid during download. Do not include a username, password, or `#...`.
>
> **n** `integer` (default: 1)
>
> Number of image generation tasks to create.
>
> Required range: `1 <= x <= 4`.
>
> **resolution** `enum\<string\>` (default: 2K)
>
> Named output resolution.
>
> Available options: `2K`, `4K`.
>
> **aspect\_ratio** `enum\<string\>` (default: 1:1)
>
> Target image width-to-height ratio.
>
> Available options: `1:1`, `16:9`, `9:16`, `4:3`, `3:4`.

> [tab] flux-2-pro
>
> **model** `enum\<string\>` *required*
>
> Flux 2 Pro model identifier.
>
> Available option: `black-forest-labs/flux-2-pro`.
>
> **prompt** `string` *required*
>
> Text instruction describing the image to generate or edit.
>
> Required string length: `1 - 1000`.
>
> **input\_references** `object[]`
>
> Optional reference images. Set `file_id` to the `id` returned by `POST /openapi/v1/files`, or provide the image's public HTTPS URL directly in `url`. Only JPG, JPEG, PNG, and WEBP images are supported, up to 10 MiB per image. Images must pass content moderation.
>
> Allowed array length: `0 - 6` elements in total. You can mix file IDs and URLs; reference order is preserved. Each item must contain exactly one of `file_id` or `url`.
>
> **Child attributes**
>
> **type** `enum\<string\>` *required*
>
> Reference media type.
>
> Available option: `image`.
>
> **file\_id** `string\<uuid\>`
>
> File ID returned by the file upload endpoint for your account. Required when `url` is omitted; do not provide both fields.
>
> **url** `string\<uri\>`
>
> Public HTTPS file URL on port 443, up to 2,048 characters by default. Required when `file_id` is omitted; do not send both.
>
> The file must be downloadable without cookies or extra authorization headers. Signed URLs are supported; keep them valid during download. Do not include a username, password, or `#...`.
>
> **n** `integer` (default: 1)
>
> Number of image generation tasks to create.
>
> Required range: `1 <= x <= 4`.
>
> **resolution** `enum\<string\>` (default: 2K)
>
> Named output resolution.
>
> Available options: `1K`, `2K`.
>
> **aspect\_ratio** `enum\<string\>` (default: 1:1)
>
> Target image width-to-height ratio.
>
> Available options: `1:1`, `16:9`, `9:16`, `4:3`, `3:4`.

```bash cURL · openai/gpt-image-2 theme={null}
curl --request POST \
  --url https://api.neural4d.com/openapi/v1/images/generations \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "model": "openai/gpt-image-2",
  "prompt": "A ceramic teapot on a white studio background",
  "input_references": [
    {
      "type": "image",
      "file_id": "550e8400-e29b-41d4-a716-446655440000"
    }
  ],
  "n": 1,
  "resolution": "1K",
  "aspect_ratio": "1:1"
}'
```

```python Python theme={null}
import requests

response = requests.post(
    "https://api.neural4d.com/openapi/v1/images/generations",
    headers={
        "Authorization": "Bearer <token>",
        "Content-Type": "application/json",
    },
    json={
        "model": "openai/gpt-image-2",
        "prompt": "A ceramic teapot on a white studio background",
        "input_references": [
            {
                "type": "image",
                "file_id": "550e8400-e29b-41d4-a716-446655440000",
            },
        ],
        "n": 1,
        "resolution": "1K",
        "aspect_ratio": "1:1",
    },
)
print(response.json())
```

```javascript JavaScript theme={null}
const response = await fetch("https://api.neural4d.com/openapi/v1/images/generations", {
  method: "POST",
  headers: {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    model: "openai/gpt-image-2",
    prompt: "A ceramic teapot on a white studio background",
    input_references: [
      { type: "image", file_id: "550e8400-e29b-41d4-a716-446655440000" }
    ],
    n: 1,
    resolution: "1K",
    aspect_ratio: "1:1"
  })
});
const data = await response.json();
console.log(data);
```

```typescript TypeScript theme={null}
const response: Response = await fetch(
  "https://api.neural4d.com/openapi/v1/images/generations",
  {
    method: "POST",
    headers: {
      "Authorization": "Bearer <token>",
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      model: "openai/gpt-image-2",
      prompt: "A ceramic teapot on a white studio background",
      input_references: [
        { type: "image", file_id: "550e8400-e29b-41d4-a716-446655440000" }
      ],
      n: 1,
      resolution: "1K",
      aspect_ratio: "1:1"
    })
  }
);
const data = await response.json();
console.log(data);
```

```java Java theme={null}
import java.net.URI;
import java.net.http.*;

String payload = String.join("\n",
    "{",
    "  \"model\": \"openai/gpt-image-2\",",
    "  \"prompt\": \"A ceramic teapot on a white studio background\",",
    "  \"input_references\": [",
    "    {",
    "      \"type\": \"image\",",
    "      \"file_id\": \"550e8400-e29b-41d4-a716-446655440000\"",
    "    }",
    "  ],",
    "  \"n\": 1,",
    "  \"resolution\": \"1K\",",
    "  \"aspect_ratio\": \"1:1\"",
    "}"
);

HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.neural4d.com/openapi/v1/images/generations"))
    .header("Authorization", "Bearer <token>")
    .header("Content-Type", "application/json")
    .POST(HttpRequest.BodyPublishers.ofString(payload))
    .build();
HttpResponse<String> response = HttpClient.newHttpClient().send(
    request,
    HttpResponse.BodyHandlers.ofString()
);
System.out.println(response.body());
```

```go Go theme={null}
package main

import (
    "fmt"
    "io"
    "net/http"
    "strings"
)

func main() {
    payload := strings.NewReader(`{
      "model": "openai/gpt-image-2",
      "prompt": "A ceramic teapot on a white studio background",
      "input_references": [
        {
          "type": "image",
          "file_id": "550e8400-e29b-41d4-a716-446655440000"
        }
      ],
      "n": 1,
      "resolution": "1K",
      "aspect_ratio": "1:1"
    }`)
    req, _ := http.NewRequest(
        "POST",
        "https://api.neural4d.com/openapi/v1/images/generations",
        payload,
    )
    req.Header.Set("Authorization", "Bearer <token>")
    req.Header.Set("Content-Type", "application/json")
    resp, _ := http.DefaultClient.Do(req)
    defer resp.Body.Close()
    bodyBytes, _ := io.ReadAll(resp.Body)
    fmt.Println(string(bodyBytes))
}
```

```ruby Ruby theme={null}
require "net/http"
require "json"

uri = URI("https://api.neural4d.com/openapi/v1/images/generations")
request = Net::HTTP::Post.new(uri)
request["Authorization"] = "Bearer <token>"
request["Content-Type"] = "application/json"
request.body = {
  "model": "openai/gpt-image-2",
  "prompt": "A ceramic teapot on a white studio background",
  "input_references": [
    {
      "type": "image",
      "file_id": "550e8400-e29b-41d4-a716-446655440000"
    }
  ],
  "n": 1,
  "resolution": "1K",
  "aspect_ratio": "1:1"
}.to_json

response = Net::HTTP.start(
  uri.hostname,
  uri.port,
  use_ssl: uri.scheme == "https"
) do |http|
  http.request(request)
end
puts response.body
```

```php PHP theme={null}
<?php

$ch = curl_init("https://api.neural4d.com/openapi/v1/images/generations");
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => "POST",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer <token>",
        "Content-Type: application/json",
    ],
    CURLOPT_POSTFIELDS => json_encode([
        "model" => "openai/gpt-image-2",
        "prompt" => "A ceramic teapot on a white studio background",
        "input_references" => [
            [
                "type" => "image",
                "file_id" => "550e8400-e29b-41d4-a716-446655440000",
            ],
        ],
        "n" => 1,
        "resolution" => "1K",
        "aspect_ratio" => "1:1",
    ]),
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
```

```csharp C# theme={null}
using System.Net.Http;
using System.Text;

var payload = @"{
  ""model"": ""openai/gpt-image-2"",
  ""prompt"": ""A ceramic teapot on a white studio background"",
  ""input_references"": [
    {
      ""type"": ""image"",
      ""file_id"": ""550e8400-e29b-41d4-a716-446655440000""
    }
  ],
  ""n"": 1,
  ""resolution"": ""1K"",
  ""aspect_ratio"": ""1:1""
}";

using var client = new HttpClient();
using var request = new HttpRequestMessage(
    HttpMethod.Post,
    "https://api.neural4d.com/openapi/v1/images/generations"
);
request.Headers.TryAddWithoutValidation("Authorization", "Bearer <token>");
request.Content = new StringContent(
    payload,
    Encoding.UTF8,
    "application/json"
);
using var response = await client.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());
```

## Response

Identify errors by `error.code`, not by matching message text.

> [tab] 202
>
> Generation tasks accepted
>
> **id** `string` *required*
>
> Batch task ID returned by the generation request.
>
> Example: `"normal-image-c50fe63e-699d-4d61-93f5-2099ab159d6d"`.
>
> **data** `object[]` *required*
>
> Generated child items created by the request.
>
> Allowed array length: at least `1` element.
>
> **Child attributes**
>
> **uuid** `string\<uuid\>` *required*
>
> Generated child item UUID.
>
> **status** `enum\<string\>` *required*
>
> Normalized task lifecycle status.
>
> Available options: `queued`, `processing`, `succeeded`, `failed`.
>
> **created\_at** `integer\<int64\>` *required*
>
> Unix timestamp in seconds.
>
> **updated\_at** `integer\<int64\>`
>
> Unix timestamp in seconds when the task was updated.
>
> **usage** `object`
>
> Credits charged for this task when available.
>
> **Child attributes**
>
> **credits** `number\<float\>` *required*
>
> Credits charged for the task or submission.
>
> Required range: `0 <= x <= infinity`.
>
> Example: `13`.
>
> **error** `object`
>
> Failure details when asynchronous processing fails.
>
> **Child attributes**
>
> **code** `string` *required*
>
> Stable machine-readable task failure code.
>
> **message** `string` *required*
>
> Human-readable explanation of the task failure.
>
> **failed\_at** `integer\<int64\>`
>
> Unix timestamp in seconds when the task failed.
>
> **retryable** `boolean`
>
> Whether retrying the same operation may succeed.
>
> **status** `enum\<string\>` *required*
>
> Current status shared by the submitted image tasks.
>
> Available options: `queued`, `processing`, `succeeded`, `failed`.
>
> **created\_at** `integer\<int64\>` *required*
>
> Unix timestamp in seconds when the batch task was created.
>
> **mode** `enum\<string\>` *required*
>
> Image generation mode shared by the submitted tasks.
>
> Available options: `text_to_image`, `image_to_image`.
>
> **model** `enum\<string\>` *required*
>
> Image generation model used by the submitted tasks.
>
> Available options: `openai/gpt-image-2`, `google/nano-banana-pro`, `bytedance/seedream-4.5`, `black-forest-labs/flux-2-pro`, `google/nano-banana-2-lite`.
>
> **usage** `object`
>
> Total credits charged for the submitted tasks when available.
>
> **Child attributes**
>
> **credits** `number\<float\>` *required*
>
> Credits charged for the task submission.
>
> Example: `13`.

> [tab] 400
>
> Invalid request
>
> **error** `object` *required*
>
> Structured error details.
>
> **Child attributes**
>
> **code** `string` *required*
>
> Stable machine-readable error code.
>
> Example: `"invalid_prompt"`.
>
> URL reference errors:
>
> * `invalid_reference_source`: Provide exactly one of `file_id` or `url` per reference.
> * `invalid_reference_url`: The URL format or length is invalid.
> * `unsafe_reference_url`: The URL or redirect destination is not allowed. Use a public file URL that meets the requirements above.
> * `file_rejected`: The image failed content moderation. Use another image.
>
> **message** `string` *required*
>
> Human-readable explanation of the error.
>
> Example: `"prompt is required and must be a non-empty string"`.
>
> **doc\_url** `string\<uri\> | null`
>
> Optional documentation URL with more information about the error.
>
> Example: `"https://api.neural4d.com/docs/errors#invalid_prompt"`.

> [tab] 401
>
> Authentication failed
>
> **error** `object` *required*
>
> Structured error details.
>
> **Child attributes**
>
> **code** `string` *required*
>
> Stable machine-readable error code.
>
> Example: `"invalid_api_key"`.
>
> **message** `string` *required*
>
> Human-readable explanation of the error.
>
> Example: `"The API key is invalid or expired"`.
>
> **doc\_url** `string\<uri\> | null`
>
> Optional documentation URL with more information about the error.
>
> Example: `"https://api.neural4d.com/docs/errors#invalid_api_key"`.

> [tab] 403
>
> The authenticated user cannot access this resource or has insufficient credits
>
> **error** `object` *required*
>
> Structured error details.
>
> **Child attributes**
>
> **code** `string` *required*
>
> Stable machine-readable error code.
>
> Example: `"insufficient_credits"`.
>
> **message** `string` *required*
>
> Human-readable explanation of the error.
>
> Example: `"Insufficient credits for image generation"`.
>
> **doc\_url** `string\<uri\> | null`
>
> Optional documentation URL with more information about the error.
>
> Example: `"https://api.neural4d.com/docs/errors#insufficient_credits"`.

> [tab] 408
>
> Reference download timed out
>
> **error** `object` *required*
>
> Structured error details.
>
> **Child attributes**
>
> **code** `string` *required*
>
> * `reference_fetch_timeout`: The download timed out. Check the source server and retry.
>
> **message** `string` *required*
>
> Human-readable explanation. Use `error.code` to identify the cause.

> [tab] 413
>
> Reference file too large
>
> **error** `object` *required*
>
> Structured error details.
>
> **Child attributes**
>
> **code** `string` *required*
>
> * `reference_too_large`: The image exceeds the 10 MiB limit. This limit applies to both file IDs and URLs.
>
> **message** `string` *required*
>
> Human-readable explanation. Use `error.code` to identify the cause.

> [tab] 415
>
> Invalid or unsupported reference file
>
> **error** `object` *required*
>
> Structured error details.
>
> **Child attributes**
>
> **code** `string` *required*
>
> * `invalid_reference_file`: The file is empty or its content cannot be inspected.
> * `invalid_reference_file_type`: The format is unsupported or does not match the reference type or response `Content-Type`.
>
> **message** `string` *required*
>
> Human-readable explanation. Use `error.code` to identify the cause.

> [tab] 422
>
> Reference download failed
>
> **error** `object` *required*
>
> Structured error details.
>
> **Child attributes**
>
> **code** `string` *required*
>
> * `reference_fetch_failed`: The file cannot be downloaded. Check that the URL is valid and publicly accessible.
> * `reference_redirect_limit`: Too many redirects. Use a direct file URL.
>
> **message** `string` *required*
>
> Human-readable explanation. Use `error.code` to identify the cause.

> [tab] 429
>
> Request or quota limit exceeded
>
> **error** `object` *required*
>
> Structured error details.
>
> **Child attributes**
>
> **code** `string` *required*
>
> Stable machine-readable error code.
>
> Example: `"rate_limit_exceeded"`.
>
> URL reference errors:
>
> * `reference_import_busy`: Reference import is busy. Retry after the interval in the `Retry-After` response header.
>
> **message** `string` *required*
>
> Human-readable explanation of the error.
>
> Example: `"Too many requests. Retry after the indicated interval."`.
>
> **doc\_url** `string\<uri\> | null`
>
> Optional documentation URL with more information about the error.
>
> Example: `"https://api.neural4d.com/docs/errors#rate_limit_exceeded"`.

> [tab] 500
>
> Internal or upstream service error
>
> When `error.details.submission_accepted` is `true`, your generation task is already queued but a later operation failed.
> `error.details.task` retains the task ID, UUIDs, and known credit usage. `retryable` is `false`; do not resubmit the generation request, as doing so can charge you again.
> If registration succeeded, you can query the task by its ID. If `error.details.registration_failed` is `true`, the error code is `task_registration_failed` and task lookup may return `404` until registration is repaired.
> When `error.details.submission_uncertain` is `true`, the response retains the attempted task ID; check the original submission before resubmitting. Credit usage is omitted when the final charge is unknown.
>
> **error** `object` *required*
>
> Structured error details.
>
> **Child attributes**
>
> **code** `string` *required*
>
> Stable machine-readable error code.
>
> Example: `"internal_error"`.
>
> **message** `string` *required*
>
> Human-readable explanation of the error.
>
> Example: `"An internal error occurred"`.
>
> **doc\_url** `string\<uri\> | null`
>
> Optional documentation URL with more information about the error.
>
> Example: `"https://api.neural4d.com/docs/errors#internal_error"`.

> [tab] 503
>
> Image moderation unavailable
>
> **error** `object` *required*
>
> Structured error details.
>
> **Child attributes**
>
> **code** `string` *required*
>
> * `file_moderation_unavailable`: Image moderation is temporarily unavailable. Retry later.
>
> **message** `string` *required*
>
> Always returns `An internal error occurred`.

```json 202 Example theme={null}
{
  "id": "normal-image-c50fe63e-699d-4d61-93f5-2099ab159d6d",
  "status": "queued",
  "created_at": 1784044800,
  "mode": "image_to_image",
  "model": "openai/gpt-image-2",
  "data": [
    {
      "uuid": "c6f5dc4e-61ac-4694-9a8b-6a95f3ac4457",
      "status": "queued",
      "created_at": 1784044800
    }
  ],
  "usage": {
    "credits": 13
  }
}
```

```json 400 invalid_prompt theme={null}
{
  "error": {
    "code": "invalid_prompt",
    "message": "prompt is required and must be a non-empty string"
  }
}
```

```json 400 unsupported_model theme={null}
{
  "error": {
    "code": "unsupported_model",
    "message": "Unsupported modelKey: missing-model"
  }
}
```

```json 400 model_unavailable theme={null}
{
  "error": {
    "code": "model_unavailable",
    "message": "Model is unavailable: openai/gpt-image-2"
  }
}
```

```json 401 Example theme={null}
{
  "error": {
    "code": "invalid_api_key",
    "message": "The API key is invalid or expired"
  }
}
```

```json 403 Example theme={null}
{
  "error": {
    "code": "insufficient_credits",
    "message": "Insufficient credits for image generation"
  }
}
```

```json 413 Reference file too large theme={null}
{
  "error": {
    "code": "reference_too_large",
    "message": "Reference file must not exceed 10 MB"
  }
}
```

```json 429 Example theme={null}
{
  "error": {
    "code": "rate_limit_exceeded",
    "message": "Too many requests. Retry after the indicated interval."
  }
}
```

```json 500 Example theme={null}
{
  "error": {
    "code": "internal_error",
    "message": "An internal error occurred"
  }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.