Developers working across JetBrains IDEs—including IntelliJ IDEA, PyCharm, WebStorm, Rider, GoLand, and CLion—can switch between Anthropic Claude 3.5 Sonnet and OpenAI GPT-4o directly within the AI Chat tool window via its model selector dropdown, or globally configure their access through Settings | Tools | AI Assistant | Providers & API keys.
However, effective model switching requires understanding how JetBrains AI Assistant separates task layers: interactive chat and coding agents let you alternate between foundation models like Claude 3.5 Sonnet and GPT-4o, whereas inline code completion runs on dedicated low-latency engines (local models or JetBrains Mellum) and does not automatically follow your chat model selection.
1. Where Model Switching Happens: Chat Dropdown vs. Global Settings
JetBrains provides two complementary ways to manage models: per-conversation selection in the chat window and provider management in IDE settings.
Method A: Per-Task Model Switching in the AI Chat Window
For day-to-day coding, you do not need to open the global settings dialog every time you want a different model.
- Open the AI Chat tool window from the right toolbar (or press
Alt+Enter/ double Shift and search for "AI Chat"). - At the top toolbar of the AI Chat window, locate the Model Selector dropdown (it displays the currently active model or Auto).
- Click the dropdown to view available models:
- Select Claude 3.5 Sonnet when tackling complex multi-file refactoring, deep algorithmic design, or nuanced architecture reviews.
- Select GPT-4o for broad code generation, fast troubleshooting, conversational planning, or scripting.
- Select Auto if you want JetBrains to dynamically route your prompt based on benchmarked performance and token cost.
- Start a prompt or attach relevant project context (files, symbols, or git diffs).
Tip: Switching models midway through an active conversation can inflate token usage because the entire conversational history is resubmitted to the newly selected model. If you are changing tasks, click the + (New Chat) icon before selecting a different model.
Method B: Connecting Custom Models via "Providers & API keys" (BYOK)
If your team does not use a managed JetBrains AI subscription, or if you prefer using your organization's direct API credits, you can use the Bring Your Own Key (BYOK) feature:
- Open IDE settings:
- Windows / Linux:
File | Settings(orCtrl+Alt+S) - macOS:
IntelliJ IDEA | Settings(orCmd+,)
- Windows / Linux:
- Navigate to Tools | AI Assistant | Providers & API keys.
- Under Third-party AI providers, choose your provider:
- Anthropic: Enter your Anthropic API key to enable Claude 3.5 Sonnet and related models.
- OpenAI: Enter your OpenAI API key to enable GPT-4o, GPT-4o mini, and reasoning models.
- OpenAI Compatible / Local: Connect endpoints like Ollama, LM Studio, or LiteLLM if you host models privately.
- Click Test Connection to confirm network connectivity and key permissions.
- Click Apply and OK. The newly authorized models will immediately appear in the AI Chat model selector dropdown.
2. The Architectural Boundary: Chat Models vs. Code Completion
A frequent point of confusion is expecting inline keystroke suggestions (ghost text while typing boilerplate code) to change when you pick Claude 3.5 Sonnet in the chat window. In JetBrains AI Assistant, these tasks are strictly partitioned by design:
| Feature Layer | Primary Models Used | Why They Are Separated |
|---|---|---|
| AI Chat & Agents | Claude 3.5 Sonnet; GPT-4o; o1/o3; Gemini | Heavy reasoning and long-context comprehension; tolerates latencies of 1 to 5 seconds. |
| In-Editor Generation & Refactoring | Core feature model (GPT-4o / Claude / Gemini) | Triggered intentionally via Alt+Enter or contextual menus for structured code edits. |
| Inline Code Completion (Ghost Text) | JetBrains Mellum; Local Full Line models | Requires ultra-low latency (<50ms) and specialized Fill-in-the-Middle (FIM) training. General chat models would cause typing lag. |
| Instant Helpers | GPT-4o mini; Gemini Flash | Lightweight background tasks: generating chat titles, collecting symbol context, and naming suggestions. |
If you need custom completion models, JetBrains allows configuring an OpenAI-compatible provider specifically under the AI Completion section in Providers & API keys. However, the model must explicitly support FIM or edit-prediction schemas; generic chat models cannot be assigned to keystroke completion.
3. Task Allocation Strategy: When to Use Claude 3.5 Sonnet vs. GPT-4o
Both models are top-tier, but each excels in distinct software engineering workflows.
Choose Claude 3.5 Sonnet For:
- Architectural Refactoring & Legacy Codebases: Claude 3.5 Sonnet demonstrates superior adherence to complex coding constraints, edge cases, and multi-file dependencies.
- Agentic Multi-Step Tasks: In AI Assistant's Agent mode, Claude excels at analyzing large attached contexts, diagnosing compiler error chains, and proposing non-destructive diffs.
- Strict Logic & Static Typing: Well-suited for complex Rust, TypeScript type puzzles, C++ memory safety considerations, and enterprise Java design patterns.
Choose GPT-4o For:
- Rapid Prototyping & Boilerplate Generation: GPT-4o responds swiftly with production-grade syntax for standard REST endpoints, CRUD services, and integration scripts.
- Documentation & Test Suites: Excellent at generating comprehensive unit tests (JUnit, pytest, Jest), docstrings, and commit messages with standardized formatting.
- Broad Ecosystem Translation: Highly reliable when converting code across languages (e.g., Python to Go, or Java to Kotlin) or handling multi-language data schemas.
4. Quota and Credit Management
Model switching directly influences your billing and rate limits. Keep these factors in mind:
- JetBrains AI Service Credits (AI Pro / AI Ultimate):
- Cloud requests consume AI Credits that reset every 30 days.
- Claude 3.5 Sonnet and GPT-4o are categorized as full-capability foundation models, consuming more credits per request than lightweight models like GPT-4o mini or Gemini Flash.
- The UI displays informative tags (such as
Reasoning modelorHigh cost model) to help you gauge credit impact before dispatching queries.
- Context Accumulation Multipliers:
- Because language models process the full chat history on every turn, a conversation with 20 back-and-forth exchanges burns significantly more tokens on turn 20 than on turn 1.
- Always click New Chat when transitioning from system design questions to unrelated bug hunts.
- BYOK Cost Advantages:
- If your organization already has enterprise Anthropic or OpenAI agreements, setting up BYOK allows developers to avoid JetBrains cloud credit caps entirely. You pay only for raw token usage directly to your provider.
- Enterprise Policy Governance:
- If your IDE is managed via JetBrains Central or JetBrains IDE Services, administrators can centrally lock or restrict third-party providers. In enterprise environments where external cloud calls are regulated, certain model toggles may be greyed out.
5. Summary: Recommended Setup Workflow
To alternate smoothly between Claude 3.5 Sonnet and GPT-4o across your JetBrains tools:
- Keep Auto or GPT-4o as your default baseline for everyday coding inquiries and quick test generation.
- Toggle the dropdown to Claude 3.5 Sonnet whenever you enter Agent mode or work on complex architectural rewrites.
- Leave code completion to JetBrains Mellum and local Full Line models for seamless, zero-lag typing.
- Open a New Chat between tasks to keep credit consumption predictable.