- 起步
- 介绍
- 导言
- 身份验证
- 发出请求
- 参数详情
- 音频(Audio)
- 聊天(Chat)
- 自动补全(Completions)
- 嵌入(Embeddings)
- 微调(Fine-tuning)
- 图像(Images)
- 模型(Models)
- 文件(Files)
- 审查(Moderations)
- 助手测试版(AssistantsBeta)
- 线程数(Threads)
- 留言(Messages)
- 运行(Runs)
- 已弃用-音频(Audio)
- English
- Authentication
- Making requests
- Streaming
- Debugging requests
- Backward compatibility
- Administration
- Introduction
- Batch
- Models
- Invites
- Chat
- Users
- Projects
- Project users
- Project service accounts
- Project API keys
- Audit logs
- Usage
- Project rate limits
- Completions
- Uploads
- Images
- Embeddings
- Audio
- Files
- Fine-tuning
- Moderations
- Assistants (v1)
- Threads (v1)
- Messages (v1)
- Runs (v1)
创建图像
POST
https://api.openai.com/v1/images/generations
Request
Authorization
Provide your bearer token in the
Authorization
header when making requests to protected resources.Example:
Authorization: Bearer ********************
Header Params
Authorization
string
optional
Example:
Bearer {{YOUR_API_KEY}}
Body Params application/json
prompt
string
required
model
string
optional
n
integer
optional
quality
string
optional
hd
创建具有更精细细节和更高一致性的图像。此参数仅支持dall-e-3
.response_format
string
optional
style
string
optional
256x256
、512x512
或1024x1024
for之一dall-e-2
。对于模型来说,必须是1024x1024
、1792x1024
、 或之一。1024x1792``dall-e-3
user
string
optional
vivid
之一natural
。生动使模型倾向于生成超真实和戏剧性的图像。自然使模型生成更自然、不太真实的图像。此参数仅支持dall-e-3
.size
string
optional
Example
{
"model": "dall-e-3",
"prompt": "A cute baby sea otter",
"n": 1,
"size": "1024x1024"
}
Request samples
Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://api.openai.com/v1/images/generations' \
--header 'Authorization: Bearer ' \
--header 'Content-Type: application/json' \
--data-raw '{
"model": "dall-e-3",
"prompt": "A cute baby sea otter",
"n": 1,
"size": "1024x1024"
}'
Responses
🟢200Create image
application/json
Body
created
integer
required
data
array [object {1}]
required
url
string
required
Example
{
"created": 1589478378,
"data": [
{
"url": "https://..."
},
{
"url": "https://..."
}
]
}
Modified at 2024-12-13 09:12:13