On this page
Seedream 5.0 Pro API
Use the Seedream 5.0 Pro API to generate one image from a text prompt or up to ten public HTTPS reference images. Imya handles API authentication, asynchronous tasks, live credit quotes, sanitized errors, and stored results.
REST API · v1 · Async tasks
What you can build
Use one REST workflow for prompt-based creation, reference-guided variations, and automated image generation.
Product and campaign images
Generate product scenes, advertising concepts, and branded visuals from a text prompt.
Reference-guided variations
Use 1-10 reference images to guide the subject, composition, or visual direction of a new result.
Automated image workflows
Submit asynchronously, poll a public task ID, and receive the finished image from Imya-managed storage.
Make your first Seedream 5.0 Pro API request
Create a task, keep its public task ID, then retrieve the task until it succeeds or fails.
- 1
Create an API key
Generate a key from your Imya account settings.
- 2
Choose an input
Use a prompt alone or add 1-10 reference images.
- 3
Retrieve the result
Poll the public task ID at most every 5 seconds.
Authentication and idempotency
Send your Imya API key as a Bearer token. Every generation POST also requires a unique Idempotency-Key so network retries cannot create another task or charge.
Authorization: Bearer YOUR_IMYA_API_KEY
Content-Type: application/json
Idempotency-Key: YOUR_UNIQUE_REQUEST_KEYCreate an image generation
Omit image_urls for text-to-image. Add 1-10 public HTTPS images for reference-image generation. The server returns the live credits_reserved for this request.
/v1/images/generationscurl https://imya.ai/v1/images/generations \
-H "Authorization: Bearer YOUR_IMYA_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: seedream-product-shot-001" \
-d '{
"model": "seedream-5-pro",
"prompt": "A premium skincare bottle on pale stone, soft morning light",
"aspect_ratio": "4:3",
"quality": "basic",
"output_format": "png",
"n": 1
}'curl https://imya.ai/v1/images/generations \
-H "Authorization: Bearer YOUR_IMYA_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: seedream-edit-001" \
-d '{
"model": "seedream-5-pro",
"prompt": "Keep the product shape and place it in a warm studio",
"image_urls": ["https://cdn.example.com/input/product.png"],
"aspect_ratio": "4:3",
"quality": "high",
"output_format": "jpeg",
"n": 1
}'Retrieve a task
Returns the latest state, final credit usage, stored image result, or a sanitized error. Poll no faster than every 5 seconds.
/v1/tasks/{task_id}curl https://imya.ai/v1/tasks/task_0123456789abcdef0123456789abcdef \
-H "Authorization: Bearer YOUR_IMYA_API_KEY"Request parameters
| Field | Type | Required | Description |
|---|---|---|---|
| model | string | Yes | Use seedream-5-pro. |
| prompt | string | Yes | Generation instructions, 3 to 5,000 characters. |
| image_urls | string[] | No | 1-10 public HTTPS reference images. Omit for text-to-image. |
| aspect_ratio | string | No | 1:1, 4:3, 3:4, 16:9, 9:16, 2:3, 3:2, or 21:9. Default: 1:1. |
| quality | string | No | basic or high. Default: basic. |
| output_format | string | No | png or jpeg. Default: png. |
| n | number | No | Must be 1. Exactly one image is generated. |
Responses
{
"id": "task_0123456789abcdef0123456789abcdef",
"status": "pending",
"model": "seedream-5-pro",
"credits_reserved": 44
}{
"id": "task_0123456789abcdef0123456789abcdef",
"status": "succeeded",
"model": "seedream-5-pro",
"credits_used": 44,
"data": [
{
"url": "https://cdn.imya.ai/generated/example.png"
}
]
}A new task returns HTTP 202. An exact idempotent replay returns HTTP 200 with Idempotent-Replayed: true. Successful images are copied to Imya-managed storage before the task becomes succeeded. Failed tasks can report generation_failed, refund_pending, or media_deleted.
Live credit billing
The base cost is 35 credits for both basic and high quality. The server applies the API key owner’s current plan coefficient. The example shows a regular account at 1.25×, rounded to 44 credits. Always use credits_reserved from the response. If a task remains unfinished for 30 minutes, Imya marks it failed and refunds eligible credits once without extending their original expiration date.
View credit plansTask status
pendingThe task was accepted and is waiting to start.
processingThe model is generating the image.
succeededGeneration finished and data contains the stored image.
failedGeneration failed. Read the sanitized error object.
Errors
400Missing Idempotency-Key or malformed JSON.
401Missing or invalid API key.
402The account does not have enough credits.
403The API account is disabled or the request is not allowed.
409The idempotency key was reused with a different body.
413The request body exceeds 64 KiB.
422A model parameter, prompt, or reference image is invalid.
429The API key reached its rate or concurrency limit.
5xxThe request could not be completed. Check the task before creating a new request.
Ready to build?
Create an Imya API key for your first request, or test prompts, reference images, and quality settings in the hosted generator before integrating.