Skip to content
OpenSmartRoute
Documentation
Apps

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.

Apps 6 min read

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.vsix

The 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). Turn opensmartroute.quoteOnSelection off 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

CommandShortcutWhat happens
Ask about the selectionCtrl+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 selectionSame, with a fixed question: what the text does, how, and what is risky about it
Rewrite the selection in placeAsks 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 selectionCtrl+Alt+Shift+O (⌘⌥⇧O)Runs the local analysis and asks for a quote now
Sign in / Use a token / Sign outThe connection to your workspace
Show the routing panelFocuses the panel
Rate the last answerGood 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

SettingDefaultMeaning
opensmartroute.platformUrlhttps://opensmartroute.aiThe platform or osr serve origin
opensmartroute.apiPrefix/api/v1Where the REST routes live; empty for osr serve
opensmartroute.redactPiitrueRedact personal data before sending, restore it in the answer
opensmartroute.analyzeOnSelectiontrueAnalyse the selection as you make it
opensmartroute.quoteOnSelectiontrueAsk the platform for a quote while you select
opensmartroute.monthlyRequests1000Requests a month for the cost projection
opensmartroute.contextLines20Lines above and below the selection sent as context
opensmartroute.maxTokens1024Longest 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.