OR-CLI for VS CodeAI coding assistant powered by OpenRouter — access 400+ models (GPT-4o, Claude, Gemini, Mistral, DeepSeek and more) directly in VS Code. The CLI and VS Code extension are released together and share the same version. Current version: Built by Swatto. FeaturesBuilt-in chat (
|
| Command | Description |
|---|---|
/fix |
Fix the selected code or describe what to fix |
/explain |
Explain the selected code or file |
/tests |
Generate tests for the selected code or active file |
/docs |
Generate documentation for the selected code or active file |
/agent |
Run an autonomous agent task using tools to complete multi-step work |
/recommend |
Get a model recommendation for your task |
/balance |
Show your OpenRouter account balance and usage |
/clear |
Clear the current chat context |
Chat panel (sidebar)
A persistent sidebar chat with full streaming markdown rendering, syntax-highlighted code blocks, and collapsible tool-call cards so you can see exactly what the AI is doing.
Workspace-aware tools
The AI can read and act on your workspace without copy-pasting:
| Tool | What it does |
|---|---|
vscode_get_active_file |
Reads the file currently open in the editor |
vscode_get_selection |
Reads highlighted text and its line range |
vscode_get_diagnostics |
Reads errors/warnings from the Problems panel |
vscode_get_workspace_info |
Workspace roots, git branch, active language |
vscode_search_workspace |
File and text search across the workspace |
vscode_apply_edit |
Applies multi-file changes with a diff preview |
vscode_open_file |
Opens a file at a specific line |
vscode_run_task |
Executes a defined VS Code task |
Standard tools are also available: read_file, write_file (with diff preview + undo-safe WorkspaceEdit), execute_shell_command, git_diff, git_commit, web_search, and more.
Diff preview for file writes
When the AI writes a file you see a native VS Code diff editor — Apply or Discard before anything touches disk. All applies go through WorkspaceEdit so they participate in the undo stack.
"Fix with OR-CLI" quick fix
Errors and warnings in the Problems panel get an OR-CLI quick-fix action. Click it to open a pre-populated chat with the diagnostic, file context, and surrounding code already loaded.
"Ask AI" code lens
Opt-in Ask AI actions above every function, method, and class definition. Enable with orcli.codeLens.enable.
Right-click menu
- Ask About This File — sends the full file content to chat
- Ask About Selection — sends highlighted code to chat
Session management
Sessions are saved automatically after each turn and listed in the Sessions sidebar. Rename, delete, or reload any previous conversation.
Manual model IDs
Use OR-CLI: Change Model to browse the live OpenRouter model list or type an exact model ID manually. The sidebar also accepts /model <model-id>, and the settings panel includes a manual model field for models that are not in the browser list yet.
MCP server support
If you have an ~/.openrouter/mcp-config.json, configured MCP servers connect automatically and their tools are available to the AI alongside the built-in tools.
Getting started
- Install the extension
- Open the OR-CLI panel from the activity bar (robot icon)
- Run OR-CLI: Set API Key from the command palette and paste your OpenRouter API key
- Start chatting
Configuration
Core
| Setting | Default | Description |
|---|---|---|
orcli.model |
openrouter/pareto-code |
Default model |
orcli.temperature |
0.7 |
Sampling temperature (0–2) |
orcli.maxToolRounds |
10 |
Max tool-call rounds per message |
orcli.showToolOutput |
true |
Show tool output in the OR-CLI output channel |
orcli.codeLens.enable |
false |
Show "Ask AI" above functions and classes |
orcli.yoloMode |
false |
Auto-approve all permission prompts (shell commands, file writes, etc.) |
Model routing
| Setting | Default | Description |
|---|---|---|
orcli.reasoningEffort |
none |
Reasoning budget for extended-thinking models: none · minimal · low · medium · high · xhigh |
orcli.preferFree |
false |
Append :free to the model ID for free-tier routing |
orcli.preferNitro |
false |
Append :nitro to the model ID for speed-priority routing |
orcli.optimizeMode |
none |
OpenRouter optimisation: none · speed · cost · quality |
orcli.fallbackModels |
[] |
Fallback model IDs tried in order if the primary model fails |
orcli.autoMode.plannerModel |
deepseek/deepseek-v4-pro |
Thinking/planning model used by auto mode |
orcli.autoMode.implementorModel |
qwen/qwen3-coder |
Implementation/coding model used by auto mode |
Pareto Router
| Setting | Default | Description |
|---|---|---|
orcli.pareto.enabled |
true |
Enable intelligent coding-task routing via Pareto Router |
orcli.pareto.minCodingScore |
0.8 |
Only consider models with a coding score above this threshold (0–1) |
orcli.pareto.variant |
default |
default for balanced routing, nitro for speed-optimised routing |
Provider routing
| Setting | Default | Description |
|---|---|---|
orcli.provider.order |
[] |
Preferred provider order, e.g. ["Anthropic", "OpenAI"] |
orcli.provider.only |
[] |
Restrict requests to only these providers |
orcli.provider.ignore |
[] |
Never use these providers |
orcli.provider.sort |
none |
Sort providers by price · throughput · latency |
orcli.provider.allowFallbacks |
true |
Allow fallback when the preferred provider is unavailable |
orcli.provider.requireParameters |
false |
Only route to providers that support all requested parameters |
orcli.provider.dataCollection |
none |
deny excludes providers that collect data for model training |
orcli.provider.zdr |
false |
Require Zero Data Retention endpoints |
orcli.provider.maxLatency |
0 |
Max acceptable latency (seconds) for routing; 0 = no limit |
Server tools & advanced routing
OpenRouter server tools run server-side — no client setup required. Toggle them from chat (see slash commands below) or configure them here.
| Setting | Default | Description |
|---|---|---|
orcli.advisor.enabled |
false |
Let the model consult a stronger Advisor model mid-generation |
orcli.advisor.model |
"" |
Advisor model (empty = executor picks). Ignored when profiles are set |
orcli.advisor.instructions |
"" |
Extra steering for the Advisor. Ignored when profiles are set |
orcli.advisorProfiles |
[] |
Named advisor roster ({ name, model, instructions }); the model picks by name. Names must be unique |
orcli.fusion.enabled |
false |
Run a Fusion panel of models in parallel and synthesize a verdict |
orcli.fusion.analysisModels |
[] |
Fusion analysis panel (model slugs); empty = provider default |
orcli.fusion.judgeModel |
"" |
Fusion judge model; empty = outer request model |
orcli.imageGen.enabled |
false |
Generate images mid-generation; results appear inline in chat |
orcli.imageGen.model |
openai/gpt-image-1 |
Image generation model |
orcli.imageGen.quality |
auto |
auto · low · medium · high |
orcli.imageGen.size |
"" |
Image size, e.g. 1024x1024 (empty = provider default) |
orcli.imageGen.format |
auto |
auto · png · jpeg · webp |
orcli.plugins |
[] |
Extra request plugins forwarded verbatim, e.g. { "id": "response-healing" }; use { "id": "web", "enabled": false } to suppress an account default |
orcli.contextCompression.transforms |
false |
Enable OpenRouter middle-out message transforms (transforms: ["middle-out"]) |
orcli.routerMetadata |
auto |
Request experimental router metadata for /routing: auto · on · off |
Caching & context
| Setting | Default | Description |
|---|---|---|
orcli.promptCaching |
true |
Cache repeated system prompts / conversation prefixes to cut input-token cost |
orcli.responseCaching |
true |
Use OpenRouter edge response caching for identical requests (free on cache hits) |
orcli.providerPinning |
true |
Pin a session to one provider so cache hits land on the same cluster |
orcli.contextCompression.enabled |
false |
AI-summarize older history with a free model when the context fills up |
orcli.contextCompression.model |
google/gemma-4-31b-it:free |
Model used for context compression |
orcli.contextCompression.preserveLastN |
6 |
Recent messages kept verbatim during compression |
orcli.contextCompression.autoCompactThreshold |
90 |
Context-usage % that triggers auto-compaction (0 = disabled) |
orcli.systemPrompt |
"" |
Custom system prompt for the chat participant (empty = built-in default) |
Chat slash commands
Type these in the chat input. Most server-tool toggles persist to the matching setting above, so a quick /fusion on is the same as ticking the box in Settings.
| Command | Description |
|---|---|
/advisor [on\|off] |
Show status or toggle Advisor routing (configure model/instructions/profiles in Settings) |
/fusion [on\|off] |
Show status or toggle the Fusion multi-model panel |
/image-gen [on\|off] |
Show status or toggle image generation |
/context-compression [on\|off] |
Show status or toggle middle-out message transforms |
/routing |
Show router metadata (model, provider, pipeline) from the last response — experimental |
/generation [gen-id] |
Show the generation record (model, provider, tokens, cost, latency) for the last response or a gen-* id |
/routing and /generation reflect the most recent turn across normal chat, agent, and auto modes. Cache hits never include router metadata.
Workflow commands
The sidebar chat understands the same workflow commands as the CLI:
| Command | Description |
|---|---|
/research <topic> |
Fetches top GitHub repos (by stars) and web results, then summarizes with tools |
/pr-review [number\|url] |
Reviews a GitHub PR via gh (auto-detects the current branch's PR) |
/commit |
Stages (if needed), drafts a conventional commit message, confirm/edit, then commits |
/test |
Detects and runs the project test suite; offers an AI fix on failure |
/check |
Runs build → lint → test in order; offers an AI fix on the first failure |
/explain <target> |
Explains a file/symbol/topic using read-only tools (or the selection if no target) |
/cost-history |
Cross-session spend: total, by model, and the most expensive sessions |
/tag <tag> · /tag remove <tag> · /tag clear |
Tag the current session (shown in the Sessions view) |
/pr-review and /commit require the gh / git CLIs on your PATH. /test and /check run in the workspace root and, on failure, offer to hand the output to the AI to fix (file edits still go through the diff preview).
Commands
| Command | Description |
|---|---|
OR-CLI: Set API Key |
Store your OpenRouter API key securely |
OR-CLI: Change Model |
Pick from the live model list with pricing or type an exact model ID |
OR-CLI: New Session |
Start a fresh conversation |
OR-CLI: Ask About This File |
Send the active file to chat |
OR-CLI: Ask About Selection |
Send selected code to chat |
OR-CLI: Fix with AI |
Fix the diagnostic under the cursor |
OR-CLI: Load Session |
Load a saved session into the chat panel |
OR-CLI: Delete Session |
Permanently delete a saved session |
OR-CLI: Rename Session |
Rename the current session |
OR-CLI: Export Session to Markdown |
Export the current session as a Markdown file |
OR-CLI: Show Balance |
Show your live OpenRouter account balance |
OR-CLI: Compare Models on Last Prompt |
Re-run the last prompt on a second model for comparison |
OR-CLI: Set Reasoning Effort |
Set the reasoning effort level for extended-thinking models |
OR-CLI: Toggle Prefer Free Models |
Toggle free-tier routing for the current model |
OR-CLI: Set Optimize Mode |
Set the OpenRouter optimisation mode |
OR-CLI: Open Settings |
Open the OR-CLI settings panel |
OR-CLI: Toggle Yolo Mode (Auto-approve All Permissions) |
Toggle auto-approval of all permission prompts |
OR-CLI: Edit with AI (Inline) |
Edit the selected code in place via an AI diff preview |
OR-CLI: Generate Tests for Selection |
Generate unit tests for the selection or active file |
OR-CLI: Generate Docs for Selection |
Generate docstrings/JSDoc for the selection or active file |
OR-CLI: Search Sessions |
Fuzzy-search across all saved sessions |
OR-CLI: Toggle Agent Mode |
Toggle autonomous agent mode in the chat panel |
Keybindings
| Shortcut | Command |
|---|---|
Ctrl+Alt+N |
New Session |
Ctrl+Alt+A |
Ask About Selection (when text is selected) |
Ctrl+Alt+F |
Ask About This File |
Ctrl+Alt+I |
Edit with AI (Inline) |
Ctrl+Alt+T |
Generate Tests for Selection |
Ctrl+Alt+D |
Generate Docs for Selection |
Ctrl+Alt+S |
Search Sessions |
Build VSIX
npm install
npm run typecheck
npm run build
npm run package
The package command creates orcli-vscode-1.0.64.vsix.
Publish to Marketplace
Publishing is automated by .github/workflows/publish-vscode-extension.yml.
- Create a Marketplace Personal Access Token for the
Swattopublisher with Marketplace manage permission. - Add it to GitHub repository secrets as
VSCE_PAT. - Push a release tag such as
v1.0.29, or run the Publish VS Code Extension workflow manually from GitHub Actions.
The workflow runs typecheck, build, packages the VSIX, then publishes that VSIX to the Visual Studio Marketplace.
MCP server configuration
Create ~/.openrouter/mcp-config.json:
{
"mcpServers": {
"my-server": {
"command": "npx",
"args": ["-y", "@my-org/mcp-server"]
},
"remote-server": {
"url": "https://my-server.example.com/sse"
}
}
}
MCP tools appear automatically in the next chat session.
Links
- OpenRouter — model provider
- OR-CLI GitHub — source and issue tracker
- OpenRouter API keys
Built by Swatto