# Use Xantly with JetBrains AI Assistant + Junie

JetBrains AI Assistant (IntelliJ, PyCharm, WebStorm, GoLand, Rider, etc.) and the agent-mode Junie both support custom OpenAI-compatible providers since 2024.3. Drop in Xantly once and every chat, inline edit, code-complete assist, and Junie agent run routes through smart routing + semantic cache + memory.

## Prerequisites

- A JetBrains IDE version 2024.3+ (IntelliJ IDEA, PyCharm, WebStorm, etc.)
- AI Assistant plugin installed (bundled in most 2024.3+ versions)
- A Xantly API key, [create one](/dashboard/api-keys)

## Setup

1. Open **Settings** → **Tools** → **AI Assistant** → **Providers & API Keys**.
2. Click **Add Provider** → **OpenAI (compatible)**.
3. Fill in:

| Field | Value |
|---|---|
| Display name | `Xantly` |
| Base URL | `https://api.xantly.com/v1` |
| API Key | `xantly_sk_...` |
| Available models | `xantly/auto-quality`, `xantly/auto-value`, `anthropic/claude-sonnet-4.6`, `openai/gpt-5.4` (comma-separated) |

4. Click **Test connection** → you should see a green checkmark.
5. Under **Models** → set the default to `xantly/auto-quality` for chat, and `xantly/auto-value` for inline edits.
6. Apply + restart the IDE.

## Using AI Assistant

- `Alt+Enter` on a selection → AI actions (Explain, Refactor, Write docs).
- `Ctrl+\` → inline AI completion.
- AI chat panel → conversational mode.

All three route through your Xantly provider now.

## Using Junie (agent mode)

Junie is JetBrains' autonomous agent. With the Xantly provider active:

1. Open the Junie panel (sidebar) or `Cmd+J`.
2. Give it a task: *"Add tests for the auth module."*
3. Junie plans → edits files → runs tests, all via Xantly.

Junie's multi-step agent runs are cache-friendly, similar sub-prompts across steps hit L2 cache.

## Model choice

| Model ID | When |
|---|---|
| `xantly/auto-quality` | Chat + Junie, production default. |
| `xantly/auto-value` | Inline edits (high frequency). |
| `anthropic/claude-sonnet-4.6` | Long-context refactors, multi-file agent work. |
| `openai/gpt-5.4` | Structured output, schema-tight edits. |
| `xantly/auto-speed` | Quick inline completions / commit messages. |

## Verify

Open the AI chat panel, send:

```
Reply with just the word "pong".
```

Check your Xantly dashboard, call logged with routed-to model, cache status, USD cost.

## What you get

- **Full IDE surface.** Chat, inline actions, Junie agent, commit-message generation, all through Xantly.
- **Waterfall fallback.** Junie's long agent runs don't crash on mid-run provider outages.
- **Semantic cache.** Highly cache-friendly for repetitive "write a test for X" / "explain this function" patterns.
- **Memory.** JetBrains passes project + file context with each call; Xantly's L3 memory layers cross-session context on top.
- **Cost per IDE action** logged.

## Gotchas

**JetBrains AI Assistant used to require their Enterprise plan for custom providers.** As of 2024.3 and the free-tier reorg, the custom-provider feature is available on all plans. If your IDE shows it as locked, upgrade to the latest version.

**Model availability.** The provider config requires you to list available models. If you add new Xantly models to your catalog later, remember to add them to the AI Assistant config too.

**Junie context strategy.** Junie sends aggressive repo context with each call. Xantly's auto-quality model can handle it; pure speed-tier models may truncate. Stick to quality/value tiers for Junie.

**Base URL must include `/v1`.** Same rule as other OpenAI-compatible endpoints.

**Plugin vs bundled AI Assistant.** In newer JetBrains versions the AI Assistant is bundled; if your version has it as a separate plugin, make sure it's updated.

## Next steps

- [Cline](/docs/use-with-cline), VS Code agent mode, same pattern.
- [Kilo Code](/docs/use-with-kilo-code), Kilo ships a JetBrains plugin with per-mode models.
- [Continue.dev](/docs/use-with-continue-dev), also ships a JetBrains plugin with role-split config.
- [Bring Your Own Key](/docs/bring-your-own-key), route JetBrains AI through your own provider credits.
