The Modern Developer's Review Assistant
CodeSage AI is a code review assistant that lives directly inside your editor. It analyzes your code on the fly and streams actionable feedback back into a panel, inline squiggles and quick fixes.
Whether you need a security audit, performance tuning or a quick bug check, CodeSage gives you a senior reviewer on every file — on whichever model you point it at, and on as many of them as you care to line up.
Features at a Glance
Native Inline Diagnostics
Bugs and vulnerabilities are highlighted with native squiggly underlines right where you type. Never switch contexts to see your issues.
|
One-Click Quick Fixes
Hover over any issue and apply AI-generated code corrections instantly via VS Code's native Quick Fix lightbulb menu.
|
Model Rotation
Rank as many models as you like. When one hits its rate limit CodeSage moves to the next and keeps going, so a spent quota slows you down instead of stopping you.
|
Any OpenAI-Compatible Provider
OpenRouter, OpenAI, a local Ollama, or a self-hosted OmniRoute gateway. Mix them in one pool — a local model can be the fallback that keeps working when the hosted ones run dry.
|
Specialized Profiles
Use the status bar to switch between General, Security Audit, Performance, and Clean Code modes to tailor the AI's focus.
|
Function-Level Granularity
CodeLens "Review" buttons appear above every class and method. Audit specific logic in total isolation with a single click.
|
Multi-Language Support
Works out of the box with Python, JavaScript, TypeScript, C++, Java, Go, Rust, PHP, and any language with VS Code symbol support.
Installation & Setup
- Install the extension from the VS Code Marketplace.
- Click the CodeSage icon in the activity bar. A setup prompt also opens it on first launch.
- Under Connection, pick a provider, paste your API key and click Test.
- OpenRouter (default): free account at openrouter.ai/keys. The default model
openrouter/free costs nothing.
- OmniRoute or Custom: set the endpoint, e.g.
http://localhost:20128/v1.
- Ollama: no key needed.
- Under Model, click Load list, pick a model and click Use. Tick Free only to hide paid models.
- Hit Current file, Selection or Uncommitted git changes.
Keys are stored in VS Code's encrypted SecretStorage and never written to settings files.
No Python, no local runtime, and no extra packages — the extension talks to the provider directly. A gateway on localhost or a private address needs no API key at all.
Raising the ceiling
One key on one model runs out. Two things raise that ceiling, and they multiply. Both can be done from the panel (Add under API keys, Add as fallback under Model) or by hand:
- More keys. Run
CodeSage: Manage API Keys and add another key for the same provider. Each one carries its own quota.
- More models. Rank models in
codesage-ai.routes. Tier 1 is tried first; higher tiers are the fallbacks used only when everything better is throttled.
"codesage-ai.routes": [
{ "model": "anthropic/claude-sonnet-4", "provider": "openrouter", "tier": 1 },
{ "model": "deepseek/deepseek-r1", "provider": "openrouter", "tier": 2 },
{ "model": "qwen2.5-coder:14b", "provider": "ollama", "tier": 3 }
]
Three routes with two OpenRouter keys is five independently rate-limited slots. When a review lands on a fallback the panel says so, so you always know which model wrote the review you are reading. CodeSage: Show Rotation Pool lists every slot, its state, and when a paused one comes back.
Usage Guide
| Action |
How to do it |
| Review Entire File |
Click Current file in the CodeSage panel, the review icon in the editor title bar, or right-click a file in the explorer. Ctrl+Shift+R works too. |
| Review Selection |
Highlight code, then click Selection in the panel, right-click CodeSage: Review Code, or press Ctrl+Shift+R. |
| Review Git Changes |
Click Uncommitted git changes in the panel or the review icon in the Source Control title bar. |
| Reopen a Past Review |
Click it under History in the panel. No model call is made. |
| Review Single Function |
Click the inline Review button above any function definition. |
| Apply Quick Fix |
Hover over a squiggly line and click the lightbulb icon to apply the AI's fix. |
| Switch Profile |
Click the CodeSage item in your bottom status bar. |
| Pick a Model |
Model → Load list in the panel, or CodeSage: Select Model. |
| Add or Remove Keys |
API keys in the panel, or CodeSage: Manage API Keys. |
| Inspect the Pool |
Rotation pool in the panel shows every route live, with recovery timers. CodeSage: Show Rotation Pool prints the same. |
Configuration Settings
You can customize CodeSage AI in your VS Code settings (settings.json):
| Setting |
Default |
Description |
codesage-ai.provider |
openrouter |
Provider preset: openrouter, openai, ollama, omniroute or custom. |
codesage-ai.baseUrl |
"" |
API base URL. Empty uses the preset default; required for omniroute and custom. |
codesage-ai.model |
openrouter/free |
Model identifier. Used as the only route when routes is empty. |
codesage-ai.routes |
[] |
Ranked pool of models to rotate through. Replaces model when non-empty. |
codesage-ai.maxTokens |
4096 |
Maximum response length from the AI (up to 131072). |
codesage-ai.temperature |
0.3 |
Response creativity (0 to 2). Lower is more focused. |
codesage-ai.requestTimeoutMs |
120000 |
Abort after this much silence. While streaming the clock restarts on every chunk. 0 waits forever. |
codesage-ai.maxAttempts |
6 |
How many pool slots one review may try before giving up. |
codesage-ai.maxQueueWaitMs |
15000 |
Wait this long for a throttled route to recover before failing. 0 never waits. |
codesage-ai.reviewProfile |
general |
Default review focus profile. |
codesage-ai.enableCodeLens |
true |
Toggle the inline 'Review' buttons above functions. |
codesage-ai.enableStreaming |
true |
Stream results in real-time to the webview panel. |
Architecture
CodeSage AI is pure TypeScript and calls any OpenAI-compatible provider directly, streaming the response as it arrives. A review is not one request to one model: it is a walk over a pool of them.
commands / CodeLens / status bar
|
| ReviewRequest
v
+---------------------------------+
| ReviewService | review() and reviewStream()
| attempt loop, timeouts, aborts | are unchanged from the caller's side
+----------------+----------------+
|
acquire() | release(outcome)
v
+---------------------------------+
| RotationPool | ordered (route x key) slots
+--------+---------------+--------+
| |
v v
+----------------+ +------------------------+
| RouteTable | | QuotaLedger |
| tier-ranked | | live / in-flight / |
| destinations | | cooling / exhausted |
+----------------+ | persisted in |
| globalState |
+------------------------+
|
v
POST {baseUrl}/chat/completions
GET {baseUrl}/models
OpenRouter / OpenAI / Ollama / OmniRoute / any gateway
How a slot recovers. Every failure is classified once, at the edge, and the
provider's own Retry-After or X-RateLimit-Reset header decides how long the
pause lasts:
| What happened |
What the pool does |
429 with a short reset |
Pauses that slot until the reset, tries the next one |
429 with a long reset, or 402 |
Marks the window spent; that slot sits out the hour |
401 / 403 |
Parks that key on every route that shares it |
404 |
Parks that route on every key |
400 about context length |
Skips that route for this request only — its quota is untouched |
5xx, timeout, network error |
Short pause, immediate retry elsewhere |
Pauses are persisted, so a daily quota discovered on Monday evening is still
known about after a window reload. CodeSage: Show Rotation Pool prints the
whole table and can clear it.
Contributing
We welcome contributions!
- Fork the repository
- Create a feature branch:
git checkout -b feature/my-feature
- Commit your changes:
git commit -m "Add my feature"
- Push to the branch:
git push origin feature/my-feature
- Open a Pull Request
License
This project is licensed under the Apache 2.0 License.