Connect apps and coding agents

Use one Route Key API key and compatible gateway for applications, SDKs, and coding tools.

Step 01

Connect your AI application

Three values are enough to send your first compatible request.

  • Base URLhttps://api.routekey.ai/v1
  • AuthorizationBearer YOUR_ROUTEKEY_API_KEY
  • ModelChoose an exact enabled ID from Models.
First working request
curl https://api.routekey.ai/v1/chat/completions \
  -H "Authorization: Bearer YOUR_ROUTEKEY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"<route-key-model>","messages":[{"role":"user","content":"Hello"}]}'
Step 02

Configure a coding agent

Use a dedicated key per tool, then copy the matching setup profile.

Install CodexOfficial docs
npm install -g @openai/codex
~/.codex/config.toml
model = "<route-key-coding-model>"
model_provider = "routekey"

[model_providers.routekey]
name = "Route Key"
base_url = "https://api.routekey.ai/v1"
env_key = "ROUTEKEY_API_KEY"
  • Create a dedicated Route Key API key.
  • Choose an enabled model from Models.
  • Restart the tool and verify it in Usage Logs.
Operational checklist

Keep every integration maintainable

OpenAI compatibility reduces migration work, but a reliable integration still needs clear ownership and observability. Give each tool its own key, pin a tested model ID, and keep the base URL in configuration so you can change routing policy without editing business logic. When a provider changes, compare alternatives on the Models page before changing a production default. Models.

Prepare a safe, repeatable API connection

Create and protect your API key

Create a key from Dashboard, give it a clear name, and use one key per application or coding tool. Store it in an environment variable or secret manager. Never commit a key to a repository, client-side bundle, issue, or shared screenshot. Rotate a key if it appears in logs or leaves the intended team boundary.

Understand the three request values

The base URL selects the Route Key gateway, the Bearer token authenticates the request, and the model ID selects an enabled model. Use the exact model ID shown on the Models page; display names are not always valid API identifiers. Models.

Confirm access before a full rollout

Check that your account has balance or quota, the selected model is enabled for your group, and the endpoint supports your request type. A short non-streaming request is the fastest way to isolate authentication and model-selection issues.

Confirm the first response and inspect Usage Logs
  1. Send a short request. Use a small prompt and a low output limit, then check for a normal response object or streamed delta.
  2. Record the model and endpoint. Keep the exact model ID and endpoint that returned a response so the same configuration can be reproduced.
  3. Open Usage Logs. Confirm the request, token counts, latency, and cost are visible. This is the authoritative place to validate what the gateway billed.
  4. Expand gradually. Add streaming, tools, larger context, or production concurrency one variable at a time.

401 or 403 authentication errors

Check the Authorization: Bearer prefix, remove extra whitespace, verify the key is active, and confirm the request is reaching the /v1 base URL.

Model not found or unavailable

Copy the enabled model ID from Models, confirm its group and endpoint, and avoid assuming that a provider display name is an API ID.

Quota, balance, or rate errors

Review wallet balance, account limits, and Usage Logs. Reduce concurrency or output length for the test, then retry after the account state is updated.

Can I use an existing OpenAI SDK?

Usually yes. Keep the SDK request format, set its base URL to the Route Key /v1 endpoint, and pass a Route Key API key. Validate endpoint-specific features with a small request first.

Should one key be shared by multiple tools?

No. A dedicated key per application or coding agent makes Usage Logs easier to read and lets you rotate or revoke one integration without interrupting the others.

Where do I investigate a cost difference?

Compare the model, group ratio, input and output tokens, endpoint, and timestamp in Usage Logs. Then use the pricing catalog to compare another supported route.