POST /v1/tasks
Create one asynchronous image or video generation task. Send the exact public model ID, operation and supported input.
Request fields
Maximum JSON request body: 64 KiB. Base64 uploads, multipart bodies and batches are not supported by this endpoint.
| Field/header | Required | Meaning |
|---|---|---|
| Authorization | Yes | Bearer API key |
| Idempotency-Key | Yes | 8–128 letters, digits, dots, underscores, colons or hyphens |
| model | Yes | Exact catalog slug |
| operation | Yes | For example text-to-image or text-to-video |
| input | Yes | Object matching the selected operation schema |
| callback | No | Use a saved endpoint_id, or omit when polling |
Example request
This is a single 2K image request. Consult the live model page before submitting.
export AI_API_BASE_URL="https://gikyapi.com"
export AI_API_KEY="YOUR_API_KEY"
# Generate once, then preserve this value for retries of this same request.
export REQUEST_ID="$(python3 -c 'import uuid; print(uuid.uuid4())')"
curl --fail-with-body --max-time 35 "$AI_API_BASE_URL/v1/tasks" \
-H "Authorization: Bearer $AI_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $REQUEST_ID" \
--data '{
"model": "seedream-5-flash",
"operation": "text-to-image",
"input": {
"prompt": "A blue ceramic cup beside an orange, soft morning light",
"resolution": "2K",
"aspect_ratio": "1:1"
}
}'Idempotency and uncertain responses
Persist the key and body before sending. A replay of an identical request with the same API key and idempotency key returns the existing task. Do not change the body while reusing the key. A timeout or HTTP 5xx does not prove that no task was created: replay the original request, not a new one.
Response
HTTP 202 returns the task object. Generation runs asynchronously and can still fail after acceptance. Store id immediately; use GET /v1/tasks/{id} to read outputs. The public response does not expose provider routing.