- OpenAI
- Claude
- Midjourney
- 翻译
- 文心一言
- Stable Diffusion
图片生成 /v1/images/generations
POST
https://api.aigc2d.com/v1/images/generations
OpenAI
请求参数
Authorization
在 Header 添加参数
Authorization
,其值为在 Bearer 之后拼接 Token示例:
Authorization: Bearer ********************
Body 参数application/json
model
string
必需
prompt
string <string>
必需
n
integer
可选
size
enum<string> <string>
生成图片的大小
枚举值:
256x256512x5121024x10241792x10241024x1792
response_format
enum<string> <string>
可选
枚举值:
urlb64_json
默认值:
url
user
string <string>
可选
quality
string
必需
style
string
必需
示例
{
"prompt": "A cute baby sea otter",
"n": 2,
"size": "1024x1024",
"model": "dall-e-2"
}
示例代码
Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://api.aigc2d.com/v1/images/generations' \
--header 'Content-Type: application/json' \
--data-raw '{
"prompt": "A cute baby sea otter",
"n": 2,
"size": "1024x1024",
"model":"dall-e-2"
}'
返回响应
🟢200成功
application/json
Body
created
integer
必需
data
array [object {1}]
数据
url
string
图片url
示例
{
"created": 1589478378,
"data": [
{
"url": "https://..."
},
{
"url": "https://..."
}
]
}
🟠400请求有误
修改于 2023-12-16 09:00:44