Image Generation (Image Generation)
AI image generation interface supporting multiple styles and sizes. Generate high-quality images from text descriptions.
API Endpoints
POST
/image/generationGenerate image
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Required | Model name: image-01 |
prompt | string | Required | Image description text |
n | integer | Optional | Number of images to generate, default 1 |
size | string | Optional | Image size, e.g. 1024x1024 |
aspect_ratio | string | Optional | Aspect ratio, e.g. 16:9, 1:1 |
Request Example
Request Example
{
"model": "image-01",
"prompt": "一幅水墨画风格的山水画,远处有云雾缭绕的山峰",
"n": 1,
"aspect_ratio": "16:9"
}Response Example
Response Example
{
"data": [
{
"url": "https://...",
"revised_prompt": "..."
}
],
"usage": {
"image_count": 1
}
}Code Examples
import requests
url = "https://your-proxy-domain.com/v1/image/generation"
headers = {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
}
data = {
"model": "image-01",
"prompt": "一幅水墨画风格的山水画,远处有云雾缭绕的山峰",
"n": 1,
"aspect_ratio": "16:9"
}
response = requests.post(url, headers=headers, json=data)
result = response.json()
print("图片URL:", result["data"][0]["url"])