Prerequisites
- A Inferoute API key (find it in the dashboard)
- One of: Python with the
openailibrary, Node.js with theopenaipackage, orcurl
Send your first request
1
Install the client library
Install the OpenAI SDK for your language. Inferoute is fully compatible with it — you only need to set the
base_url.2
Configure the client
Point the client at Inferoute’s base URL and supply your API key.
3
Send a chat completion
Make a request using any model available through Inferoute. The
model field accepts provider-prefixed names like openai/gpt-4o.4
Read the response
A successful request returns a JSON object that mirrors the OpenAI chat completion format.
response
Response fields explained
Troubleshooting
401 Unauthorized
Your API key is missing, malformed, or revoked.- Confirm the key starts with
th-and has no trailing whitespace. - Check the API Keys page to ensure the key is active.
- Verify you are setting the
Authorization: Bearer <key>header, notX-API-Key.
429 Too Many Requests
You have exceeded your rate limit or monthly usage cap.- Review your current limits on the Usage page.
- Implement exponential backoff and retry logic in your application.
- Contact support to request a limit increase if needed.
500 Provider Error
The upstream LLM provider returned an error or was unavailable.- Inferoute automatically retries with a backup provider when one is configured. See Fallback Routing to set this up.
- If the error persists, check the Inferoute status page for active provider incidents.
- The response body includes a
providerfield indicating which provider failed, which can help with debugging.