---
title: "Generate images with GPT Image 2"
method: POST
path: "/api/v1/image/gpt-image-2"
tags: ["Image"]
---

# Generate images with GPT Image 2

`POST /api/v1/image/gpt-image-2`

## Request

- Base URL: `https://www.seedance2ai.io`
- URL: `https://www.seedance2ai.io/api/v1/image/gpt-image-2`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/seedance2ai/apis/seedance-2-0-ai-public-api/docs/api/v1/image/gpt-image-2/post.ts> (a function with typed inputs; its response is checked against the schema)

Generate one to four images from text or from one to ten reference images. When batch_count > 1 the response also returns batch_task_ids, batch_success, and batch_failed.

Rules: on the standard channel, aspect_ratio "auto" only supports resolution 1K and aspect_ratio 1:1 does not support 4K. On the economy channel, 4K requires an explicit aspect_ratio.

## Headers

- `Idempotency-Key` string

## Request body

- union
  - object
    - `type` 'text-to-image', required
    - `prompt` string, required
    - `resolution` '1K' | '2K' | '4K', required
    - `aspect_ratio` 'auto' | '1:1' | '5:4' | '9:16' | '21:9' | '16:9' | '4:3' | '3:2' | '4:5' | '3:4' | '2:3' | '2:1' | '1:2' | '3:1' | '1:3' | '9:21', required
    - `channel` 'standard' | 'economy'
    - `batch_count` integer
  - object
    - `type` 'image-to-image', required
    - `prompt` string, required
    - `image_urls` string[], required
    - `resolution` '1K' | '2K' | '4K', required
    - `aspect_ratio` 'auto' | '1:1' | '5:4' | '9:16' | '21:9' | '16:9' | '4:3' | '3:2' | '4:5' | '3:4' | '2:3' | '2:1' | '1:2' | '3:1' | '1:3' | '9:21', required
    - `channel` 'standard' | 'economy'
    - `batch_count` integer

## Response `202`

Task accepted. Poll GET /api/v1/tasks/{id} with the returned id (prefix gpt2_) until status is completed or failed, and read the files from result_urls there.

- object
  - `id` string, required
  - `status` 'processing' | 'completed', required: Usually processing. A channel that waits for the image inside the request returns completed; the task's result_urls are then ready at GET /api/v1/tasks/{id}.
  - `model` 'gpt-image-2', required
  - `credits_used` number: Credits charged for this task.
  - `remaining_credits` number

## Other responses

- `400`: invalid_request: bad JSON, an unsupported field, or a value outside the documented constraints. The message names the first failing field and details lists them all. Fix the request; retrying it unchanged fails again.
- `401`: unauthorized: the API key is missing, invalid, or revoked.
- `402`: insufficient_credits: the key owner's balance is too low. Some responses also include required_credits and available_credits. Add credits before retrying.
- `403`: purchase_required: the operation needs a successful credits or plan purchase. credits_frozen: credit spending is temporarily unavailable for this account; topping up does not lift it.
- `409`: idempotency_conflict: the Idempotency-Key was used with a different body, or the first request with this key is still running. Use a new key for a new request; wait and retry for a running one.
- `429`: rate_limited: submissions are limited to 30 per 60 seconds and reads to 120 per 60 seconds per account; Seedance requests that inspect reference media have a lower limit. Wait for Retry-After before retrying.
- `500`: internal_error: an unexpected server failure. Retry with the same Idempotency-Key; contact support if it persists.
- `503`: service_busy: a temporary generation or credit-concurrency issue. Retry with the same Idempotency-Key after a short delay.
- `default`: Another structured error. Branch on error.code rather than the HTTP status.

---

[API](https://skmtc.dev/seedance2ai/apis/seedance-2-0-ai-public-api.md) - [All operations](https://skmtc.dev/seedance2ai/apis/seedance-2-0-ai-public-api/llms.txt) - [OpenAPI document](https://skmtc.dev/seedance2ai/apis/seedance-2-0-ai-public-api/revisions/e4ef5c6db219?raw)
