ByteDance: Seedream 4.0 (Text to Image) API Reference

About

ByteDance Seedream 4.0 generates a single image from a text prompt through BytePlus ModelArk. This Text to Image endpoint supports 1K, 2K, 4K size presets and custom pixel dimensions within the model limits, with optional watermark control. Generation is exposed through asynchronous platform tasks.

1. Calling the API

Setup your API Key

To begin using Infron, you first need to create an account and generate your API Key.

Once you have your API key, set it as an environment variable in your runtime environment. This allows your applications to securely access Infron’s API.

export INFRON_KEY="YOUR_API_KEY"

Submit a request

For long-running requests, you can poll for results.

curl https://media.onerouter.pro/v1/images/generations \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "bytedance/seedream-4.0/text-to-image",
  "prompt": "A single ceramic cup on a wooden table, soft studio lighting and realistic material detail."
}'

Response with queue task id

The response will look like this:

{
  "code": 200,
  "message": "success",
  "data": {
    "task_id": "TASK_ID",
    "object": "image",
    "model": "bytedance/seedream-4.0/text-to-image",
    "status": "created",
    "urls": {
      "query": "https://media.onerouter.pro/v1/images/tasks/TASK_ID"
    },
    "created_at": "YYYY-MM-DD HH:MM:SS"
  }
}

Fetch request status

You can fetch the status of a request to check if it is completed or still in progress.

curl https://media.onerouter.pro/v1/images/tasks/{task_id} \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json"

Response with queue task status query

{
  "code": 200,
  "message": "success",
  "data": {
    "task_id": "TASK_ID",
    "object": "image",
    "model": "bytedance/seedream-4.0/text-to-image",
    "status": "in_progress",
    "fail_reason": "",
    "submit_time": 0,
    "start_time": 0,
    "finish_time": 0,
    "outputs": [],
    "created_at": "YYYY-MM-DD HH:MM:SS"
  }
}

Possible statuses:

  • created
  • in_progress
  • queued
  • completed
  • failed

created -> in_progress → queued → completed | failed

Poll every 1-2 seconds until status is "completed" or "failed"

Get the result (when status is "completed")

Once the request is completed, you can fetch the result. See the Output Schema for the expected result format.

{
  "code": 200,
  "message": "success",
  "data": {
    "task_id": "TASK_ID",
    "object": "image",
    "model": "bytedance/seedream-4.0/text-to-image",
    "status": "completed",
    "fail_reason": "",
    "submit_time": 0,
    "start_time": 0,
    "finish_time": 0,
    "outputs": [
      "OUTPUT_IMAGE_URL"
    ],
    "usage": {
      "image_count": 1
    },
    "cost": {
      "total_cost": 0.03
    },
    "created_at": "YYYY-MM-DD HH:MM:SS"
  }
}

2. Schema

Input

ParameterTypeRequiredDefaultRangeDescription
modelstringYes--bytedance/seedream-4.0/text-to-imagePublic model ID.
promptstringYes----Text prompt describing the requested single image.
sizestringNoUpstream default: 2048x20481K, 2K, 4K, WIDTHxHEIGHTCustom area 921,600–16,777,216 pixels; width/height ratio 1:16–16:1.
nintegerNo11This endpoint returns a single output image.
watermarkbooleanNofalsetrue, falseAdd or omit the upstream AI-generated watermark.
providerobjectNo--Platform routing optionsSelect the provider and service tier.
queuebooleanNotruePlatform-managedGeneration uses an asynchronous platform task.
webhook_urlstringNo--Callback URLOptional existing task completion callback.

Only single-image output is exposed. Sequential generation, prompt-optimization modes and streaming are not enabled on this platform endpoint. Unsupported fields are filtered before the BytePlus request.

Example request

curl https://media.onerouter.pro/v1/images/generations \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "bytedance/seedream-4.0/text-to-image",
  "prompt": "A single ceramic cup on a wooden table, soft studio lighting and realistic material detail.",
  "size": "4K",
  "n": 1,
  "watermark": true
}'

Output

ParameterTypeRangeDescription
codeinteger--Status code of the request.
messagestring--Status message of the request.
dataobject--Data of the task.
data.task_idstring--ID of the task.
data.objectstring--Object type of the task.
data.modelstring--Model name of the task.
data.statusstringcreated, in_progress, queued, completed, failedStatus of the task.
data.fail_reasonstring--Fail reason of the task.
data.submit_timeinteger--Timestamp of the task submission.
data.start_timeinteger--Timestamp of the task start.
data.finish_timeinteger--Timestamp of the task finish.
data.outputsarray--Outputs of the task.
data.created_atstring--Timestamp of the task creation.

Example output

{
  "code": 200,
  "message": "success",
  "data": {
    "task_id": "TASK_ID",
    "object": "image",
    "model": "bytedance/seedream-4.0/text-to-image",
    "status": "completed",
    "fail_reason": "",
    "submit_time": 0,
    "start_time": 0,
    "finish_time": 0,
    "outputs": [
      "OUTPUT_IMAGE_URL"
    ],
    "usage": {
      "image_count": 1
    },
    "cost": {
      "total_cost": 0.03
    },
    "created_at": "YYYY-MM-DD HH:MM:SS"
  }
}

3. Detailed Pricing

Generation TypeOutput ImagesEstimated Price
Text to Image1$0.03

Input reference images are free. Prices are in USD per successfully generated output image.