跳转到正文

图像 API

使用所选已发布图像模型支持的准确尺寸和质量生成一张图像。

POST /v1/images/generations

Authorization
Bearer $CHUA_API_KEY
Content-Type
application/json for request bodies
Idempotency-Key
1–160 characters from A-Z a-z 0-9 . _ : -; required for generation requests.
X-CHUA-Request-ID
Save this response header as the request receipt when returned.
{"model":"YOUR_IMAGE_MODEL","prompt":"A blue ceramic cup on white","n":1}

请求字段

model
必填的已发布图像模型。
prompt
必填,去除首尾空格后 1–800 字符。
n
只能为 1,默认 1。
size
1024x1024, 2048x2048, 或 auto; 必须匹配模型规格。
quality
low 或 standard; 必须匹配模型规格。

响应

成功响应在 data[0].b64_json 返回一张 Base64 图像,并包含尺寸和已确认用量。请保存 X-CHUA-Request-ID。