This guide shows the smallest safe request through the Route Key OpenAI-compatible API gateway.
- A Route Key account and API key
- An enabled model ID from the Models catalog
- A client that supports OpenAI-compatible chat completions
The public base URL is:
https://api.routekey.ai/v1
export ROUTEKEY_API_KEY="your_routekey_api_key"
export ROUTEKEY_MODEL="MODEL_ID_FROM_CATALOG"
curl https://api.routekey.ai/v1/chat/completions \
-H "Authorization: Bearer ${ROUTEKEY_API_KEY}" \
-H "Content-Type: application/json" \
-d "{\"model\":\"${ROUTEKEY_MODEL}\",\"messages\":[{\"role\":\"user\",\"content\":\"Reply with one short sentence.\"}]}"Python and Node.js examples are available in examples/. The important configuration values are:
API key: ROUTEKEY_API_KEY
Base URL: https://api.routekey.ai/v1
Model: an enabled model ID from the catalog
Keep the key in an environment variable or a protected secret store. Do not add it to source control.
Check that:
- The HTTP response is successful.
- The response contains the expected assistant message.
- The returned model and Usage Logs match the intended model ID.
- Input tokens, output tokens, latency, cost, and retries are visible as expected.
Start with a short, reversible request. Test streaming, tool calls, structured output, and multimodal inputs separately if your application depends on them.
| Symptom | Checks |
|---|---|
401 or 403 |
Confirm the key, Bearer prefix, account access, and environment variable. |
| Model not found | Copy the exact enabled model ID from the live catalog. |
404 on the endpoint |
Check the base URL and make sure the client has not appended /v1 twice. |
| Streaming mismatch | Confirm the client parser and test a non-streaming response first. |
| Unexpected cost | Review model, group, endpoint, retries, and token counts in Usage Logs. |
For client-specific setup, use the integration guide. For request details, use the developer docs.