cURL 接入
cURL 是验证 RouteAPI 是否可用的最小工具。建议所有集成先用 cURL 跑通,再接入 SDK。
Chat Completions
Section titled “Chat Completions”curl https://www.routeapi.ai/v1/chat/completions \ -H "Authorization: Bearer $ROUTEAPI_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-4o", "messages": [ { "role": "user", "content": "Hello RouteAPI" } ] }'curl https://www.routeapi.ai/v1/chat/completions \ -H "Authorization: Bearer $ROUTEAPI_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-4o", "stream": true, "messages": [ { "role": "user", "content": "请分三点介绍 RouteAPI" } ] }'- 返回 401:检查 Token。
- 返回 402:检查余额。
- 返回 429:降低请求频率。
- 返回 502/503:检查模型服务状态或稍后重试。