正在自动登录…
fujc683/ gpt-image-2-6-openai-compatible
提供OpenAI兼容的单一接口,以统一密钥访问GPT Image 2.6及其他图像生成模型,并支持模型切换和故障回退的网关服务。适用于使用OpenAI方式生成图像、希望简化多模型管理的开发者。
AI 中文解读 · 根据仓库描述与 README 生成 · 2026/11/6 14:17:01 · 查看原文
- 累计 Stars
- 67
- 当前热度
- 1 天内 · 小火
- 仓库创建时间
选用指南
AI 根据 README 整理 · 2026/11/6 14:17:01
- 适用场景
适合需要统一接口调用多个图像模型(如GPT Image 2.6)的开发者,可切换模型并自动处理限流回退。
查看 README 依据
[💰 Pricing](https://gola.apimart.ai/k-KPXOMF) · [🔑 Get an API key](https://gola.apimart.ai/k-JAFpQq) --- ## Why a gateway Calling a single model directly means one key per vendor, one failure mode per vendor, and one bill per vendor. A gateway puts them behind one endpoint. | | Direct calls | Through APIMart gateway | |---|---|---| | Keys | one per vendor | **one key** | | Model switch | rewrite code | **change `model` string** | | Failure handling | per-vendor | **unified retry + fallback** | | Billing | scattered | **one balance, one invoice** | | Rate limits | per vendor | pooled |
"cheap": "z-image-turbo", "fallback": "seedream-5-0-flash", } def generate(prompt, tier="default"): try: return call(MODELS[tier], prompt) except RateLimited: return call(MODELS["fallback"], prompt) ``` ## What to watch - **Async by default** — poll `task_id`, do not block on the HTTP call - **Final cost is in `data.cost`**, not the estimate shown at submit time - **Same key across models** — no need to rotate when switching vendors --- ## Related - Prompt library: [gpt-image-2-6-prompts](https://github.com/fujc683/awesome-gpt-image-2-6-prompts)
- 使用方式
通过OpenAI兼容的API以编程方式使用,需设置base_url和api_key,并调用images.generate接口。
查看 README 依据
## OpenAI-compatible endpoint ```python from openai import OpenAI client = OpenAI(base_url="https://api.apimart.ai/v1", api_key="YOUR_KEY") img = client.images.generate( model="gpt-image-2.6-flare", prompt="editorial studio portrait, hard key light, grey backdrop", n=1, ) print(img.data[0].url) ``` The request shape is identical to OpenAI's `images.generate`, so existing code keeps working — only `base_url` and `model` change. ## Multi-model routing ```python MODELS = { "default": "gpt-image-2.6-flare", "quality": "gpt-image-2.6-sunburst",
- 部署要求
需要一个API密钥(来自APIMart)以及可访问该服务的环境。
查看 README 依据
[💰 Pricing](https://gola.apimart.ai/k-KPXOMF) · [🔑 Get an API key](https://gola.apimart.ai/k-JAFpQq) --- ## Why a gateway Calling a single model directly means one key per vendor, one failure mode per vendor, and one bill per vendor. A gateway puts them behind one endpoint. | | Direct calls | Through APIMart gateway | |---|---|---| | Keys | one per vendor | **one key** | | Model switch | rewrite code | **change `model` string** | | Failure handling | per-vendor | **unified retry + fallback** | | Billing | scattered | **one balance, one invoice** | | Rate limits | per vendor | pooled |
## OpenAI-compatible endpoint ```python from openai import OpenAI client = OpenAI(base_url="https://api.apimart.ai/v1", api_key="YOUR_KEY") img = client.images.generate( model="gpt-image-2.6-flare", prompt="editorial studio portrait, hard key light, grey backdrop", n=1, ) print(img.data[0].url) ``` The request shape is identical to OpenAI's `images.generate`, so existing code keeps working — only `base_url` and `model` change. ## Multi-model routing ```python MODELS = { "default": "gpt-image-2.6-flare", "quality": "gpt-image-2.6-sunburst",
- 已知限制
API调用是异步的,需轮询任务ID,且最终费用以data.cost为准。
查看 README 依据
"cheap": "z-image-turbo", "fallback": "seedream-5-0-flash", } def generate(prompt, tier="default"): try: return call(MODELS[tier], prompt) except RateLimited: return call(MODELS["fallback"], prompt) ``` ## What to watch - **Async by default** — poll `task_id`, do not block on the HTTP call - **Final cost is in `data.cost`**, not the estimate shown at submit time - **Same key across models** — no need to rotate when switching vendors --- ## Related - Prompt library: [gpt-image-2-6-prompts](https://github.com/fujc683/awesome-gpt-image-2-6-prompts)
README
正在加载 README…
收录信息
- 仓库创建时间
- 2026/11/5 18:54:46
- 首次达标收录
- 2026/11/6 14:12:12
- 统计更新时间
- 2026/11/6 14:46:10
按创建时长与累计 Stars 判断等级。首次达标收录后,即使未达当前门槛仍保留;累计 Stars 和仓库状态会定期更新。确认只有 README 及辅助文件的仓库会停止公开。
仓库信息
- 最近推送
- 2026/11/5 18:54:53
- 许可证标识
- NOASSERTION
- Fork 数
- 0
- 当前状态
- 未归档
收录记录
按创建时长与累计 Stars 首次收录:小火
首次发现项目