OpenRouter

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

    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).

  2. Add the endpoint and a profile to your config.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

    sc profiles openrouter

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

  4. Launch on it

    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). 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). 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).

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.

Next: Local models

View as Markdown