Junie + MegaBrain Gateway
Junie is JetBrains' autonomous coding agent, built into IntelliJ IDEA, PyCharm, WebStorm and all JetBrains IDEs. Connect it to MegaBrain Gateway to use any of 500+ models — GPT-4o, Claude Opus, Gemini 2.5 Pro, DeepSeek R1 — with a single API key.
Any model
Junie defaults to Claude. With MegaBrain you pick the best model for each task.
No per-seat pricing
Pay only for tokens used. No Anthropic or JetBrains AI subscription required.
Works with all JetBrains IDEs
IntelliJ, PyCharm, WebStorm, GoLand, Rider — wherever Junie runs.
Prerequisites
- JetBrains IDE 2024.3 or later with the Junie plugin installed
- A MegaBrain API key — getmegabrain.com/profile
Setup
Install the Junie plugin
Open your JetBrains IDE and go to Settings → Plugins → Marketplace. Search for Junie and click Install. Restart the IDE when prompted.
Open Junie settings
After restart, go to Settings → Tools → Junie (or find the Junie panel in the right sidebar). Click Configure AI Provider.
Set MegaBrain as the custom provider
Select Custom OpenAI-compatible endpoint and fill in:
https://getmegabrain.com/api/gateway/v1MegaBrain OpenAI-compatible gateway endpoint.
mb-••••••••••••••••Your MegaBrain API key.
anthropic/claude-sonnet-4-6Or any model ID from the MegaBrain leaderboard.
Click Test connection — you should see a green checkmark. Then click Save.
Pick your model for each task
Junie works best with strong reasoning models. Recommended setup:
# Best for complex refactors and architecture
anthropic/claude-opus-4-8
# Best daily driver — fast + capable
anthropic/claude-sonnet-4-6
# Best value for large codebases
google/gemini-2.5-pro
# Best open-source option
deepseek/deepseek-r1Browse all options at getmegabrain.com/models.
How Junie works
Junie is an autonomous agent — you describe a task, it plans, edits files, runs tests, and iterates until done. Unlike inline completion tools, Junie operates on multi-step tasks: implementing features, fixing bugs, writing tests, refactoring modules.
Agentic loop
Junie reads your codebase, proposes a plan, edits files, and verifies results in a loop — no hand-holding required.
IDE-native
Runs inside IntelliJ/PyCharm with full project context: imports, type info, test runners, and VCS history.
Diff review
Every change is presented as a diff. You review and apply, or discard — Junie never auto-commits.
Token-efficient
Junie batches file reads and tool calls. Typical tasks use 20k–80k tokens — pick a cost-effective model for bulk work.
Troubleshooting
Test connection fails with 401
Your API key is wrong or has no balance. Check it at getmegabrain.com/profile and top up if needed.
Model not found / 404
Use the full provider/model-name format: anthropic/claude-sonnet-4-6, not just claude-sonnet-4-6. Check the exact ID on the MegaBrain leaderboard.
Junie doesn't appear in Settings
Make sure the Junie plugin is installed and enabled (Settings → Plugins). It requires IDE version 2024.3 or later.
Responses are slow
Junie sends large context windows. Switch to a faster model like google/gemini-2.0-flash or anthropic/claude-haiku-4-5 for speed-critical tasks.