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.Environment Override (Recommended)
ONR automatically mapskeys.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 omitvalue and use a local Google service account JSON file:
credential_filepoints to a Google service account JSON file. Keep this file readable only by the ONR runtime user, for examplechmod 600 /etc/onr/gcp/vertex-sa.json.locationis exposed to DSL expressions as$channel.locationand defaults toglobalwhencredential_fileis set.base_url_overrideis optional, but should be set when you want a regional Vertex host such ashttps://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: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.Authorization: Bearer ak-onr-client-001
Environment Override (Recommended)
- Using a named key:
ONR_ACCESS_KEY_<NAME> - E.g.,
ONR_ACCESS_KEY_CLIENT_A=ak-onr-client-001