Skip to content

Flux-图片生成

概览

  • 请求方法:POST
  • 路径:/v1/images/generations
  • 内容类型:application/json
  • 说明:该请求格式与 OpenAI 的 DALL-E 模型请求格式一致。

支持的尺寸和比例

尺寸比例
1024x10241:1
512x10241:2
1024x5122:1
768x5123:2
512x7682:3
960x12803:4
1280x9604:3
720x12809:16
1280x72016:9
576x13449:21
1344x57621:9

认证方式

  • Authorization: Bearer sk-xxx(必选)

请求示例

Header示例必填
Content-Typeapplication/json
AuthorizationBearer sk-xxxx

请求体(JSON)

json
{
  "prompt": "一幅详细的图像描绘了一个广阔的石器时代城市,城市中高耸的摩天大楼由巨石和骨头构成。这里热闹非凡,各种性别和种族的人们共同展现出原始人和原始女性的统一外貌。他们身穿商务服装,与史前背景形成鲜明对比。化石化的塔楼点缀着石质天际线,而人们则保留着原始的设计,身上披着毛皮,搭配现代的西装和领带。形成了现代生活与史前时代的美丽融合。",
  "model": "flux-kontext-pro",
  "size": "3:4",
  "output_format": "png",
  "seed": 12345,
  "prompt_upsampling": true,
  "safety_tolerance": 6
}

参数说明

参数类型必填默认描述
promptstring-所需图像的文本描述,最大1000(或4000)字符
modelstring-模型名称;支持 fluxflux-devflux-proflux-pro-maxflux.1.1-proflux-kontext-maxflux-kontext-pro
sizestring1:1图片尺寸,支持 1:1,3:4,4:3,9:16,16:9,9:21,21:91024x1024 等数值格式(宽高32倍数)
output_formatstringpngjpegpng
seedinteger-随机种子
prompt_upsamplingbooleantrue是否启用提示词优化
safety_toleranceinteger6审核容忍度,0-6间,0最严格、6最宽松

返回示例(200)

json
{
  "created": 1725007743,
  "data": [
    {
      "revised_prompt": "A detailed image illustrating a sprawling Stone Age city with towering skyscrapers made from massive rocks and bones. The city is bustling with people of all genders and descents, such as Hispanic, Caucasian, South Asian, and Middle Eastern, unified in their appearance as primordial men and women. They are clad in business attire, contrasting significantly with the prehistoric backdrop. Fossilized towers adorn the stony skyline, while the people retain primitive designs, draped in pelts along with modern suits and ties, forming a beautiful blend of modern living with the prehistoric era.",
      "url": "https://oaidalleapiprodscus.blob.core.windows.net/private/org-ckj8cP1MmQK3ZdLPGoozEzD9/vv/img-l4C07hxN49jraolwGOXGc6Ce.png?st=2024-08-30T07%3A49%3A03Z&se=2024-08-30T09%3A49%3A03Z&sp=r&sv=2024-08-04&sr=b&rscd=inline&rsct=image/png&skoid=d505667d-d6c1-4a0a-bac7-5c84a87759f8&sktid=a48cca56-e6da-484e-a814-9c849652bcb3&skt=2024-08-29T19%3A17%3A38Z&ske=2024-08-30T19%3A17%3A38Z&sks=b&skv=2024-08-04&sig=UA38MfIU62lG5JtT2GCOqHEseAqnDceoA3iNwhfS4Xk%3D"
    }
  ]
}