正在自动登录…
fujc683/ gpt-image-2-6-sdk-python
提供调用 GPT Image 2.6 图像生成模型的 Python 示例代码,涵盖单次生成、轮询任务和批量重试,帮助开发者快速接入 OpenAI 兼容的 API。
AI 中文解读 · 根据仓库描述与 README 生成 · 2026/11/6 14:17:03 · 查看原文
- 累计 Stars
- 69
- 当前热度
- 1 天内 · 小火
- 仓库创建时间
选用指南
AI 根据 README 整理 · 2026/11/6 14:17:03
- 目标用户
面向需要集成 GPT Image 2.6 图像生成能力的开发者。
查看 README 依据
<a href="https://gola.apimart.ai/k-QUaoXJ"><img src="banner.jpg" alt="GPT Image 2.6" width="100%" /></a> # GPT Image 2.6 Python SDK — generate and poll images > Working Python snippets for GPT Image 2.6: single calls, polling, batch with retry. [](https://github.com/sindresorhus/awesome) [](LICENSE) **[👉 Try GPT Image 2.6 on APIMart](https://gola.apimart.ai/k-QUaoXJ)** `https://gola.apimart.ai/k-QUaoXJ`
- 使用方式
通过 Python 代码使用 OpenAI 库调用该模型,可执行单次生成、轮询任务和批量重试。
查看 README 依据
[💰 Pricing](https://gola.apimart.ai/k-D43RCj) · [🔑 Get an API key](https://gola.apimart.ai/k-d7vzrf) --- ## Install ```bash pip install openai ``` No APIMart-specific SDK is required — the endpoint is OpenAI-compatible. ## Generate one image ```python import os from openai import OpenAI client = OpenAI(base_url="https://api.apimart.ai/v1", api_key=os.environ["APIMART_API_KEY"]) r = client.images.generate(model="gpt-image-2.6-flare", prompt="minimal product shot of a ceramic mug on oak", n=1) print(r.data[0].url)
``` ## Poll an async task ```python import time, requests def wait(task_id, key, timeout=300): url = f"https://api.apimart.ai/v1/tasks/{task_id}" for _ in range(timeout // 5): d = requests.get(url, headers={"Authorization": f"Bearer {key}"}).json()["data"] if d["status"] in ("completed", "succeeded"): return d["result"]["images"][0]["url"], d.get("cost") if d["status"] in ("failed", "error"): raise RuntimeError(d.get("error")) time.sleep(5) raise TimeoutError(task_id) ``` ## Batch with retry ```python
- 部署要求
需要 Python 环境、安装 openai 库,并拥有 APIMart 的 API 密钥。
查看 README 依据
[💰 Pricing](https://gola.apimart.ai/k-D43RCj) · [🔑 Get an API key](https://gola.apimart.ai/k-d7vzrf) --- ## Install ```bash pip install openai ``` No APIMart-specific SDK is required — the endpoint is OpenAI-compatible. ## Generate one image ```python import os from openai import OpenAI client = OpenAI(base_url="https://api.apimart.ai/v1", api_key=os.environ["APIMART_API_KEY"]) r = client.images.generate(model="gpt-image-2.6-flare", prompt="minimal product shot of a ceramic mug on oak", n=1) print(r.data[0].url)
README
正在加载 README…
收录信息
- 仓库创建时间
- 2026/11/5 17:11:01
- 首次达标收录
- 2026/11/6 14:12:12
- 统计更新时间
- 2026/11/6 14:46:10
按创建时长与累计 Stars 判断等级。首次达标收录后,即使未达当前门槛仍保留;累计 Stars 和仓库状态会定期更新。确认只有 README 及辅助文件的仓库会停止公开。
模型评估
普通加权总分 3.5 / 5
由 Jev 模型根据仓库描述与 README 评估,2026/11/6 14:12:12 生成。评分仅供参考,不是代码、安全或许可证审查;热度等级另按创建时长与累计 Stars 计算。
仓库信息
- 最近推送
- 2026/11/5 17:11:08
- 许可证标识
- NOASSERTION
- Fork 数
- 0
- 当前状态
- 未归档
收录记录
按创建时长与累计 Stars 首次收录:小火
首次发现项目