图像 API
支持端点
POST /v1/images/generations:图像生成POST /v1/images/edits:图像编辑POST /v1/images/variations:图像变体(当前未开放,返回 501)
基础地址:https://anideaai.com/v1
公共请求头
| 请求头 | 必填 | 说明 |
|---|---|---|
Authorization | 是 | Bearer sk-xxxxx |
Content-Type | 是 | application/json 或 multipart/form-data |
1) 图像生成:POST /v1/images/generations
常用参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
model | string | 是 | 图片模型,如 gpt-image-1、qwen-image-plus |
prompt | string | 否 | 文本提示词(OpenAI 风格) |
n | integer | 否 | 生成数量 |
size | string | 否 | 例如 1024x1024 |
response_format | string | 否 | url 或 b64_json |
cURL 示例(OpenAI 风格)
curl https://anideaai.com/v1/images/generations \
-H "Authorization: Bearer sk-xxxxx" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-image-1",
"prompt": "一个米色风格的 AI 控制台首页插画",
"size": "1024x1024"
}'
cURL 示例(Qwen 图像风格)
curl https://anideaai.com/v1/images/generations \
-H "Authorization: Bearer sk-xxxxx" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen-image-plus",
"input": {
"messages": [
{
"role": "user",
"content": [{"text": "生成一张新加坡城市夜景海报"}]
}
]
},
"parameters": {"size": "1328*1328", "watermark": false}
}'
响应示例
{
"created": 1741322000,
"data": [
{
"url": "https://cdn.example.com/image_001.png"
}
]
}
2) 图像编辑:POST /v1/images/edits
常用参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
model | string | 是 | 编辑模型 |
image / input | string/object | 是 | 原始图片 URL 或结构化输入 |
prompt | string | 否 | 编辑指令 |
mask | string | 否 | 蒙版 |
n | integer | 否 | 输出数量 |
size | string | 否 | 输出尺寸 |
cURL 示例
curl https://anideaai.com/v1/images/edits \
-H "Authorization: Bearer sk-xxxxx" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen-image-edit-plus",
"input": {
"messages": [
{
"role": "user",
"content": [
{"image": "https://example.com/original.png"},
{"text": "把画面改成黄昏,保留主体构图"}
]
}
]
}
}'
3) 图像变体:POST /v1/images/variations
当前该端点在网关侧尚未开放,请求会返回 501 Not Implemented。
错误示例
{
"error": {
"message": "API not implemented",
"type": "new_api_error",
"param": "",
"code": "api_not_implemented"
}
}