OpenRouter
OpenRouter provides a single API key to access hundreds of models from Anthropic, Google, Meta, Mistral, and more — with automatic fallback and cost routing.
Get an API key
Sign up at openrouter.ai and create a key under Keys.
Setup
# 1. Store the key
pai add secret openrouter-key --from-literal api-key=sk-or-...
# 2. Create a model binding
pai apply -f - <<EOF
apiVersion: pai.io/v1
kind: ModelBinding
metadata:
name: llama-70b
spec:
provider: openrouter
model: meta-llama/llama-3.1-70b-instruct
maxTokensPerDay: 2000000
maxTokensPerRequest: 32000
apiKeySecretRef:
name: openrouter-key
key: api-key
EOF
Model identifier format
Use the full OpenRouter slug as the model value. You can browse all available models at openrouter.ai/models.
model: meta-llama/llama-3.1-70b-instruct
model: mistralai/mistral-large
model: google/gemma-2-27b-it
model: anthropic/claude-3-haiku # via OpenRouter
Use in an agent
spec:
modelBindings:
- llama-70b