--- title: Roo Code + custom endpoint: agent forks shouldn't cost frontier prices slug: roo-code-custom-endpoint canonical_url: https://blog.juscode.co/roo-code-custom-endpoint published_at: 2026-05-27T00:00:00+00:00 author: jusCode tags: roo-code, vscode-agent, openai-compatible, custom-base-url, cost-optimization tldr: In Roo Code → Settings → API Configuration, pick "OpenAI Compatible". Set Base URL to https://api.juscode.co/v1, paste a jcg_ token, and use jusCode-auto. All four modes (Code, Architect, Ask, Debug) keep their behavior; jusCode picks the cheapest capable model per turn. key_takeaways: - Roo Code works with any OpenAI-compatible endpoint via the OpenAI Compatible provider. - Set base_url to https://api.juscode.co/v1 and use a jcg_ token with model jusCode-auto. - All four Roo modes keep their behavior; jusCode routes per turn. --- # Roo Code + custom endpoint: fork the agent, not the bill [Roo Code](https://roocode.com) is a Cline fork that added persistent multi-mode workflows (Code, Architect, Ask, Debug) and a richer prompt-customization surface. It's excellent for long-running refactors and architecture conversations, and like Cline, it'll happily burn through Claude tokens on default settings. Roo natively supports any OpenAI-compatible base URL, so you can route through jusCode and keep all four modes working as designed. ## What you'll change Two values in Roo Code's settings panel. No extension reinstall, no mode behavior change, no workflow change. ## Setup ### 1. Mint a jusCode API key Sign in at [juscode.co/login](https://juscode.co/login) with Google or Microsoft. Open [juscode.co/developer](https://juscode.co/developer) → **Keys** tab → **Mint key**. Copy the `jcg_…` token (shown once). ### 2. Configure Roo Code Open Roo Code in VS Code → click the gear icon → **API Configuration**. - **API Provider**: `OpenAI Compatible` - **Base URL**: `https://api.juscode.co/v1` - **API Key**: paste the `jcg_…` token - **Model**: `jusCode-auto` - **Model Context Window**: leave at default (Roo auto-detects from the first response) Save. That's it. ### 3. Verify Open any project, hit **Code** mode, type `read package.json and tell me what this app does`. You should see a normal Roo response. Open the Roo output panel; request lines now show `api.juscode.co` instead of `api.anthropic.com`. ## Mode-by-mode notes | Mode | What changes | What doesn't | |---|---|---| | **Code** | Picks a smaller model for "read file" steps, a stronger one for "rewrite this function" | Tool use, file edits, terminal commands | | **Architect** | Routes long-context planning to a high-context model regardless of cost (it's the highest-leverage call in a session) | Plan-then-implement separation | | **Ask** | Single-shot Q&A goes to a fast, cheap model, usually 10-15ms TTFT | Conversation persistence | | **Debug** | Stack-trace analysis lands on a reasoning-capable model with `reasoning_effort=medium` by default | Test-run loop, breakpoint inspection | ## What if Roo's auto-detection picks the wrong context window? Set it explicitly. In **Advanced Settings**, override `Context Window` to `200000` (DeepSeek v4 Pro's window, currently jusCode's default upstream). If you later hit a model with a smaller window, jusCode will route around it; the override just prevents Roo from truncating your prompt before the request leaves. ## Cost comparison: same 4-hour Roo session | Setup | Approximate session cost | Notes | |---|---|---| | Roo + Claude Sonnet (direct) | $18-25 | Baseline; mixed-mode session, ~40 tool calls | | Roo + GPT-4.1 (direct) | $14-19 | Cheaper input, comparable output | | Roo + jusCode-auto | $4-7 | Smaller model on tool-use steps; reasoning model only when needed | (These are sample sessions, not benchmarks. Your numbers will vary with how much you bounce between Architect and Code modes.) ## What Roo doesn't lose - **Multi-mode workflow**: all four modes route through the same endpoint; the mode switch is client-side - **Custom instructions**: Roo's mode-level custom instructions go in the system prompt; jusCode passes them through unchanged - **Prompt history**: stored locally in your VS Code profile; not touched by the endpoint change - **Approval flows**: Roo's "review before applying" toggles are client-side; unaffected ## When to stay on Roo's default provider Two cases: 1. **Strict provider compliance**: your team has a contract with Anthropic or OpenAI that requires direct billing. jusCode is a passthrough; the underlying provider sees jusCode's account, not yours. 2. **Provider-specific features Roo doesn't abstract**: e.g. Claude's prompt caching headers, if Roo exposes them in a future release. As of today, all mode behaviors are abstractable through OpenAI-compatible calls. ## Switching back Same gear icon, change **API Provider** back to your prior choice. No state is lost. jusCode keys keep working until you revoke them; you can A/B between endpoints without churn. ## Further reading - [Cline + custom endpoint](/blog/cline-custom-endpoint): the parent project's setup - [Custom agent harness on an OpenAI-compatible base URL](/blog/custom-agent-harness-openai-compatible): what every harness needs - [jusCode API reference](/docs/api-reference): every supported field including `reasoning_effort` and `thinking` ## FAQ ### How do I point Roo Code at a cheaper endpoint? Use the OpenAI Compatible provider: base_url https://api.juscode.co/v1, a jcg_ token, and model jusCode-auto. Behavior is unchanged. ### Does Roo Code lose any features on a custom endpoint? No. Tool use, edits, and memory keep working; only the model selection moves behind the gateway. ### How much does per-call routing save? Typically 60-80% on real coding-agent workloads, because most steps do not need a frontier model.