#How to use Openrouter in CLI

1 messages ยท Page 1 of 1 (latest)

potent hamlet
#

How to use Openrouter in CLI
Iโ€™m using WSL2 and win11

cosmic spearBOT
# potent hamlet How to use Openrouter in CLI Iโ€™m using WSL2 and win11

Here's how to use OpenRouter with Clawdbot in WSL2:

1. Get your OpenRouter API key

Sign up at https://openrouter.ai/ and copy your API key (starts with sk-or-...)

2. Set up authentication (run in WSL)

# Option A: Interactive onboarding
clawdbot onboard --auth-choice apiKey --token-provider openrouter --token "sk-or-your-key-here"

# Option B: Add to your config (see below)

3. Add to your Clawdbot config

In your ~/.clawdbot/config.json5:

#
{
  env: { OPENROUTER_API_KEY: "sk-or-your-key-here" },
  agents: {
    defaults: {
      model: { primary: "openrouter/anthropic/claude-sonnet-4-5" }
    }
  }
}

4. Restart Clawdbot

clawdbot gateway restart

Model format

#

OpenRouter models use the format openrouter/<provider>/<model>, e.g.:

  • openrouter/anthropic/claude-sonnet-4-5
  • openrouter/meta-llama/llama-3.3-70b-instruct:free
  • openrouter/google/gemini-2.0-flash-vision:free

Find available models

clawdbot models scan --no-probe  # Lists OpenRouter's free models

Full docs: https://docs.clawd.bot/providers/openrouter ๐Ÿฆ

potent hamlet
#

Embedded agent failed before reply: Unknown model: openrouter/auto

cosmic spearBOT
# potent hamlet Embedded agent failed before reply: Unknown model: openrouter/auto

openrouter/auto isn't a real model โ€” it's an OpenRouter API feature, not a model identifier. You need to specify an actual model.

Pick a real OpenRouter model:

| Model                   | Reference                                         |
| ----------------------- | ------------------------------------------------- |
| Claude Sonnet 4         | `openrouter/anthropic/claude-sonnet-4-5`            |
| DeepSeek R1 (free)      | `openrouter/deepseek/deepseek-r1:free`              |
| Llama 3.3 (free)        | `openrouter/meta-llama/llama-3.3-70b-instruct:free` |
| Gemini 2.0 Flash (free) | `openrouter/google/gemini-2.0-flash-vision:free`    |

Quick fix:

# Set a default model
#
clawdbot model --set-primary openrouter/anthropic/claude-sonnet-4-5

# Or update your config:
# In ~/.clawdbot/config.json5, change the model to a real ID

List available free models:

clawdbot models scan --no-probe

Choose one of those actual model IDs and you'll be good to go! ๐Ÿฆ

potent hamlet
#

sabiasagi@localhost:~$ clawdbot model --set-primary openrouter/google/gemini-2.0-flash-vision:free
error: unknown command 'model'
(Did you mean models?)
sabiasagi@localhost:~$ clawdbot models --set-primary openrouter/google/gemini-2.0-flash-vision:free
error: unknown option '--set-primary'

I can't do that...