本平台与 OpenAI 图像接口完全兼容:把Documentation Index
Fetch the complete documentation index at: https://docs.kapon.cloud/llms.txt
Use this file to discover all available pages before exploring further.
base_url 指向平台域名、API Key 换成平台 token,原本跑 OpenAI 的代码无需改动即可运行。
快速开始
文生图 /v1/images/generations
已验证稳定的请求参数:
| 参数 | 取值 |
|---|---|
size | 1024x1024 / 1024x1536 / 1536x1024 / auto |
quality | low / medium / high / auto |
background | transparent / opaque / auto |
output_format | png / jpeg |
output_compression | 0–100(仅对 jpeg 生效) |
moderation / n / user | 同 OpenAI 官方 |
output_format=webp、stream=true、partial_images 为官方字段,但平台尚未完成验证,使用前请自行实测。返回格式:URL 还是 base64
平台默认返回b64_json。如果你希望直接拿到图片 URL,加上 response_format=url:
- 优先按
response_format=url透传请求; - 若该参数被拒绝,自动回退为默认请求重试一次;
- 得到
b64_json后,若平台已配置对象存储,自动转存为 URL 写入data[0].url; - 若未配置对象存储且无法直接得到 URL,返回明确错误(如
image_url_not_available),不会把b64_json当作 URL 静默降级。
改图 /v1/images/edits
推荐使用 JSON 请求体,通过 images[].image_url 指定底图:
新项目建议优先使用 JSON 形态;已有 multipart 客户端可保持不变。
计费
gpt-image-2 按输入 / 输出 token 结算:
- text input:
$5.00 / 1M tokens - cached text input:
$1.25 / 1M tokens - image input:
$8.00 / 1M tokens - image output:
$30.00 / 1M tokens
| size | low | medium | high |
|---|---|---|---|
1024x1024 | $0.006 | $0.053 | $0.211 |
1024x1536 / 1536x1024 | $0.005 | $0.041 | $0.165 |
