Skip to main content

What it’s good for

Widest model selection available — access Claude, GPT-4, Llama, Mistral, and hundreds more through one API key. Good for trying different models without managing separate accounts, or for accessing models not directly supported by Spaceduck’s other providers.

Requirements

Configure in Spaceduck

Chat

1

Set your API key

In Settings > Chat, select OpenRouter as the provider, then enter your API key.Or via CLI:
spaceduck config secret set /ai/secrets/openrouterApiKey
2

Select a model

In Settings > Chat:
  • Provider: OpenRouter
  • Model: use the OpenRouter model ID, e.g.:
    • anthropic/claude-3.5-sonnet
    • meta-llama/llama-3.1-70b-instruct
    • mistralai/mistral-large-latest
Or via CLI:
spaceduck config set /ai/provider openrouter
spaceduck config set /ai/model "anthropic/claude-3.5-sonnet"
Browse available models and pricing at openrouter.ai/models.
3

Verify

Send a message in the chat. You should see a streaming response.

Embeddings

OpenRouter does not provide an embeddings API. If you want semantic recall, pair OpenRouter with a separate embedding provider: This is the two-server pattern — chat on OpenRouter, embeddings elsewhere.

Test and troubleshoot

ProblemCauseFix
401 UnauthorizedInvalid API keyCheck your key at openrouter.ai/keys
402 Payment RequiredInsufficient creditsAdd credits at openrouter.ai/credits
Model not foundWrong model ID formatUse the full org/model-name format from OpenRouter’s model list
429 Too Many RequestsRate limit hitWait and retry, or use a different model