Configure OpenRouter provider
Point an Omnia Provider at OpenRouter so an agent can use any model it hosts with one API key.
OpenRouter speaks the OpenAI wire format, so the Provider uses type: openai with spec.baseURL set to OpenRouter and spec.headers carrying its attribution headers.
Prerequisites
Section titled “Prerequisites”- An OpenRouter API key, created at openrouter.ai/keys.
- The Omnia operator installed in the cluster.
1. Create a secret for the API key
Section titled “1. Create a secret for the API key”The Secret must be in the same namespace as the Provider.
kubectl create secret generic openrouter-credentials \ --namespace agents \ --from-literal=OPENAI_API_KEY='sk-or-v1-...'OPENAI_API_KEY is the key the controller looks for by default on a type: openai Provider. To use another key name, set spec.credential.secretRef.key.
2. Create the provider
Section titled “2. Create the provider”apiVersion: omnia.altairalabs.ai/v1alpha1kind: Providermetadata: name: openrouter namespace: agentsspec: type: openai model: anthropic/claude-sonnet-4 # OpenRouter model ID baseURL: https://openrouter.ai/api/v1
headers: HTTP-Referer: https://your-app.example.com # attribution; replace with your app's URL X-Title: omnia # name shown in OpenRouter analytics
credential: secretRef: name: openrouter-credentials
capabilities: - text - streaming - tools - jsonThe model IDs here are illustrative. Take the exact ID from openrouter.ai/models; it has the form <vendor>/<model>.
Do not put Authorization or any other header the OpenAI provider sets itself in spec.headers. The request fails with custom header "Authorization" collides with built-in header set by provider.
3. Set pricing for non-OpenAI models
Section titled “3. Set pricing for non-OpenAI models”Cost tracking uses spec.pricing when set. Without it, PromptKit prices only models in its built-in OpenAI table, after stripping the vendor prefix: openai/gpt-4o is priced as gpt-4o, but anthropic/..., google/... and meta-llama/... models are unpriced. Set the rates from OpenRouter’s model page:
spec: pricing: inputCostPer1K: "0.003" # illustrative; use OpenRouter's current rates outputCostPer1K: "0.015"4. Use it from an AgentRuntime
Section titled “4. Use it from an AgentRuntime”apiVersion: omnia.altairalabs.ai/v1alpha1kind: AgentRuntimemetadata: name: my-agent namespace: agentsspec: promptPackRef: name: my-pack providers: - name: default providerRef: name: openrouter facades: - type: websocketVerify
Section titled “Verify”kubectl get provider openrouter -n agents \ -o jsonpath='{range .status.conditions[*]}{.type}={.status} {.reason}{"\n"}{end}'SecretFound and CredentialConfigured should be True. EndpointReachable should also be True: the controller probes baseURL without credentials, and any HTTP response, including a 401, counts as reachable. False means the connection itself failed (DNS, timeout or refused), and the Provider phase becomes Unavailable. CredentialValid reports a request to baseURL + /models (https://openrouter.ai/api/v1/models) sent with the key.
Troubleshooting
Section titled “Troubleshooting”401 Unauthorized on every request
Section titled “401 Unauthorized on every request”Check that the secret holds an OpenRouter key (sk-or-v1-...), not an OpenAI key. Check the first characters without printing the whole key:
kubectl get secret openrouter-credentials -n agents \ -o jsonpath='{.data.OPENAI_API_KEY}' | base64 -d | cut -c1-9Requests succeed but OpenRouter does not attribute the app
Section titled “Requests succeed but OpenRouter does not attribute the app”Check that HTTP-Referer and X-Title are set in spec.headers.
Related pages
Section titled “Related pages”- Provider reference for
baseURL,headers,pricingand the status conditions. - OpenRouter quickstart for OpenRouter’s own setup.