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

# Concentrate CLI

> Launch Claude Code, Codex, OpenCode, and pi through Concentrate with one command and one API key.

> [!NOTE]
>
> The Concentrate CLI (`cn`) is in beta. It works on macOS and Linux. Report anything that doesn't work to [support@concentrate.ai](mailto:support@concentrate.ai).

`cn` starts your coding tools through Concentrate. It sets up each tool's provider, models, and prices for you, so you can switch models without editing config files. The source is on [GitHub](https://github.com/concentrateai-hq/cli).

> [accordion] Reasons to Use the Concentrate CLI
>
> 1. **One command per tool** — `cn claude`, `cn codex`, `cn opencode`, and `cn pi` start each tool on Concentrate.
> 2. **Your settings stay yours** — Launching through `cn` doesn't change the tool's own settings or subscription login.
> 3. **Live model catalog** — New models appear without updating `cn`.
> 4. **Prices and caching set up for you** — OpenCode and pi show cost estimates from Concentrate's prices, and Claude models use [prompt caching](https://concentrate.ai/docs/api-reference/endpoint/prompt-caching.md).
> 5. **Usage analytics** — Review requests, models, tokens, and costs in your [dashboard](https://concentrate.ai/dashboard).

## Supported tools

| Tool | Support |
| - | - |
| [Claude Code](https://concentrate.ai/docs/integrations/claude-code.md) | Any model in the Concentrate catalog |
| [OpenCode](https://concentrate.ai/docs/integrations/opencode.md) | Any model in the catalog. OpenCode v1 and v2 are supported. |
| [pi](https://concentrate.ai/docs/integrations/pi.md) | Any model in the catalog. Needs pi 0.77 or newer. |
| [Codex](https://concentrate.ai/docs/integrations/codex.md) | OpenAI models only for now |
| [Cursor](https://concentrate.ai/docs/integrations/cursor.md) desktop | Work in progress. Set up with `cn configure cursor`. |

## Quick Start

> [accordion] View prerequisites (before you begin)
>
> * macOS or Linux
> * Node.js 18.18 or newer
> * A Concentrate API key from [concentrate.ai/api-keys](https://concentrate.ai/api-keys), with credits on the account
> * The coding tools you want to use, installed and on your `PATH`

**1. Install the CLI**

```bash theme={null}
curl -fsSL https://concentrate.ai/scripts/install-cli.sh | bash
```

The installer downloads the latest release from [GitHub](https://github.com/concentrateai-hq/cli/releases), verifies its SHA-256 checksum, and puts `cn` in `~/.local/bin`. If that folder isn't on your `PATH`, the installer prints the line to add to your shell profile. Open a new terminal afterward.

**2. Save your API key**

```bash theme={null}
cn setup
```

You can also run `cn` to open the launcher, which asks for your key the first time. If `CONCENTRATE_API_KEY` is set in your environment, `cn <tool>` can use it without a saved key.

**3. Check your setup**

```bash theme={null}
cn doctor
```

`cn doctor` lists your installed tools and confirms your key. Run `cn doctor <tool>`, such as `cn doctor pi`, to send a live test request through that tool's route.

**4. Start a tool**

```bash theme={null}
cn claude
```

Replace `claude` with `codex`, `opencode`, or `pi`. Add `--model <id>` to pick a model for this session, and put the tool's own arguments after `--`:

```bash theme={null}
cn pi --model claude-sonnet-4-6 -- -p "Reply with the word ok"
```

Requests made through `cn` use your Concentrate API key and are billed at API rates. Subscription logins you already have in these tools stay saved and aren't used while you run through `cn`.

> [!NOTE]
>
> Costs shown inside a coding tool are estimates. Your [dashboard](https://concentrate.ai/dashboard) always shows what you're actually billed.

## Choose Models

`cn` lists each model once and Concentrate picks the provider.

```bash theme={null}
cn models                         # Browse the catalog
cn models pi --search sonnet      # Search the models a tool can use
cn model claude                   # Change a tool's default model
```

New models come from the live catalog and appear in `cn <tool>` within an hour. You don't need to update `cn` to use them.

## Use a Tool's Normal Command

`cn configure` saves Concentrate in the tool's own settings, so you can run `claude`, `codex`, `opencode`, or `pi` directly:

```bash theme={null}
cn configure pi
```

This needs a key saved with `cn setup` or `cn key`; a key set only in `CONCENTRATE_API_KEY` isn't enough. Restart the tool afterward. To switch back, run `cn reset <tool>`. It restores your earlier settings and keeps changes you made since.

* Codex, OpenCode, and pi keep a copy of your key in their own settings, readable only by you. Claude Code gets the key from `cn` when it starts.
* Configured tools keep a copy of the model list. Run `cn refresh` to add new models and prices.

## Resume a Conversation

Run the resume command from the project folder where the conversation started:

```bash theme={null}
cn claude resume                # Pick from saved conversations
cn claude continue              # Continue the latest one
cn codex resume <session-id>
cn opencode --session <id>
cn pi resume
```

A resumed conversation starts on the tool's default model. Add `--model <id>` to use another one, and choose a model whose context window fits the conversation.

You can also resume a conversation after reaching a subscription's usage limit. New requests then go through Concentrate at API rates, and your subscription login stays saved.

## Keep cn Up to Date

`cn` checks for a new version once a day and offers it the next time you start `cn`. You can also update at any time:

```bash theme={null}
cn update            # Update cn, then refresh the tools you configured
cn update --check    # Only check for a newer version
cn changelog         # See what changed in each release
```

Installing or updating `cn` also refreshes the tools you configured. Set `CN_NO_UPDATE_CHECK=1` to turn off the update prompt.

## Tool Notes

> [accordion] Claude Code
>
> * Use Claude models or any other model in the Concentrate catalog.
> * **Auto mode safety checks:** with Claude models, the checks that review actions in auto mode are free. With other models, those checks run on the model you're using and are charged at that model's price. Set `CLAUDE_CODE_AUTO_MODE_MODEL` to use a different model for them.
> * Context window, output limits, and reasoning effort follow the model you pick, including when you switch models in a session. This needs Claude Code 2.1.287 or newer.
> * `cn claude` doesn't change your regular Claude Code settings, even if you switch models inside the session.
> * Claude.ai connectors belong to a subscription login, so they're off while you run through `cn`.
> * Claude Code estimates cost from its own price list, so `/cost` can be wrong for non-Claude models. Your [dashboard](https://concentrate.ai/dashboard) shows the actual charges.

> [accordion] Codex
>
> * Codex works with OpenAI models for now. Pick one with `cn model codex`.
> * `cn` doesn't change your Codex login or default model. Run `codex` for your ChatGPT subscription and `cn codex` for Concentrate.
> * The first time you run `cn codex`, it offers to set up plain `codex resume` so it can reopen conversations started through `cn`. This adds only the Concentrate provider. Undo it with `cn reset codex`.
> * `cn codex` starts Codex without its shared background server, so closed conversations don't show up as open elsewhere.

> [accordion] OpenCode and pi
>
> * Both tools show cost estimates based on Concentrate's prices. They're estimates: a model can be offered by several providers at different prices, so a session's estimate can differ from what you're billed. Your [dashboard](https://concentrate.ai/dashboard) always shows the actual charges.
> * `cn pi` keeps your pi extensions, skills, and MCP configuration.
> * `cn pi` and `cn configure pi` need pi 0.77 or newer. Check with `pi --version` and update with `pi update self`.

> [accordion] Cursor (work in progress)
>
> * Quit Cursor completely before running `cn configure cursor` or `cn reset cursor`, and open it once beforehand so its settings exist.
> * This sets up the Cursor desktop editor, not the Cursor command-line tool. Tab completions keep using Cursor's own models.
> * Cursor stores your key and sends requests through Cursor's servers before they reach Concentrate.
> * Setup needs `sqlite3`, which is included with macOS.

## Your Key and Privacy

* `cn` stores your key in `~/.config/concentrate-cli/`, readable only by your user. Set `CN_CONFIG_HOME` to use another folder.
* The key is never passed on the command line, where other programs could read it.
* `cn key` replaces the saved key and updates the copies in configured tools. `cn logout` removes the key and those copies.

## Command Reference

| Command | What it does |
| - | - |
| `cn` | Open the launcher |
| `cn <tool>` | Start a tool through Concentrate |
| `cn <tool> resume` | Resume a saved conversation |
| `cn setup` | Save your API key |
| `cn configure <tool>` | Use Concentrate in a tool's normal command |
| `cn reset <tool>` | Switch a tool back |
| `cn model [<tool>]` | Show or change default models |
| `cn models [<tool>]` | Browse available models |
| `cn config` | Show key status and default models |
| `cn key` | Replace your saved API key |
| `cn logout` | Remove your saved API key |
| `cn doctor [<tool>]` | Check your setup, or test a tool's live route |
| `cn update` | Update `cn` and refresh configured tools |
| `cn refresh` | Refresh configured tools with the latest models and prices |
| `cn changelog` | Show what changed in each release |
| `cn settings` | Open interactive settings |

Run `cn --help` for every option.

## Remove the CLI

Run `cn reset <tool>` for each tool you configured, then clear what `cn` saved and delete it:

```bash theme={null}
cn reset --yes
rm -rf ~/.local/bin/cn ~/.local/share/concentrate-cli
```

`cn reset --yes` keeps saved pi conversations. Add `--sessions` to remove them too.

## Troubleshooting

> [accordion] cn: command not found
>
> Add `~/.local/bin` to your `PATH` using the line the installer printed, then open a new terminal.

> [accordion] Node.js 18.18+ is required
>
> Install a current Node.js release, then run the installer again.

> [accordion] No API key found, or the key is rejected (401)
>
> Run `cn setup` to save a key, or `cn key` to replace one. Check that it matches a key at [concentrate.ai/api-keys](https://concentrate.ai/api-keys). A 402 response means the account needs credits.

> [accordion] New models are missing in a configured tool
>
> Tools set up with `cn configure` keep a copy of the model list. Run `cn refresh`. `cn <tool>` always uses the current list.

> [accordion] cn needs pi 0.77 or newer
>
> Run `pi update self`, then start `cn pi` again.

> [accordion] Codex is limited to OpenAI models
>
> Pick a `gpt-*` model with `cn model codex`.

> [accordion] Something else is wrong
>
> Run `cn --version` and `cn doctor`, then email the output to [support@concentrate.ai](mailto:support@concentrate.ai).

## Next Steps

> [card] [Available Models](https://concentrate.ai/docs/api-reference/endpoint/list-models.md)
>
> Browse the model catalog.

> [card] [Prompt Caching](https://concentrate.ai/docs/api-reference/endpoint/prompt-caching.md)
>
> Learn how caching lowers the cost of long sessions.
