- (必读)网站使用教程
- (必读)前言
- 批量请求示例
- 常见问题及解决办法
- 聊天模型
- 音乐生成
- 绘画模型
- Midjourney
- Dalle和Gpt-image-1和Sora_image
- Flux
- Grok
- Stable-diffusion
- 即梦AI
- 可灵AI
- 音频模型
- 视频生成
- 查询令牌用量GET
- 查询令牌限额GET
生成图像(chat 格式)
POST
https://api.apicore.ai/v1/chat/completions
请求参数
Header 参数
Content-Type
string
可选
示例值:
application/json
Authorization
string
可选
示例值:
Bearer sk-xxxx
Body 参数application/json
stream
boolean
必需
model
string
必需
messages
array [object {2}]
必需
role
string
可选
content
string
可选
示例
{
"stream": false,
"model": "flux",
"messages": [
{
"role": "user",
"content": "画个 gptgod 网站的 icon"
}
]
}
示例代码
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.apicore.ai/v1/chat/completions' \
--header 'Authorization: Bearer sk-xxxx' \
--header 'Content-Type: application/json' \
--data-raw '{
"stream": false,
"model": "flux",
"messages": [
{
"role": "user",
"content": "画个 gptgod 网站的 icon"
}
]
}'
返回响应
🟢200成功
text/plain
Body
object {0}
示例
{"id":"chatcmpl-89DJ6n8Buxn2rarhsH3SGjctL5MNC","object":"chat.completion","created":1722957713,"model":"flux","choices":[{"index":0,"message":{"role":"assistant","content":"```\n{\n \"prompt\": \"A modern, sleek icon design for a website called 'gptgod'. The icon should feature abstract elements representing AI technology, with a color palette of blue and silver. The design should be minimalistic yet impactful, suitable for digital platforms. The icon should convey intelligence and innovation.\",\n \"height\": 1440,\n \"width\": 1440\n}\n```\n\n\n\n> 生成中...✅\n\n"},"finish_reason":"stop"}],"usage":{"prompt_tokens":18,"completion_tokens":162,"total_tokens":180}}