If you live in the terminal, you already know OpenCode. It's a fast, keyboard-driven AI coding assistant that runs right in your shell — no VS Code, no Electron, no bloat. You get an AI pair programmer that thinks at the speed you type.
But here's the problem: OpenCode locks you into one model. You pick GPT-4o, you pay GPT-4o prices for everything — even quick questions that a 7B model could answer in half the time. Switch to a cheaper model, and your complex refactoring sessions suffer. It's always a compromise.
Unless you point OpenCode at Antbase. Then every request gets classified and routed to the best model automatically. Simple completions go to fast, cheap models. Complex architecture questions escalate to frontier reasoning models. And you never change a setting.
Setup in 60 Seconds
Open your OpenCode settings and add ANT as a custom provider:
- •Provider ID: ant
- •Display Name: ANT
- •Base URL: https://antbase.ai/v1
- •API Key: your Antbase API key (ant_...)
Or configure it in your opencode.json:
{
"provider": "openai-compatible",
"baseUrl": "https://antbase.ai/v1",
"apiKey": "your-ant-api-key",
"model": "ant:coder"
}That's it. OpenCode now routes through Antbase.
Which Virtual Model to Use
Antbase has virtual models designed specifically for different coding workflows. Here's what to use when:
- •ant:coder — The default for coding sessions. Optimized for code generation, refactoring, and debugging. Routes to the best code-specialized model available.
- •ant:reasoning — For deep thinking. Architecture decisions, complex algorithms, tricky debugging. Routes to chain-of-thought models like DeepSeek-R1 or Qwen3-Thinking.
- •ant:reasoning-premium — Maximum brainpower. When you need Claude Opus or GPT-5 thinking through a hard problem, this is the one.
- •ant:fast — Quick completions and inline suggestions. Prioritizes speed over depth.
- •ant:free — Zero-cost experimentation. Great for trying things out, learning, or when you're in exploration mode.
Why This Combo Works
Terminal coding is fast and iterative. You fire off dozens of requests per session — some trivial, some complex. Paying frontier-model prices for every request makes no sense. With Antbase routing, the economics flip:
- •Quick questions ("what does this flag do?") → fast free model, ~0.2s, $0
- •Code generation ("write a retry wrapper with exponential backoff") → ant:coder routes to the best code model, ~1s
- •Architecture review ("review this module structure for scaling issues") → ant:reasoning escalates to a thinking model, ~5s but correct
- •Debugging ("why does this deadlock under load?") → ant:reasoning-premium brings the big guns
You stop thinking about models and start thinking about code. Antbase handles the rest.
Environment Variables (Alternative)
If you prefer environment variables over config files:
export OPENAI_API_BASE=https://antbase.ai/v1
export OPENAI_API_KEY=your-ant-api-keyAdd these to your .zshrc or .bashrc and every OpenCode session automatically uses Antbase.
Try It Now
If you already have OpenCode installed, the setup takes under a minute. If you don't — install it, point it at Antbase, and experience what terminal AI coding should feel like.


