🌊 PotatoRouter · AI中转平台
PotatoRouter AI Gateway
PotatoRouter AI Gateway
快速接入
PotatoRouter平台提供与 OpenAI 完全兼容 的 API,汇聚全球主流大模型。您只需一个 API Key 即可调用多种模型,无需管理底层渠道。所有接口使用相同认证方式,支持流式响应。
🔹 Base URL: https://api.potatorouter.com🔹 认证: Authorization: Bearer <API_KEY>🔹 响应: JSON / SSE (流式)
首次使用请前往 控制台 注册并获取 API Key。
Quick Start
PotatoRouter provides OpenAI‑compatible APIs that aggregate top-tier LLMs. One API key gives you access to multiple models. All endpoints share the same authentication and support streaming.
🔹 Base URL: https://api.potatorouter.com🔹 Auth: Bearer token🔹 Response: JSON / SSE
First time? Visit Console to get your API key.
🤖 对话补全 · Chat Completions
POST/v1/chat/completions流式 & 非流式
📝 创建对话补全,支持多模态与推理模型。
📝 Creates a chat completion, supports streaming and reasoning models.
请求参数
| 参数 | 类型 | 描述 |
|---|---|---|
| model | string | 模型ID,如 gpt-4o, claude-3.5-sonnet, deepseek-chat |
| messages | array | 对话消息列表,含 role/content |
| stream | bool | 是否流式输出,默认 false |
Parameters
| Parameter | Type | Description |
|---|---|---|
| model | string | Model ID, e.g., gpt-4o, claude-3.5-sonnet |
| messages | array | List of messages with role/content |
| stream | bool | Enable streaming, default false |
curl -X POST https://api.potatorouter.com/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o",
"messages": [{"role": "user", "content": "PotatoRouter平台有什么优势?"}]
}'📡 流式响应示例 / Streaming Response
data: {"id":"chatcmpl-xxx","object":"chat.completion.chunk","choices":[{"delta":{"content":"PotatoRouter"},"index":0}]}
data: {"id":"chatcmpl-xxx","object":"chat.completion.chunk","choices":[{"delta":{"content":"平台"},"index":0}]}
data: [DONE]🎨 图像生成 · Image Generation
POST/v1/images/generationsDALL·E 兼容
🖼️ 根据文本提示生成图像。
🖼️ Generates images from text prompts.
curl -X POST https://api.potatorouter.com/v1/images/generations \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"prompt": "一只水獭在溪流中嬉戏", "n": 1, "size": "1024x1024"}'🎤 语音转录 · Audio Transcription
POST/v1/audio/transcriptionsWhisper 兼容
📢 将音频文件转录为文本。
📢 Transcribes audio to text.
🔊 语音合成 · Text to Speech
POST/v1/audio/speechTTS 兼容
🗣️ 将文本合成为自然语音。
🗣️ Synthesizes speech from text.
📋 模型列表 · Models List
GET/v1/models查询可用模型
🔍 获取当前账户可用的所有模型列表。
🔍 Returns available models for your account.
curl -X GET https://api.potatorouter.com/v1/models -H "Authorization: Bearer YOUR_API_KEY"👤 个人账户管理 · Account Management
GET/api/user/self账户信息
获取当前账户基本信息(用户名、邮箱、角色等)。
Get current account info (username, email, role).
curl -X GET https://api.potatorouter.com/api/user/self -H "Authorization: Bearer YOUR_API_KEY"GET/api/user/self/quota余额查询
💰 查询账户剩余配额(积分/余额)。
💰 Get remaining quota (credits/balance).
// 响应示例
{
"quota": 12500,
"used": 7500,
"total": 20000
}GET / POST / DELETE/api/token令牌管理
GET /api/token — 查看我的所有 API 令牌
POST /api/token — 创建新令牌(参数:name)
DELETE /api/token/:id — 撤销指定令牌
POST /api/token — 创建新令牌(参数:name)
DELETE /api/token/:id — 撤销指定令牌
GET /api/token — List my API tokens
POST /api/token — Create a new token (parameter: name)
DELETE /api/token/:id — Revoke a token
POST /api/token — Create a new token (parameter: name)
DELETE /api/token/:id — Revoke a token
# 创建令牌
curl -X POST https://api.potatorouter.com/api/token \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name": "我的应用"}'GET/api/usage用量统计
📊 查询用量明细,支持时间范围、模型筛选。
参数:
参数:
start_date, end_date, model (可选)📊 Query usage details, supports date range and model filter.
Query params:
Query params:
start_date, end_date, model (optional)curl -X GET "https://api.potatorouter.com/api/usage?start_date=2026-03-01&end_date=2026-03-31" \
-H "Authorization: Bearer YOUR_API_KEY"⚠️ 错误码参考
| HTTP | 错误码 | 说明 |
|---|---|---|
| 401 | invalid_api_key | 无效或缺失 API Key |
| 403 | insufficient_quota | 配额不足,请充值 |
| 404 | model_not_found | 模型不存在或未授权 |
| 429 | rate_limit_exceeded | 请求频率超限 |
| Status | Error Code | Description |
|---|---|---|
| 401 | invalid_api_key | Missing/invalid API key |
| 403 | insufficient_quota | Insufficient quota, please top up |
| 404 | model_not_found | Model not found or unauthorized |
| 429 | rate_limit_exceeded | Too many requests |