- 🔥最新公告
- OpenAI SDK教程
- 聊天(OpenAIChat)
- AnthropicClaude
- 火山引擎API
- 图像(Images)
- 视频生成(Videos)
- 音频(Audio)
- 嵌入(RAG-Embeddings)
- 重排序(RAG-Reranker)
- 对象存储+文件解析(Files)
- 内容审查(Moderations)
- 助手测试版(AssistantsBeta)待开发
- 线程数(Threads)待开发
- 留言(Messages)待开发
- 运行(Runs)待开发
- 批量API(Batch API)待开发
- 微调(Fine-tuning)待开发
- 🔥AI 工具
- 文档智能&图片处理
- AI产品配置教程
- 教程类
- 系统API
- Midjourney
- 未命名接口POST
- 未命名接口POST
创建图像(Recraftv3)
POST
/v1/images/generations
最后修改时间:2025-05-14 10:38:17
责任人:未设置
请求参数
Authorization
在 Header 添加参数
Authorization
,其值为在 Bearer 之后拼接 Token示例:
Authorization: Bearer ********************
Header 参数
Authorization
string
可选
示例值:
Bearer {{YOUR_API_KEY}}
Body 参数application/json
model
string
必需
prompt
string
必需
n
integer
可选
style_id
null
可选
style
string
可选
'any',
'digital_illustration',
'illustration_3d',
'digital_illustration_seamless',
'digital_illustration_pixel_art',
'digital_illustration_3d',
'digital_illustration_psychedelic',
'digital_illustration_hand_drawn',
'digital_illustration_grain',
'digital_illustration_glow',
'digital_illustration_80s',
'digital_illustration_watercolor',
'digital_illustration_voxel',
'digital_illustration_infantile_sketch',
'digital_illustration_2d_art_poster',
'digital_illustration_kawaii',
'digital_illustration_halloween_drawings',
'digital_illustration_2d_art_poster_2',
'digital_illustration_engraving_color',
'digital_illustration_flat_air_art',
'digital_illustration_hand_drawn_outline',
'digital_illustration_handmade_3d',
'digital_illustration_stickers_drawings',
'realistic_image',
'realistic_image_mockup',
'realistic_image_b_and_w',
'realistic_image_enterprise',
'realistic_image_hard_flash',
'realistic_image_hdr',
'realistic_image_natural_light',
'realistic_image_studio_portrait',
'realistic_image_motion_blur',
'vector_illustration',
'vector_illustration_seamless',
'vector_illustration_line_art',
'vector_illustration_doodle_line_art',
'vector_illustration_flat_2',
'vector_illustration_70s',
'vector_illustration_cartoon',
'vector_illustration_kawaii',
'vector_illustration_linocut',
'vector_illustration_engraving',
'vector_illustration_halloween_stickers',
'vector_illustration_line_circuit',
substyle
null
可选
response_format
string
可选
size
string
可选
controls
null
可选
示例
{
"model": "recraftv3", // recraftv3、flux系列、sd系列、cogview系列、hunyuan系列、step系列、kling系列
"prompt": "鸟瞰图,海岸线,海水清澈见底,细节和自然之美。特写,超高清,最好的质量,超高细节的画质,8K分辨率", // 必需参数,描述所需图像的文本,最大长度为500个字符
"n": 1, // 整数或null,默认为1,目前仅支持n=1和n=2
"style_id": null, // UUID或null,使用之前上传的风格作为参考
"style": "realistic_image", // 字符串或null,默认为realistic_image,生成图像的风格
"substyle": null, // 字符串或null,子风格,具体内容在上面有涉及
"response_format": "url", // 字符串或null,默认为url,返回生成图像的格式,必须是url或b64_json之一
"size": "1024x1024", // 字符串或null,默认为1024x1024,生成图像的大小,以WxH格式表示
"controls": null // 对象或null,一组自定义参数,用于调整生成过程
}
示例代码
Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location --request POST '/v1/images/generations' \
--header 'Authorization: Bearer {{YOUR_API_KEY}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"model": "recraftv3", // recraftv3、flux系列、sd系列、cogview系列、hunyuan系列、step系列、kling系列
"prompt": "鸟瞰图,海岸线,海水清澈见底,细节和自然之美。特写,超高清,最好的质量,超高细节的画质,8K分辨率", // 必需参数,描述所需图像的文本,最大长度为500个字符
"n": 1, // 整数或null,默认为1,目前仅支持n=1和n=2
"style_id": null, // UUID或null,使用之前上传的风格作为参考
"style": "realistic_image", // 字符串或null,默认为realistic_image,生成图像的风格
"substyle": null, // 字符串或null,子风格,具体内容在上面有涉及
"response_format": "url", // 字符串或null,默认为url,返回生成图像的格式,必须是url或b64_json之一
"size": "1024x1024", // 字符串或null,默认为1024x1024,生成图像的大小,以WxH格式表示
"controls": null // 对象或null,一组自定义参数,用于调整生成过程
}'
返回响应
🟢200成功
application/json
Body
created
integer
必需
data
array [object {1}]
必需
url
string
可选
示例
{
"created": 1730454746,
"data": [
{
"url": "https://sfile.chatglm.cn/chatglm4/2f7c6495-6f25-4f06-a879-4060fb6deb94.png"
}
],
"image": [
"https://sfile.chatglm.cn/chatglm4/2f7c6495-6f25-4f06-a879-4060fb6deb94.png"
],
"metadata": {
"credits": 1,
"height": 1024,
"images": [
{
"image_id": "6373079f-9bf2-45e4-99be-6d040902b9d0",
"image_invariants": {
"preset": "realistic_image"
},
"transparent": false,
"vector_image": false
}
],
"random_seed": 3740463984,
"request_id": "f97fb170-2f7a-4493-8693-1717506365b5",
"transform_model": "recraftv3",
"width": 1024
}
}
修改于 2025-05-14 10:38:17