# OpenRouter

> Reach many vendors' models with one OpenRouter API key, by declaring an openrouter endpoint and writing slugs that keep the vendor prefix.
>
> Run a profile on any model OpenRouter serves, with one API key. You need an OpenRouter account with credits.

OpenRouter serves models from many vendors behind one OpenAI-compatible API, billed against your OpenRouter credits. `sc` reaches it as an `openai-compat` endpoint with your key.

1. Export your key

   ```sh
   export OPENROUTER_API_KEY="<your-openrouter-key>"
   ```

   Export it before the daemon starts. A key exported later needs `sc daemon stop` and a new launch ([why](/docs/gateways#keys-from-the-environment)).

2. Add the endpoint and a profile to your `config.toml`

   ```toml
   [endpoints.openrouter]
   url = "https://openrouter.ai/api"
   format = "openai-compat"
   key_csv = "${OPENROUTER_API_KEY}"

   [profiles.openrouter]
   opus = { slug = "openrouter/deepseek/deepseek-v4.1-flash", reasoning = { effort = "high" } }
   ```

   The slug is `openrouter/<vendor>/<model>`. OpenRouter model ids contain a `/`, and `sc` splits a slug at its first `/` only, so `<vendor>/<model>` goes upstream.

3. Check the routing

   ```sh
   sc profiles openrouter
   ```

   This prints each role of the profile with its model, effort and sampling.

4. Launch on it

   ```sh
   sc -u openrouter <project> <agent>
   ```

   Claude Code starts with its requests going to OpenRouter.

This profile maps only `opus`, so it is a full gateway on one model ([what changes](/docs/models#how-roles-map-to-models)). Gemini models work through OpenRouter even though `sc` has no adapter for Google's own API.

**Which reasoning fields a model gets**

The gateway picks the reasoning field from the model id, not the endpoint, so `deepseek/deepseek-v4.1-flash` gets the same DeepSeek fields here as on OpenCode ([the table](/docs/custom-profiles#write-your-own-profile)). Reasoning that OpenRouter streams in its `reasoning` field shows in Claude Code as a thinking block.

**My Anthropic model on OpenRouter routes to the wrong role**

A model id that contains `opus`, `sonnet`, `haiku`, `fable` or `mythos`, such as an Anthropic model on OpenRouter, misroutes when it sits on another tier's row of a full-gateway profile ([the warning](/docs/custom-profiles#write-your-own-profile)).

**My key is wrong and the launch did not catch it**

OpenRouter's model list is public, so the launch check cannot reject a wrong key. A bad key surfaces on the first request.
