Skip to main content
The keys.yaml file is the central vault for Open Next Router. It manages both the pool of API keys you hold with upstream LLM providers, and the access tokens you issue to your clients.

Upstream Provider Keys

These are the credentials you use to authenticate with external services like OpenAI or Anthropic. ONR groups credentials by provider, allowing it to load-balance across multiple keys automatically within a single provider namespace.
To avoid committing sensitive keys to version control, providing an empty value allows environment variables to fulfill them. ONR automatically maps keys.yaml entries to environment variables.
  • Using a named key: ONR_UPSTREAM_KEY_<PROVIDER>_<NAME>
  • E.g., ONR_UPSTREAM_KEY_ANTHROPIC_HAIKU_CLUSTER=sk-ant-1234 onr run -c onr.yaml

Vertex AI Service Account Files

For Vertex AI, a provider key can omit value and use a local Google service account JSON file:
  • credential_file points to a Google service account JSON file. Keep this file readable only by the ONR runtime user, for example chmod 600 /etc/onr/gcp/vertex-sa.json.
  • location is exposed to DSL expressions as $channel.location and defaults to global when credential_file is set.
  • base_url_override is optional, but should be set when you want a regional Vertex host such as https://us-central1-aiplatform.googleapis.com.

Encrypted Upstream Keys

To store credentials directly in GitHub without exposing them, you can employ built-in AES-256-GCM encryption. You can encrypt an API key using the ONR Admin CLI:
This will produce a ciphertext like ENC[v1:aesgcm:<base64(nonce+ciphertext)>]. Simply paste this string into keys.yaml. At runtime, start the server with your symmetrical unlock key: ONR_MASTER_KEY=your-32-byte-secret onr run -c onr.yaml

Downstream Access Keys (Client ACL)

To control access to your ONR proxy, you issue Access Keys to your downstream clients.
A client provides this access token when calling ONR: Authorization: Bearer ak-onr-client-001
  • Using a named key: ONR_ACCESS_KEY_<NAME>
  • E.g., ONR_ACCESS_KEY_CLIENT_A=ak-onr-client-001