Package Exports
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@letuscode/openrouter-cli) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
openrouter-cli
OpenAI‑compatible CLI for OpenRouter. Ask questions, run a REPL, and manage per‑project or global settings.
Requirements
- Node.js 18.17+ (ESM)
Install
- Global:
npm i -g @letuscode/openrouter-cli - One‑off:
npx @letuscode/openrouter-cli --help
Quick start
- Run the wizard:
openrouter init(select provider, set domain/model, and add an API key) - Ask something:
openrouter ask --no-stream "Hello!" - Chat interactively:
openrouter repl
Core commands
openrouter init— interactive setup (provider, domain, key, model, profile)openrouter config— view config or set API key- Examples:
openrouter config --listopenrouter config --api-key sk-...(stores in base config)openrouter config --profile dev --api-key sk-...(stores in profile)
- Examples:
openrouter test— verify connectivity (/models)openrouter test [--profile dev] [--no-init]
openrouter ask— one‑shot promptopenrouter ask "your question" [-s SYSTEM] [--format auto|plain|md] [--profile NAME] [--no-stream] [--no-init]
openrouter repl— interactive chat- REPL commands:
exit,/model <name>,/system <text>,/format md|plain,/stream on|off
- REPL commands:
Configuration
- API key via env (recommended):
export OPENROUTER_API_KEY=...(orOPENAI_API_KEY) - Global config file:
~/.config/openrouter-cli/config.json(chmod 600 where possible; keys never logged) - Project overrides: add
.openrouterrc(JSON or YAML) in your project root- Example
.openrouterrc(JSON): { "domain": "http://localhost:11434/v1", "model": "gemma2:9b-instruct" }
- Example
- Changing default provider, domain, or model: re‑run
openrouter init(this is the only way to update these defaults). - More details: see
docs/CONFIGURATION.md.
Troubleshooting
- “Missing API key”: set
OPENROUTER_API_KEYor runopenrouter init(oropenrouter config --api-key sk-...). - Non‑TTY/CI: pass
--no-initto skip interactive prompts.
License
- MIT