Overview
This API is compatible with the OpenAI image generation API. When called synchronously, it directly returns the image result. For asynchronous calls, set X-Async: true. After the task ID is returned, you can query it through /api/v1/tasks/{task_id}.
API details
Constraints
- The caller must have an API Key. For more information, see Manage AI API Keys.
Request path
POST {BASE_URL}/api/v1/images/generations
Request header
Name |
Required |
Example value |
Description |
|---|---|---|---|
| Authorization | Yes | Bearer {token} | Authentication information |
| Content-Type | No | application/json | Request body format |
| X-Async | No | true | Set totrueto submit an asynchronous image generation task. |
Request parameters
Path
None
Query
None
Body
Name |
Type |
Required |
Example value |
Description |
|---|---|---|---|---|
| model | string | Yes | Model name |
Vendor-specific parameters
The request parameters for image generation models vary by vendor. Refer to the corresponding vendor's documentation for detailed parameter descriptions:
- Volcano Engine: Refer to Volcano Engine image generation API document
- Alibaba Cloud Bailian: Refer to Alibaba Cloud Bailian model API document
Response
Response parameters
Name |
Type |
Description |
|---|---|---|
| success | boolean | Whether the request was successful |
| code | string | Return code |
| message | string | Response parameters |
| data | object | Business response data |
data
Name |
Type |
Description |
|---|---|---|
| None | The return data structure is unknown and depends on the specific implementation. |
Request example
curl --request POST '{BASE_URL}/api/v1/images/generations' \
--header 'Authorization: Bearer {token}' \
--header 'Content-Type: application/json' \
--data '{
"model": "your-model-name"
}'
Response example
{
"success": true,
"code": "200",
"message": "successful",
"data": {
// Example response data, specific structure unknown
}
}
