Roo Code is an intelligent VS Code extension that assists with full-project analysis, code generation, and complex refactoring.Because Roo Code reads your local filesystem and runs terminal commands, it frequently consumes massive amounts of input tokens. By routing Roo Code through LLM Router, you automatically apply Middle-Out Context Compression to bloated files and ensure your .env secrets are Redacted before they are sent to third-party AI providers like OpenAI or Anthropic.
Important: When using LLM Router with Roo Code, you must configure the
Base URL to point to https://api.llmrouter.app/v1 instead of the default
OpenAI or Anthropic endpoints.
Open the Roo Code settings panel (usually by clicking the gear icon in the Roo Code sidebar) and fill in the following information:
API Provider: Select OpenAI Compatible (Do not select OpenAI or Anthropic directly, as we need to override the Base URL).
Base URL: Enter https://api.llmrouter.app/v1
API Key: Enter your LLM Router API Key (e.g., sk-router-...). You can generate this in your LLM Router Dashboard.
Model ID: Enter the specific model you want to use, prefixed with the provider slug.
Example 1:anthropic/claude-3-5-sonnet (Highly recommended for coding).
Example 2:openai/gpt-4o
Advanced Planning: If you want Roo Code to use our “Chain of Thought”
planning feature for complex refactors, you can set the Model ID to:
anthropic/claude-3-5-sonnet:planning:openai/o1-mini.
Enter your requirements in the Roo Code chat box. Because traffic is now flowing through LLM Router, you will immediately benefit from:
Token Savings: When Roo Code reads a massive 3,000-line file, LLM Router will dynamically compress the irrelevant middle sections if the context shifts, saving you up to 80% on API costs.
Security: If Roo Code accidentally reads an AWS Key or Database Password from your local workspace, LLM Router’s PII engine will redact it into [TOKEN_REDACTED] before sending the code to Anthropic or OpenAI.
Reliability: If the primary AI provider experiences an outage, LLM Router will automatically fall back to your configured secondary provider without interrupting your VS Code session.