curl --request POST \
--url 'https://api.elkapi.com/v1/images/generations' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "gpt-image-1.5",
"input": "今天天气真好,适合出去散步。"
}'
import requests
url = "https://api.elkapi.com/v1/images/generations"
headers = {
"Authorization": "Bearer <token>"
}
headers["Content-Type"] = "application/json"
payload = {
"model": "gpt-image-1.5",
"input": "今天天气真好,适合出去散步。"
}
response = requests.request("POST", url, headers=headers, json=payload)
print(response.json())
const url = "https://api.elkapi.com/v1/images/generations";
const headers = {
"Authorization": "Bearer <token>"
};
headers["Content-Type"] = "application/json";
const payload = {
"model": "gpt-image-1.5",
"input": "今天天气真好,适合出去散步。"
};
const response = await fetch(url, {
method: "POST",
headers,
body: JSON.stringify(payload)
});
console.log(await response.json());
{
"created": 1,
"data": [
{
"url": "https://example.com/image.png",
"b64_json": "b64_json",
"revised_prompt": "revised_prompt"
}
]
}
通义千问 OpenAI 格式
生成图像
- 百炼qwen-image系列图片生成
POST
/
v1
/
images
/
generations
curl --request POST \
--url 'https://api.elkapi.com/v1/images/generations' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "gpt-image-1.5",
"input": "今天天气真好,适合出去散步。"
}'
import requests
url = "https://api.elkapi.com/v1/images/generations"
headers = {
"Authorization": "Bearer <token>"
}
headers["Content-Type"] = "application/json"
payload = {
"model": "gpt-image-1.5",
"input": "今天天气真好,适合出去散步。"
}
response = requests.request("POST", url, headers=headers, json=payload)
print(response.json())
const url = "https://api.elkapi.com/v1/images/generations";
const headers = {
"Authorization": "Bearer <token>"
};
headers["Content-Type"] = "application/json";
const payload = {
"model": "gpt-image-1.5",
"input": "今天天气真好,适合出去散步。"
};
const response = await fetch(url, {
method: "POST",
headers,
body: JSON.stringify(payload)
});
console.log(await response.json());
{
"created": 1,
"data": [
{
"url": "https://example.com/image.png",
"b64_json": "b64_json",
"revised_prompt": "revised_prompt"
}
]
}
curl --request POST \
--url 'https://api.elkapi.com/v1/images/generations' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "gpt-image-1.5",
"input": "今天天气真好,适合出去散步。"
}'
import requests
url = "https://api.elkapi.com/v1/images/generations"
headers = {
"Authorization": "Bearer <token>"
}
headers["Content-Type"] = "application/json"
payload = {
"model": "gpt-image-1.5",
"input": "今天天气真好,适合出去散步。"
}
response = requests.request("POST", url, headers=headers, json=payload)
print(response.json())
const url = "https://api.elkapi.com/v1/images/generations";
const headers = {
"Authorization": "Bearer <token>"
};
headers["Content-Type"] = "application/json";
const payload = {
"model": "gpt-image-1.5",
"input": "今天天气真好,适合出去散步。"
};
const response = await fetch(url, {
method: "POST",
headers,
body: JSON.stringify(payload)
});
console.log(await response.json());
{
"created": 1,
"data": [
{
"url": "https://example.com/image.png",
"b64_json": "b64_json",
"revised_prompt": "revised_prompt"
}
]
}
Authorizations
string
必填
所有接口均需要使用 Bearer Token 进行认证。在请求头中添加:
Authorization: Bearer YOUR_API_KEY
Body
string
默认值:"gpt-image-1.5"
必填
示例:
gpt-image-1.5Response
integer
⌘I