⌘K

Spark Text to Image 3.0

spark_t2i_3_0

General-purpose image generation focused on visual stability and solid composition, suitable for large-scale and standardized content creation.

Authentication

authorization string required

All APIs require authentication via Bearer Token.

Get API Key:

Visit API Key Management Page to get your API Key.

Usage:

Add to request header:

Authorization: Bearer YOUR_API_KEY

Parameters

model string required

Model ID to use for the request

Value: spark_t2i_3_0


prompt string required

Text prompt for generating the image. Supports both Chinese and English

Recommended length: ≤120 characters, maximum 800 characters. Excessively long prompts may cause abnormal generation or no effect


use_pre_llm boolean

Enable text expansion. When enabled, the input prompt will be expanded and optimized. Recommended to enable for shorter prompts, and disable for longer prompts

Default: true


seed integer

Random seed used to determine the initial state of diffusion. If the seed is the same positive integer and all other parameters are identical, the generated images will have a very high probability of being consistent

Default: -1 (random)


width integer

Width of the generated image

Supports custom width and height with aspect ratio between 1:3 and 3:1, and total pixels between [512×512, 2048×2048]

Recommended aspect ratios:

Standard 1K:
1328 × 1328 (1:1)
1472 × 1104 (4:3)
1584 × 1056 (3:2)
1664 × 936 (16:9)
2016 × 864 (21:9)

High Definition 2K:
2048 × 2048 (1:1)
2304 × 1728 (4:3)
2496 × 1664 (3:2)
2560 × 1440 (16:9)
3024 × 1296 (21:9)

Both width and height must be provided together to take effect

Default: 1328


height integer

Height of the generated image

Supports custom width and height with aspect ratio between 1:3 and 3:1, and total pixels between [512×512, 2048×2048]

Both width and height must be provided together to take effect

Default: 1328


Polling

Since image generation takes time, you need to poll the task status after creation

The initial response returns the task ID and initial status. The actual generation results must be obtained through polling the task status endpoint

Response Format

error object

Error information. Only present when status is failed

code integer

Error code

error_message string

Detailed error message


output array

Generation results. Only present when status is completed

content array

List of generated image content

type string

Resource type. Value: image

url string

Generated image URL

size integer

File size in bytes

jobId string

Remote job ID


usage object

Usage statistics. Only present when status is completed

cost string

Total cost in USD

discount number

Discount amount

input_tokens integer

Number of input tokens

output_tokens integer

Number of output tokens

total_tokens integer

Total number of tokens


Error Codes

Error CodeDescription
003001001Missing prompt
003001002Invalid prompt length (1-800 characters)
003001003Invalid use_pre_llm parameter
003001004Invalid seed parameter (must be -1 or positive integer)
003001005Invalid size parameter
003001006Invalid aspect ratio (must be between 1:3 and 3:1)
003001007Width and height must both be provided
003001008Width and height must be integers
003001009Width and height must be in 512-2048 range
003001095Internal generation error
003001096Result parsing error
003001097HTTP error response
003001098Status check error
003001099Task creation error