# OpenRouter

> Run Claude Code, Codex CLI or OpenCode agents in nsq on any OpenRouter model — the key stays in your keyring.

Source: https://docs.neurosquad.ai/en/cli/openrouter

[OpenRouter](https://openrouter.ai) gives one key for models from many providers. nsq can run Claude
Code, Codex CLI and OpenCode agents through it, without touching their own settings.

## Set the key once

```sh
nsq openrouter set-key          # paste the key (sk-or-…) when asked
nsq openrouter status           # is a key available?
```

The key goes into your OS keyring — Windows Credential Manager, macOS Keychain, the Secret Service
on Linux. Where there is no keyring, set `OPENROUTER_API_KEY` in the environment instead.
`nsq openrouter clear-key` removes it.

## Run an agent on OpenRouter

```sh
nsq run claude --provider openrouter --model anthropic/claude-sonnet-4.5
```

Find a model id with `nsq openrouter models [query]` (with prices per million tokens), or press
`m` in the dashboard to pick one from the catalogue. The start dialog (`c`) has
the same choices.

To change an existing agent: `nsq set <agent> --provider openrouter --model <id>` (or
`--provider none` to go back to the CLI's own login). A new model or provider applies from the
agent's next start.

## What happens to the key

- It is only ever put into the agent's environment — never into the command line, logs or files.
- Without a key, nothing changes: the agent runs on the CLI's own login.
- Each request carries NeuroSquad's OpenRouter app attribution — headers naming the app and its
site, so OpenRouter can tell the requests come from NeuroSquad. Nothing else is added.
