Generate Images
Generate images from text prompts
Authorization
BearerAuth
AuthorizationBearer <token>
使用 Bearer Token 认证。
格式: Authorization: Bearer sk-xxxxxx
In: header
Request Body
application/json
model?string
用于图像生成的模型。dall-e-2、dall-e-3 或 gpt-image-1 之一。
prompt*string
所需图像的文本描述
n?integer
要生成的图像数量
Range
1 <= value <= 10size?string
生成的图像大小
Value in
"256x256" | "512x512" | "1024x1024" | "1536x1024" | "1024x1536" | "1792x1024" | "1024x1792"background?string
背景透明度设置(仅 gpt-image-1)
Value in
"transparent" | "opaque" | "auto"moderation?string
内容审核级别
Value in
"low" | "auto"quality?string
图像质量
style?string
图像风格
user?string
用户标识
Response Body
application/json
curl -X POST "https://docs.newapi.ai/v1/images/generations" \ -H "Content-Type: application/json" \ -d '{ "prompt": "string" }'{
"created": 1713833628,
"data": [
{
"b64_json": "..."
}
],
"usage": {
"total_tokens": 100,
"input_tokens": 50,
"output_tokens": 50,
"input_tokens_details": {
"text_tokens": 10,
"image_tokens": 40
}
}
}How is this guide?
Last updated on