VS Code extension
Select code or text in the editor: task, language, size, personal data, the recommended model and its cost - then ask, explain or rewrite in place through the router.
The OpenSmartRoute extension for Visual Studio Code puts the router inside the editor. Select code or text and the OpenSmartRoute panel tells you on the spot what it is - the task, the language, how many tokens the selection and its surroundings weigh, whether it contains personal data - and what the router would do with it: the recommended model, what the request costs, what the cheapest and the best model would cost instead, and what a month of such requests adds up to. Then Ask a question about the selection, Explain it, or Rewrite it in place, and the answer comes back through the router with the model that wrote it, its price and its time under it.
The analysis runs on your computer; nothing leaves it until you ask for a quote or an answer. Personal data - e-mail addresses, phone and card numbers, IBANs, national ids, IP addresses, API keys - is replaced by placeholders before a request is sent and put back in the answer, so the model never sees the values.
Works with the hosted platform at opensmartroute.ai and with a self-hosted
osr serve. Visual Studio Code 1.90 or later, on Windows, macOS and Linux.
Install
Download opensmartroute.vsix from the downloads page - it is published
there with each release; a deployment that has not published one yet says so on that page - and either drag it
onto the Extensions view or run:
code --install-extension opensmartroute.vsixThe compass icon appears in the activity bar and a status item on the right of the status bar. From the
repository: npm install && npm run package in platform/vscode builds the same file.
Sign in
Run OpenSmartRoute: Sign in from the command palette (or press the button in the panel). A code is shown and the browser opens the platform's device page; approve the code there while signed in to your workspace and the editor is connected. The token is kept in VS Code's secret storage (the operating system's keychain), never in a settings file. Sign out removes it.
For a self-hosted osr serve or a key you already have, run OpenSmartRoute: Use a token and paste it. Set
opensmartroute.platformUrl to the server's origin and opensmartroute.apiPrefix to an empty string for
osr serve (the platform keeps /api/v1).
Without a sign-in the panel still analyses the selection and asks for an anonymous quote (rate limited, with the public catalogue and prices); routing an answer needs a workspace.
The panel
Open it from the activity bar or with OpenSmartRoute: Show the routing panel. It follows the selection as you
make it (opensmartroute.analyzeOnSelection) and has four parts:
- Connection - the platform you talk to and who you are signed in as.
- Selection - the local analysis: the task the text asks for (summarisation, translation, rewriting, code, extraction, a question ...), the document language and, for prose, the language the text is written in, the complexity and how much reasoning it needs, the tokens in the selection and in the lines around it, the domains, whether the text tries to steer the model, and the personal data found - by type and count - with a note that it will be redacted.
- Quote - what the platform answers: the recommended model with the cost of this request and the input and
output tokens it was priced on; under it the cheapest model, the best model and the fastest one when they
differ, each with its cost, expected latency and quality estimate; and a projection for a month of such requests
(
opensmartroute.monthlyRequests, 1 000 by default). Turnopensmartroute.quoteOnSelectionoff to keep the analysis entirely local until you run a command; Quote again asks on demand. - Answer - the model that wrote the last answer, its cost and time, and two buttons, Good and Not good, which send the rating back so the router learns which model to prefer for that kind of request.
The status bar item shows the same in one line - code · 240 tok · PII → Qwen3 8B $0.0001 - and opens the panel.
Commands
| Command | Shortcut | What happens |
|---|---|---|
| Ask about the selection | Ctrl+Alt+O (⌘⌥O) | Asks for your question, routes it with the selection and its context, and opens the answer as a Markdown document beside the editor |
| Explain the selection | Same, with a fixed question: what the text does, how, and what is risky about it | |
| Rewrite the selection in place | Asks what to change (leave it empty for the default: fix and simplify code, fix spelling and grammar and clarity for prose) and replaces the selection with the model's answer. Undo is one keystroke away, and the notification offers Good / Not good / Undo | |
| Analyze selection | Ctrl+Alt+Shift+O (⌘⌥⇧O) | Runs the local analysis and asks for a quote now |
| Sign in / Use a token / Sign out | The connection to your workspace | |
| Show the routing panel | Focuses the panel | |
| Rate the last answer | Good or Not good for the last answer routed from this editor |
The three writing commands are also in the editor's right-click menu under OpenSmartRoute when text is selected. A request in flight can be cancelled from its progress notification.
What is sent
A request carries the selection, the lines around it (opensmartroute.contextLines above and below, 20 by
default, 0 for the selection alone), the file name and language and the line numbers, and your instruction - as
one prompt in the OpenAI-compatible /v1/chat/completions shape, with model: auto so the router chooses. The
answer streams back; the longest answer is opensmartroute.maxTokens (1 024). The whole request is shown to the
model as text; the extension never sends files it did not select, the workspace tree or other open editors.
With opensmartroute.redactPii on (the default) every personal item is replaced before the quote and before the
request, with the same placeholder for the same value everywhere in the prompt, and the answer's placeholders
are turned back into the values on your machine. The panel and the input box say how many items were redacted.
Settings
| Setting | Default | Meaning |
|---|---|---|
opensmartroute.platformUrl | https://opensmartroute.ai | The platform or osr serve origin |
opensmartroute.apiPrefix | /api/v1 | Where the REST routes live; empty for osr serve |
opensmartroute.redactPii | true | Redact personal data before sending, restore it in the answer |
opensmartroute.analyzeOnSelection | true | Analyse the selection as you make it |
opensmartroute.quoteOnSelection | true | Ask the platform for a quote while you select |
opensmartroute.monthlyRequests | 1000 | Requests a month for the cost projection |
opensmartroute.contextLines | 20 | Lines above and below the selection sent as context |
opensmartroute.maxTokens | 1024 | Longest answer written back |
Troubleshooting
- "sign in to continue" - the token was removed or expired; run Sign in again, or Use a token for
osr serve. - "the workspace is over its quota or rate limit" - the plan's monthly requests are used up or the anonymous quote limit was hit; the dashboard's Usage page shows the quota, signing in lifts the anonymous limit.
- The quote names a model the answer did not use - the quote is the router's pick before the request; at request time a busy or unhealthy target is skipped for the next best one, and the answer's line names the model that actually wrote it.
- The rewrite left a code fence - the extension strips a fence that wraps the whole answer; a model that mixes prose and code into a rewrite is best rated Not good so the router stops choosing it for rewrites.
- Nothing happens on the shortcut - the shortcut needs focus in a text editor with a selection; another
extension may hold
Ctrl+Alt+O(change it under Keyboard Shortcuts). - The OpenSmartRoute output channel (View › Output) logs every failed request with its message.
Desktop app
One shortcut over any app on Windows, macOS and Linux: the routed command bar reads your selection and pastes the answer back.
Word add-in
Select a passage in Word: task, language, size, personal data, the recommended model and its cost - then ask, explain, summarise, rewrite or proofread through the router.