Junie CLI launched March 2026 as JetBrains' LLM-agnostic terminal coding agent. With BYOK support, you bring your own Anthropic, OpenAI, or Google API keys — and pay providers directly.
But BYOK doesn't mean cheap. A typical Junie session analyzing and refactoring code can rack up 50–200 API calls. Using Claude Opus for everything is like taking a taxi everywhere when a scooter would do.
Works alongside Junie's BYOK. No code changes required.
ANTHROPIC_BASE_URL=http://localhost:4100 JUNIE_ANTHROPIC_API_KEY=sk-ant-... juniePOST /v1/messagesJunie CLI sends Claude API requests. With ANTHROPIC_BASE_URL set, calls go to RelayPlane instead of Anthropic directly.
→ claude-3-5-haikuAnalyzes the prompt complexity. File reads and simple checks go to Haiku. Deep reasoning goes to Sonnet or Opus.
← SSE streamRelayPlane forwards to the optimal model and streams the response back to Junie. Completely transparent.
relayplane:autoInfers task complexity from the prompt. Junie file-reads go to Haiku, complex reasoning goes to Sonnet/Opus.
file_read → haiku code_analysis → sonnet
relayplane:costMaximum savings. Routes everything to Haiku first, escalates only on failure.
everything → haiku # escalate on error
relayplane:qualityUses best available model. Similar quality to native Junie, but with routing telemetry.
everything → opus # full quality mode
ANTHROPIC_API_KEYYour Anthropic key — used by the proxy to forward requests
ANTHROPIC_BASE_URLSet to http://localhost:4100 to route through proxy
OPENAI_API_KEYOptional: enable OpenAI model routing
JUNIE_ANTHROPIC_API_KEYYour Anthropic key for Junie BYOK authentication
JUNIE_MODELDefault model (RelayPlane overrides per-request)
JUNIE_API_KEYAlternative: JetBrains subscription key
# RelayPlane proxy config export ANTHROPIC_API_KEY="sk-ant-your-key-here" export ANTHROPIC_BASE_URL="http://localhost:4100" # Optional: multi-provider routing export OPENAI_API_KEY="sk-your-openai-key" # Junie BYOK (mirrors your Anthropic key) export JUNIE_ANTHROPIC_API_KEY="$ANTHROPIC_API_KEY"
Confirm ANTHROPIC_BASE_URL is set in the same shell session where you run Junie:
echo $ANTHROPIC_BASE_URL # Should show http://localhost:4100
Start RelayPlane with verbose mode to see what's happening:
npx @relayplane/proxy --port 4100 -v
Make sure both env vars reference the same Anthropic API key:
export ANTHROPIC_API_KEY="sk-ant-..." export JUNIE_ANTHROPIC_API_KEY="$ANTHROPIC_API_KEY"
Check the RelayPlane stats endpoint while Junie is running:
curl http://localhost:4100/control/stats | jq
Unset ANTHROPIC_BASE_URL to go direct, then reset it:
unset ANTHROPIC_BASE_URL && junie