> ## Documentation Index
> Fetch the complete documentation index at: https://docs.corti.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Use Corti Models in your coding agent

> Connect OpenCode, Pi, Crush, or ForgeCode to Corti Models with the Corti CLI.

Connect your terminal AI coding agent to Corti Models. Install a supported agent, run the Corti CLI, and start coding.

> [!NOTE]
>
> This is the **coding agent** path for agentic coding and personal usage. If you want to replace OpenAI or Anthropic as the LLM provider in your application code, see [Replace your LLM provider](https://docs.corti.ai/models/quickstart.md) instead.

> [!NOTE]
>
> US projects: `corti-s1` model IDs are served by Azure-hosted OpenAI models. See [Regions](https://docs.corti.ai/models/regions.md).

## Before you start

You'll need:

* A terminal on macOS, Linux, or Windows
* [Node.js](https://nodejs.org) 18+ installed (required to run the Corti CLI via `npx`)
* A [Corti Console](https://console.corti.app) account (free to create)

> [!TIP]
>
> The Corti CLI writes a `corti` provider entry into each selected agent's
> config and manages a `.env` block with your credentials. Each config
> references `CORTI_BEARER` rather than embedding the secret itself.

### 1. Install a coding agent

The Corti CLI supports the following agents. Install one (or more) using your preferred method.

> [tab] OpenCode
>
> ```bash Install theme={null}
> curl -fsSL https://opencode.ai/install | bash
> ```
>
> ```bash Verify theme={null}
> opencode --version
> ```
>
> > [!NOTE]
> >
> > Learn more at [opencode.ai](https://opencode.ai).

> [tab] OpenCode Desktop
>
> Download the desktop UI for macOS, Linux, or Windows.
>
> > [card] [Download OpenCode Desktop](https://opencode.ai/download)
> >
> > Get the installer at opencode.ai/download.

> [tab] ForgeCode
>
> ```bash Install theme={null}
> curl -fsSL https://forgecode.dev/cli | sh
> ```
>
> ```bash Verify theme={null}
> forge --version
> ```
>
> > [!NOTE]
> >
> > Learn more at [forgecode.dev](https://forgecode.dev).

> [tab] Crush
>
> ```bash Install theme={null}
> curl -fsSL https://charm.land/install.sh | bash
> ```
>
> ```bash Verify theme={null}
> crush --version
> ```
>
> > [!NOTE]
> >
> > Learn more at [charm.land/crush](https://charm.land/).

> [tab] Pi
>
> ```bash Install theme={null}
> curl -fsSL https://pi.dev/install.sh | sh
> ```
>
> ```bash Verify theme={null}
> pi --version
> ```
>
> > [!NOTE]
> >
> > Learn more at [pi.dev](https://pi.dev).

### 2. Run the setup wizard

Run the interactive setup to authenticate and configure the Corti provider for your installed agents:

```bash theme={null}
npx @corti/cli models init
```

> [!NOTE]
>
> `npx` requires [Node.js](https://nodejs.org) 18+. Download it from [nodejs.org](https://nodejs.org) or install via a version manager like [fnm](https://fnm.vercel.app) or [nvm](https://github.com/nvm-sh/nvm).

The wizard opens by asking how you want to sign in:

```text theme={null}
◆ How do you want to sign in?
│  ▸ ● Log in with a browser
│    ○ Paste an API key
│    ○ Enter client credentials
└ ↑↓ move · enter select
```

Press **Enter** to accept the default, **Log in with a browser**. The CLI shows a one-time code and opens the Corti Console. Approve the sign-in there, and the terminal continues on its own.

If the browser can't open automatically, for example over SSH, the CLI prints a URL for you to open instead.

> [accordion] Paste an API key instead
>
> 1. In the Console, open [Corti Models](https://console.corti.app/corti-models) and generate your personal API key.
> 2. In the CLI, choose **Paste an API key** and paste it.
>
> The value is masked on entry and stored as `CORTI_BEARER`.
>
> Client credentials still work as well, mainly for headless and CI runs.

Once you're signed in, the wizard:

1. Verifies the connection and probes `/models` so you can pick a default model.
2. Detects installed agents and pre-selects them (toggle with Space).
3. Lets you choose scope: Global (`~/.config`), Project (current directory), or both.
4. Shows a plan and asks you to confirm before writing anything.

Press **Enter** to accept the defaults at each step.

> [accordion] Where the CLI writes your config
>
> The CLI writes a `corti` provider entry into each selected agent's config file, plus a managed `.env` block with your credentials:
>
> * **ForgeCode** — `~/.forge/.forge.toml`
> * **OpenCode** — `~/.config/opencode/opencode.json` (or `.jsonc`)
> * **Crush** — `~/.config/crush/crush.json`
> * **Pi** — `~/.pi/agent/models.json`

### 3. Load your credentials

If you let the CLI update your shell startup file, open a new terminal and skip ahead.

Otherwise, load the `.env` manually. Global scope writes it to `~/.env`, project scope to `.env` where you ran the CLI.

> [tab] macOS / Linux
>
> ```bash bash / zsh theme={null}
> set -a; . ~/.env; set +a
> ```
>
> ```fish fish theme={null}
> for l in (cat ~/.env); string match -q '*=*' -- $l; and set -gx (string split -m 1 = -- $l); end
> ```

> [tab] Windows
>
> ```powershell PowerShell theme={null}
> Get-Content "$HOME\.env" | ForEach-Object {
>     $line = $_.Trim()
>     if ($line -and -not $line.StartsWith('#')) {
>         $name, $value = $line -split '=', 2
>         Set-Item -Path "Env:$($name.Trim())" -Value $value.Trim().Trim('"').Trim("'")
>     }
> }
> ```
>
> ```batch cmd theme={null}
> for /f "usebackq eol=# tokens=1* delims==" %A in ("%USERPROFILE%\.env") do @set "%A=%B"
> ```

### 4. Start coding

Launch your agent — you're now running an AI coding assistant backed by Corti Models.

> [tab] OpenCode
>
> ```bash theme={null}
> opencode
> ```

> [tab] ForgeCode
>
> ```bash theme={null}
> forge
> ```

> [tab] Crush
>
> ```bash theme={null}
> crush
> ```
>
> Select provider **corti** when prompted.

> [tab] Pi
>
> ```bash theme={null}
> pi
> ```
>
> Select provider **corti** when prompted.

Ask the agent a question and confirm it answers using the Corti model you selected.

## Next steps

> [card] [AI Coding Tools](https://docs.corti.ai/quickstart/ai-coding-tools.md)
>
> Prompt Claude Code, Cursor, Codex, or Lovable with a Corti build skill.

> [card] [API Reference](https://docs.corti.ai/api-reference/welcome.md)
>
> Browse the full Corti API with interactive examples.

> [card] [JavaScript SDK](https://docs.corti.ai/sdk/js/overview.md)
>
> SDK reference, the foundation the CLI and skills build on.

> [card] [Agentic Framework](https://docs.corti.ai/agentic/overview.md)
>
> Multi-expert orchestration, MCP servers, and the agent runtime.

> [!NOTE]
>
> AI-generated code should always be reviewed and tested before use in
> production. Human oversight ensures correctness, security, and compliance with
> applicable regulations.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.