Files
image-workbench-desktop/docs/archive/notes/PROVIDER-IMAGE-REFERENCE-NOTES.md
T

42 lines
1.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
> **⚠️ 历史·过程留档(已归档,2026-10-16)**:本文为**当时**记录,**不代表现状**;现状以 `docs/standards/architecture-current-state.md` 为准,规则见 `docs/standards/`。
# 生图服务商参考图协议记录
## 兔子 API(api.tu-zi.com)
根据 Apifox 文档 `site-id=5467006` 的 OpenAPI 规范确认:
- 文生图和 URL 参考图都请求 `/v1/images/generations`
- URL 参考图不能强制走 `/v1/images/edits`
- 请求体字段使用 `image`
- 不使用 `image_url`
- 单张远程图片 URL 直接传字符串:
```json
{
"model": "gpt-image-1",
"prompt": "...",
"image": "https://example.com/reference.png",
"n": 1,
"size": "1024x1024"
}
```
- 多张远程图片可以传 URL 数组
- URL 不需要前端下载,也不应因 `imageTransfer.mode=base64` 转换为 Base64
- 本地图片以 `data:image/*;base64,...` 作为 `image` 输入,仍统一使用 `/images/generations` JSON 请求;不使用 `/images/edits` multipart
- URL 与本地 Base64 可以混合放在同一个 `image` 数组中
- 响应要求 `response_format: "url"`,客户端只接受 `data[].url`,拒绝 `b64_json`
- 生图请求不自动重试、不自动切换 fallback,避免非幂等请求重复计费
- 纯文生图不传 `image`,使用 `/images/generations`
## 排查结论
之前 URL 参考图失败的原因是错误地把所有参考图统一改成 `edits`,并发送了 `image_url`。兔子接口虽然兼容 OpenAI 风格,但其文档示例明确使用 `generations + image`。
对应修复提交:
```text
859643e match Rabbit image URL reference contract
```