Seedream-4-5 API Reference

Overview

PropertyValue
Model IDseedream-4-5
TypeText-to-Image, Image-to-Image
Pricing$0.04/per output image
Average Time20-50 seconds

Authentication

All API requests require authentication using a Bearer token in the Authorization header:

Authorization: Bearer YOUR_API_KEY

Endpoints

1. Submit Generation Task

POST https://api.apixo.ai/api/v1/generateTask/seedream-4-5

2. Query Task Status

GET https://api.apixo.ai/api/v1/statusTask/seedream-4-5?taskId={taskId}

Request Parameters

Request Body Structure

{
  "request_type": "callback",
  "callback_url": "https://your-server.com/callback",
  "input": {
    "mode": "text-to-image",
    "prompt": "Your image description",
    "resolution": "2K",
    ...
  }
}

Top-Level Parameters

ParameterTypeRequiredDescription
request_typestringYesRequest mode: async (poll results) or callback (webhook notification)
callback_urlstringNoWebhook URL for callback mode. Must be publicly accessible
inputobjectYesGeneration parameters (see below)

Input Parameters

ParameterTypeRequiredDefaultDescription
modestringYestext-to-imageGeneration mode: text-to-image or image-to-image
promptstringYes-Image description up to 5,000 characters
image_urlsstring[]No-Up to 10 reference image URLs for image-to-image editing
max_imagesintYes1Number of image variations to produce (between 1 and 10)
resolutionstringNo2KOutput image resolution: 2K or 4K

Response Format

Task Submission Response

{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678"
  }
}

Status Query Response

Processing:

{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678",
    "state": "processing",
    "createTime": 1698765400000
  }
}

Success:

{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678",
    "state": "success",
    "resultJson": "{\"resultUrls\":[\"https://example.com/image.jpg\"]}",
    "costTime": 12000,
    "createTime": 1698765400000,
    "completeTime": 1698765412000
  }
}

Failed:

{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678",
    "state": "failed",
    "failCode": "CONTENT_VIOLATION",
    "failMsg": "Content does not meet safety guidelines",
    "createTime": 1698765400000,
    "completeTime": 1698765412000
  }
}

Response Fields:

FieldTypeDescription
codeintegerHTTP status code (200 = success)
data.taskIdstringUnique task identifier
data.statestringTask state: pending, processing, success, failed
data.resultJsonstringJSON string with resultUrls array (on success)
data.costTimeintegerGeneration time in milliseconds
data.failCodestringError code (on failure)
data.failMsgstringError message (on failure)

Callback Response

When the task is completed, the system will send a POST request to your callBackUrl in the following format:

Success Callback

{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678",
    "state": "success",
    "resultJson": "{\"resultUrls\":[\"https://example.com/result.jpg\"]}",
    "completeTime": 1698765412000,
    "createTime": 1698765400000,
    "costTime": 12000
  }
}

Failure Callback

{
  "code": 400,
  "message": "failed",
  "data": {
    "taskId": "task_12345678",
    "state": "failed",
    "failCode": "CONTENT_VIOLATION",
    "failMsg": "Content does not meet safety guidelines",
    "completeTime": 1698765412000,
    "createTime": 1698765400000,
    "costTime": 12000
  }
}

Quick Start

1. Text-to-Image Generation

curl -X POST https://api.apixo.ai/api/v1/generateTask/seedream-4-5 \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "request_type": "async",
    "input": {
      "mode": "text-to-image",
      "prompt": "A beautiful sunset over the mountains",
      "resolution": "2K",
      "max_images": 1
    }
  }'

Response:

{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678"
  }
}

2. Check Task Status

curl -X GET "https://api.apixo.ai/api/v1/statusTask/seedream-4-5?taskId=task_12345678" \
  -H "Authorization: Bearer YOUR_API_KEY"

Response (Success):

{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678",
    "state": "success",
    "resultJson": "{\"resultUrls\":[\"https://example.com/image.jpg\"]}"
  }
}

3. Image-to-Image Editing

curl -X POST https://api.apixo.ai/api/v1/generateTask/seedream-4-5 \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "request_type": "async",
    "input": {
      "mode": "image-to-image",
      "prompt": "Transform into a watercolor painting style",
      "image_urls": ["https://example.com/input.jpg"],
      "resolution": "2K",
      "max_images": 1
    }
  }'

Best Practices

Request Mode Selection

ModeUse When
CallbackProduction environments with public server endpoints
AsyncClient-side apps or when webhook setup is not feasible

Performance Tips

  • Async Mode: Wait 30 seconds before first poll, then poll every 5 seconds
  • Timeout: Set maximum wait time to 5 minutes
  • Rate Limiting: Avoid excessive concurrent requests
  • Error Handling: Always check state field and handle failures gracefully

Resource Management

  • Image URLs may be temporary - download and store important results
  • Clean up failed tasks appropriately
  • Log taskId for debugging and support