Polymodel API · v1
快速开始
Polymodel 提供 OpenAI 兼容的多模型聚合 API。把 OpenAI SDK 的 base_url 指向下面这个地址、用 sk-cm- 开头的 Key 鉴权,就可以调用 ChatGPT、Claude、DeepSeek、ChatGPT Image 2、 Gemini Nano Banana 2、Doubao Seedance 等模型。
Base URL: https://polymodel.io/api/v1
1. 第一个请求
在 API 控制台 创建一个 Key(创建时仅显示一次, 请立即保存),然后:
curl https://polymodel.io/api/v1/chat/completions \
-H "Authorization: Bearer sk-cm-..." \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek-v4-flash",
"messages": [{"role": "user", "content": "用一句话介绍你自己。"}]
}'用 OpenAI 官方 SDK 也一样,只改两行:
from openai import OpenAI
client = OpenAI(api_key="sk-cm-...", base_url="https://polymodel.io/api/v1")
resp = client.chat.completions.create(
model="deepseek-v4-flash",
messages=[{"role": "user", "content": "..."}],
)2. 常用任务
流式响应
加 "stream": true 即得到 OpenAI 兼容的 SSE 流。 想拿最终 token 统计加 stream_options: { include_usage: true }。
curl -N https://polymodel.io/api/v1/chat/completions \
-H "Authorization: Bearer sk-cm-..." \
-H "Content-Type: application/json" \
-d '{"model":"deepseek-v4-flash","messages":[{"role":"user","content":"..."}],"stream":true}'图片生成
/images/generations 兼容 OpenAI 图片接口。可用模型:gpt-image-2、gemini-nano-banana-2。高吞吐调用请传"async": true,再用返回的 id 轮询/images/tasks/:id。
curl https://polymodel.io/api/v1/images/generations \
-H "Authorization: Bearer sk-cm-..." \
-H "Content-Type: application/json" \
-d '{"model":"gpt-image-2","prompt":"一只柴犬戴墨镜","size":"16:9","resolution":"1K","async":true}'curl https://polymodel.io/api/v1/images/tasks/image_task_id \
-H "Authorization: Bearer sk-cm-..."视频生成
/videos/generations 提交异步 Seedance 任务;用返回的id 轮询 /videos/tasks/:id。可用模型:seedance-2-0、seedance-2-0-fast、grok-imagine-1.5-video-apimart。
curl https://polymodel.io/api/v1/videos/generations \
-H "Authorization: Bearer sk-cm-..." \
-H "Content-Type: application/json" \
-d '{"model":"seedance-2-0-fast","prompt":"霓虹灯下的未来城市航拍","aspect_ratio":"16:9","resolution":"720p","duration":5}'curl https://polymodel.io/api/v1/videos/tasks/video_task_id \
-H "Authorization: Bearer sk-cm-..."列出可用模型
curl https://polymodel.io/api/v1/models -H "Authorization: Bearer sk-cm-..."仅返回当前 Key 可调用的 text / image / video 模型。Claude Opus 4.7 保留为网页 Max 权益。完整价格对照请看 模型广场。
3. 参考
- Header:
Authorization: Bearer sk-cm-... - API 调用只扣充值积分(订阅月度积分仅网页会话用)
- 账户最多保留 3 个 Key;撤销后立即失效,无法恢复
- Key 创建后只显示一次,请立即保存到环境变量
| 限制项 | Pro | Max |
|---|---|---|
| 通用 API | 30 RPM | 300 RPM |
| 图片异步提交 | 200 RPM | 300 RPM |
| 图片任务轮询 | 1000 RPM | 1500 RPM |
| 请求体大小 | 512 KB | |
| 单次消息数 / 字符 | 200 / 64,000 | |
| 并发视频任务 | 2 | |
| 同时持有 Key 数 | 3 | |
429 响应附 X-RateLimit-Remaining / X-RateLimit-Reset,按指数退避重试即可。
| HTTP | code | 含义 |
|---|---|---|
| 401 | invalid_api_key | Key 不存在或已撤销 |
| 403 | api_key_paused | Key 被暂停 |
| 403 | api_key_expired | Key 已过期 |
| 403 | api_key_model_not_allowed | Key 未授权该模型 |
| 402 | api_key_credit_limit_exceeded | Key 单独额度用完 |
| 402 | insufficient_credits | 账户余额不足 |
| 403 | content_filter | 内容被审核拦截 |
| 400 | unsupported_video_resolution | 该视频模型不支持请求的分辨率 |
| 413 | request_too_large | 请求体超过 512 KB |
| 429 | rate_limit_exceeded | 超过 RPM |
| 502 | upstream_error | 上游模型错误 |