对接百度智能云图像生成服务,按张计费,不支持流式 SSE。

支持的模型

非流式生成

curl -X POST https://51kik.com/v1/image/v1/generations \
  -H 'Authorization: Bearer sk-xxxxxxxx' \
  -H 'Content-Type: application/json' \
  -d '{
    "model": "stable-diffusion-xl",
    "prompt": "futuristic city at sunset, cinematic lighting",
    "size": "1024x1024",
    "upstream_options": { "n": 2, "negative_prompt": "blurry, low quality", "steps": 30, "guidance": 7.5, "seed": 42 }
  }'

千帆只按张计费,usage 仅含 images 字段。

流式限制

千帆不支持 SSE 流式输出,传 stream: true 会返回错误:

curl -N -X POST ... -d '{ "model": "stable-diffusion-xl", "stream": true, "prompt": "..." }'
# → data: {"error":{"message":"Qianfan image generation does not support streaming","type":"upstream_error"}}

常用 upstream_options

参数说明
n生成张数
negative_prompt负向提示词
steps推理步数
guidance引导系数
seed随机种子
watermark水印开关

相关

百炼