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:檢查模型服務狀態或稍後重試。