#openclaw + openrouter how to

1 messages · Page 1 of 1 (latest)

ionic sphinx
#

How to use OpenClaw with OpenRouter through manual json config?

molten compassBOT
sacred mortarBOT
#

To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> ✅ Mark Solution

sturdy haloBOT
#

Yep, manual config is pretty simple, and the big gotcha is that OpenClaw config is JSON5, not strict JSON.

Put this in your config file, usually ~/.openclaw/openclaw.json:

{
  env: {
    OPENROUTER_API_KEY: "sk-or-...",
  },
  agents: {
    defaults: {
      model: {
        primary: "openrouter/auto",
        // or: "openrouter/<provider>/<model>"
      },
    },
#
  },
}

A couple notes:

  • Config path: openclaw config file
  • Validate it: openclaw config validate
  • Check auth/model resolution: openclaw models status

Important bit for OpenRouter refs:

  • use openrouter/auto, or
  • the full form openrouter/<provider>/<model>

You do not need to manually set the OpenRouter base URL for normal provider usage.

ionic sphinx
#

How to use free models and how to get OpenClaw to recognize them?

sturdy haloBOT
#

For OpenRouter free models, the main trick is: they usually use the :free suffix, and OpenClaw needs the full OpenRouter ref.

So in config, use:

{
  env: {
    OPENROUTER_API_KEY: "sk-or-...",
  },
  agents: {
    defaults: {
      model: {
        primary: "openrouter/<provider>/<model>:free",
      },
    },
  },
#
}

How to get OpenClaw to recognize them:

  1. Make sure OpenRouter auth is present

    • openclaw models status
  2. Scan OpenRouter’s free catalog

    • openclaw models scan
    • or metadata-only: openclaw models scan --no-probe
  3. Set one automatically

    • openclaw models scan --set-default --yes
  4. Or set one manually