Want to see OpenRouter CLI in action? Watch our video overview!
OpenAI‑compatible CLI for OpenRouter. Ask questions, chat in a REPL, and fuzzy‑search models.
Note: This project is in MVP development. Beta releases are for testing, and stable releases are for general use. See Release Strategy for details.
You can change your model any time. In a terminal, run openrouter models to browse, or in the REPL type /model to search inline. Tip: search for free to see free models.
Monitor your current session costs |
Get Billing Information |
Monitor your current session costs |
Repl Chat Configurations |
npm i -g @letuscode/openrouter-clinpx @letuscode/openrouter-cli --helpnpm i -g @letuscode/openrouter-cli@betanpx @letuscode/openrouter-cli@beta --helpTip: Running openrouter with no args starts the setup wizard and then opens the REPL (in a terminal).
openrouter (or openrouter init) — enter your key if asked, then pick a modelopenrouter ask "Hello!" — formatted answer by defaultopenrouter repl — formatted replies; toggle streaming when you likeopenrouter (or openrouter init) — setup; uses the OpenRouter domain automatically; asks for a key only if missing; lets you pick a model; opens the REPL afterwardsopenrouter ask "…" — answer a single question (formatted by default)openrouter repl — interactive chat
/model → inline search; type a few letters, pick a match/model <id> → set a specific model/format md|plain → formatted or plain replies (non‑stream)/stream on|off → stream tokens or wait for a full replyexit → quitopenrouter models [query] — browse models (fuzzy search) in a terminal; prints a table in non‑TTYopenrouter config --list — show current settings (keys are masked)openrouter config --api-key sk-… — set your key once (or use the env var below)--stream to stream tokens./model search.export OPENROUTER_API_KEY=… (or OPENAI_API_KEY)~/.config/openrouter-cli/config.json (private; keys never logged).openrouterrc (JSON or YAML) in your project root
.openrouterrc (JSON):
{
“domain”: “https://openrouter.ai/api/v1”,
“model”: “openrouter/auto”
}openrouter againopenrouter models opens an interactive search in a terminal (type 2–3 letters)openrouter models llama starts with “llama” suggestions; prints a table in non‑TTY(openai/gpt-oss-20b:free) > /model
Search models (>=2 chars, blank to cancel): free
Matches:
1. openai/gpt-oss-120b:free — OpenAI: gpt-oss-120b (free)
2. openai/gpt-oss-20b:free — OpenAI: gpt-oss-20b (free)
…
Pick 1-10 or type a model id:
NO_COLOR and TTY detection.OPENROUTER_API_KEY or run openrouter again. View current config: openrouter config --list.openrouter models).node -p "process.stdout.isTTY && process.stdin.isTTY".~/.config/openrouter-cli/cli.log.--stream, --format auto|plain|md, -s, --system <text>, --profile <name>, --no-init--non-interactive--danger-reset, --override-json '<json>'