Skip to main content
Inferoute provides a unified OpenAI-compatible endpoint that routes your requests across LLM providers automatically. This guide walks you through sending your first chat completion request, reading the response, and handling common errors.

Prerequisites

  • A Inferoute API key (find it in the dashboard)
  • One of: Python with the openai library, Node.js with the openai package, or curl

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

Every response from Inferoute includes an X-Inferoute-Provider response header that tells you which underlying provider handled the request (for example, openai or anthropic). You can log this header to track provider distribution across your application.

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, not X-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 provider field indicating which provider failed, which can help with debugging.