图片生成
curl --request POST \
--url https://alltoken.aatest.online/v1/images/generations \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"prompt": "<string>"
}
'import requests
url = "https://alltoken.aatest.online/v1/images/generations"
payload = {
"model": "<string>",
"prompt": "<string>"
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({model: '<string>', prompt: '<string>'})
};
fetch('https://alltoken.aatest.online/v1/images/generations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"data": [
{}
]
}接口示例
图片生成
图片生成接口。
POST
/
v1
/
images
/
generations
图片生成
curl --request POST \
--url https://alltoken.aatest.online/v1/images/generations \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"prompt": "<string>"
}
'import requests
url = "https://alltoken.aatest.online/v1/images/generations"
payload = {
"model": "<string>",
"prompt": "<string>"
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({model: '<string>', prompt: '<string>'})
};
fetch('https://alltoken.aatest.online/v1/images/generations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"data": [
{}
]
}用途
用于根据文本提示词生成图片。请求头
string
默认值:"Bearer YOUR_API_KEY"
必填
Bearer 鉴权请求头。
请求体
string
默认值:"gpt-image-1"
必填
图片模型名称。
string
默认值:"一张未来感的 AI 控制台界面"
必填
图片生成提示词。
string
默认值:"1024x1024"
可选,输出图片尺寸。
integer
默认值:"1"
可选,生成图片张数。
示例请求体
{
"model": "gpt-image-1",
"prompt": "一张未来感的 AI 控制台界面"
}
响应
object[]
图片结果,通常包含 URL 或 base64 数据。
⌘I