API keys

API keys

API keys authenticate model requests and attribute usage to your LivRouter account. Create a separate key for each application and environment so you can identify usage and replace credentials independently.

Create and configure a key

  1. Sign in and open API keys.
  2. Create a key with a descriptive name, such as production-chat or local-codex.
  3. Review the available group, model, quota, expiration, and access controls before saving. Options depend on your account.
  4. Copy the key and store it in your server environment or secret manager.
bash
export OPENAI_API_KEY="your-livrouter-api-key"
powershell
$env:OPENAI_API_KEY = "your-livrouter-api-key"

These commands apply to the current terminal session. Restart the application from that terminal so it inherits the variable. For production, configure the variable in your hosting platform's secret settings.

Test the key

cURL
curl -sS https://api.livrouter.com/v1/models \  -H "Authorization: Bearer $OPENAI_API_KEY"

An HTTP 200 response confirms that the key can reach model discovery. Next, send a short request with a supported model using Quickstart. Model discovery alone does not verify every protocol or a funded generation request.

Groups and access

Your selected key group can affect model access, routing, and applicable rates. If a model is visible in the public catalog but fails with your key, check the key's group and model restrictions. Review usage logs after switching a group to confirm the request and charge.

Rotate and revoke

  1. Create a replacement key with the required settings.
  2. Update the application secret and restart or redeploy the application.
  3. Verify a new request in usage logs.
  4. Disable or delete the old key after all callers have migrated.
Keep credentials private. Do not place keys in browser bundles, screenshots, shared configuration files, or Git. If a key is exposed, revoke it immediately and replace it. Redact secrets before contacting support.

See Errors & troubleshooting for authentication failures and Billing & credits for funding and quota questions.