Skip to content

cURL Integration

cURL is the smallest tool for verifying whether RouteAPI is available. Run cURL first for every integration, then connect an SDK.

Terminal window
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" }
]
}'
Terminal window
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": "Introduce RouteAPI in three points" }
]
}'
  • 401: check the Token.
  • 402: check the balance.
  • 429: reduce request frequency.
  • 502/503: check model service status or retry later.