JunFeiAI cf-global 图片生成与编辑
cf-global 提供 gpt-image-2 和 Grok Imagine 图片路由。OpenAI 图片工具与 Grok Images API 是两条不同链路,不应混用请求格式。
最后更新:2026-08-03
生产记录核对:2026-08-03(Asia/Shanghai)
OpenAI 官方图像 Token 价、1K / 2K / 4K 站内基础价、图片分组倍率和最终余额实扣见官方价格与实际扣费,生产价格配置核对于 2026-08-03。
1. 已验证范围
| 能力 | 模型 | 入口 | 结果 | 验证标识 |
|---|---|---|---|---|
| Responses 图片工具 | gpt-image-2 | cf-global | HTTP 200,Base64 解码为有效 PNG | b10315cb...8ebe |
| Images API 生成 | gpt-image-2 | cf-global | HTTP 200,b64_json 解码为有效 PNG | 27c78e47...d243 |
| Images API 编辑 | gpt-image-2 | cf-global | 标准入口近期持续出现 HTTP 200;历史输出也已解码为有效 PNG | 生产记录截至 2026-08-01 |
| Grok 高质量生成 | grok-imagine-image-quality | cf-global | 近期生产记录存在大量 HTTP 200;可用性仍随账号池变化 | 生产记录截至 2026-07-31 |
| Grok 快速生成 | grok-imagine-image | cf-global | 有历史成功记录,距离本次核对较久,调用前复验 | 最近成功 2026-07-07 |
| Grok 兼容别名 | grok-imagine | cf-global | 目录可见;网关归一到质量模型,需按 Key 复验 | 待复验 |
| Grok 图片编辑 | grok-imagine-edit | cf-global | 编辑路由已实现;近期编辑成功记录映射到质量模型,别名本身需复验 | 待复验 |
2. OpenAI Responses 图片工具
curl -N "https://cf-global.junfeiai.com/v1/responses" \
-H "Authorization: Bearer $JUNFEIAI_API_KEY" \
-H "Content-Type: application/json" \
-H "Accept: text/event-stream" \
-d '{
"model": "gpt-5.6-sol",
"input": [
{
"type": "message",
"role": "user",
"content": [
{ "type": "input_text", "text": "Create a centered green square on a clean white background, no text, no watermark." }
]
}
],
"stream": true,
"store": false,
"tool_choice": { "type": "image_generation" },
"reasoning": { "effort": "high", "summary": "auto" },
"tools": [
{
"type": "image_generation",
"model": "gpt-image-2",
"size": "1024x1024",
"quality": "medium",
"output_format": "png",
"partial_images": 1
}
]
}'最终图片位于完成响应的 image_generation_call.result,内容为 Base64。2026-07-12 的真实结果解码后为 PNG,大小 687376 字节。
3. gpt-image-2 图片生成
curl "https://cf-global.junfeiai.com/v1/images/generations" \
-H "Authorization: Bearer $JUNFEIAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-image-2",
"prompt": "A centered red circle on a clean white background, no text, no watermark.",
"size": "1024x1024",
"quality": "medium",
"response_format": "b64_json"
}'2026-07-12 的真实结果为 HTTP 200,b64_json 解码后为 PNG,大小 2201681 字节。
4. gpt-image-2 图片编辑
标准 cf-global 入口已支持 JSON 图片编辑,当前优先使用该入口:
curl "https://cf-global.junfeiai.com/v1/images/edits" \
-H "Authorization: Bearer $JUNFEIAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-image-2",
"prompt": "Place this logo centered on a clean white square canvas. Preserve the logo colors and add no text.",
"quality": "medium",
"images": [
{ "image_url": "https://cf-global.junfeiai.com/logo.png" }
]
}'images[].image_url 使用上游可访问的 HTTPS 图片地址。global.junfeiai.com 与 origin-global.junfeiai.com 只作为排障兼容入口,不应写进新的默认配置。大体积 Data URL 可能触发请求体限制,不作为本页推荐方案。
5. Grok 图片模型
| 模型 | 用途 | 路由行为 |
|---|---|---|
grok-imagine-image-quality | 高质量图片生成 | 推荐质量优先场景 |
grok-imagine-image | 快速图片生成 | 推荐延迟优先场景 |
grok-imagine | 兼容别名 | 网关归一到 grok-imagine-image-quality |
grok-imagine-edit | 图片编辑 | 使用 Images API 编辑端点 |
Grok 图片必须走 /v1/images/generations 或 /v1/images/edits。Grok Responses 路由不会执行 image_generation 工具。
Grok 图片可用性会随 OAuth 账号池变化。近期生产记录证明质量路由可以成功,但不能据此保证每个 API Key、别名和参数组合长期稳定;接入前仍需真实生成并下载媒体。
6. Grok 高质量图片生成
curl "https://cf-global.junfeiai.com/v1/images/generations" \
-H "Authorization: Bearer $JUNFEIAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "grok-imagine-image-quality",
"prompt": "A centered red circle on a clean white background, no text, no watermark."
}'快速生成只需把模型替换为 grok-imagine-image。Grok 图片路由会删除 size,不要依赖 size 控制最终尺寸,应以实际返回媒体为准。可用标准是 HTTP 200,且最终图片可以下载并通过文件签名与尺寸校验;只看到模型目录或任务被接受都不够。
7. Grok 图片编辑
curl "https://cf-global.junfeiai.com/v1/images/edits" \
-H "Authorization: Bearer $JUNFEIAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "grok-imagine-edit",
"prompt": "Place this logo centered on a clean white square canvas. Preserve the logo colors and add no text.",
"image": {
"image_url": "https://cf-global.junfeiai.com/logo.png"
}
}'本页只把 HTTPS 图片地址列为已验证输入方式;Data URL 和 multipart 必须单独实测成功后再加入稳定文档。
8. 响应与验收
不要只检查 HTTP 200:
b64_json或image_generation_call.result必须可以 Base64 解码。- 解码文件必须具有真实 PNG、JPEG 或 WebP 文件头。
- URL 响应必须继续下载并检查 HTTP 200、图片 Content-Type 和非零字节。
- 保存缩短后的请求标识用于排障,不保存带签名的媒体 URL。
9. 常见错误
| 现象 | 原因与处理 |
|---|---|
401 | API Key 缺失或无效 |
403 | 分组未开放图片生成权限 |
404 model_not_found | 当前分组看不到目标图片模型 |
400 images[].image_url is required | 编辑请求格式错误,或标准边缘入口改写了请求;按第 4 节切换已验证入口 |
503 Service temporarily unavailable | 当前图片账号不可调度或上游暂不可用 |
| HTTP 200 但媒体不可用 | 继续校验 Base64、下载状态、Content-Type 和文件头 |