> ## 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.

<Info>
  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](/models/quickstart) instead.
</Info>

<Info>
  US projects: `corti-s1` model IDs are served by Azure-hosted OpenAI models. See [Regions](/models/regions).
</Info>

## 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.
</Tip>

<Steps titleSize="h3">
  <Step title="Install a coding agent">
    The Corti CLI supports the following agents. Install one (or more) using your preferred method.

    <Tabs>
      <Tab title="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).
        </Note>
      </Tab>

      <Tab title="OpenCode Desktop">
        Download the desktop UI for macOS, Linux, or Windows.

        <Card title="Download OpenCode Desktop" icon="download" href="https://opencode.ai/download" arrow="true">
          Get the installer at opencode.ai/download.
        </Card>
      </Tab>

      <Tab title="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).
        </Note>
      </Tab>

      <Tab title="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/).
        </Note>
      </Tab>

      <Tab title="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).
        </Note>
      </Tab>
    </Tabs>
  </Step>

  <Step title="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).
    </Note>

    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 title="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.
    </Accordion>

    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 title="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`
    </Accordion>
  </Step>

  <Step title="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.

    <Tabs>
      <Tab title="macOS / Linux">
        <CodeGroup>
          ```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
          ```
        </CodeGroup>
      </Tab>

      <Tab title="Windows">
        <CodeGroup>
          ```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"
          ```
        </CodeGroup>
      </Tab>
    </Tabs>
  </Step>

  <Step title="Start coding">
    Launch your agent — you're now running an AI coding assistant backed by Corti Models.

    <Tabs>
      <Tab title="OpenCode">
        ```bash theme={null}
        opencode
        ```
      </Tab>

      <Tab title="ForgeCode">
        ```bash theme={null}
        forge
        ```
      </Tab>

      <Tab title="Crush">
        ```bash theme={null}
        crush
        ```

        Select provider **corti** when prompted.
      </Tab>

      <Tab title="Pi">
        ```bash theme={null}
        pi
        ```

        Select provider **corti** when prompted.
      </Tab>
    </Tabs>

    Ask the agent a question and confirm it answers using the Corti model you selected.
  </Step>
</Steps>

## Next steps

<CardGroup cols={2}>
  <Card title="AI Coding Tools" href="/quickstart/ai-coding-tools" icon="sparkles">
    Prompt Claude Code, Cursor, Codex, or Lovable with a Corti build skill.
  </Card>

  <Card title="API Reference" href="/api-reference/welcome" icon="square-terminal">
    Browse the full Corti API with interactive examples.
  </Card>

  <Card title="JavaScript SDK" href="/sdk/js/overview" icon="code">
    SDK reference, the foundation the CLI and skills build on.
  </Card>

  <Card title="Agentic Framework" href="/agentic/overview" icon="puzzle">
    Multi-expert orchestration, MCP servers, and the agent runtime.
  </Card>
</CardGroup>

<Note>
  AI-generated code should always be reviewed and tested before use in
  production. Human oversight ensures correctness, security, and compliance with
  applicable regulations.
</Note>
