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

# Codex (Beta)

> Use models on Concentrate with the Codex CLI

<Info>
  Codex is currently unsupported and this integration is not functional at this time.
</Info>

## Concentrate and Codex

Codex is a command-line coding assistant from OpenAI that supports OpenAI-compatible APIs. By pointing Codex at Concentrate, you get a number of important advantages over connecting to OpenAI directly.

### Unified Spend Management

Concentrate offers centralized budget management for groups and companies. You can prevent unforeseen cost overruns and assign limits to team members all through the Concentrate dashboard. This is particularly helpful if many developers use Codex throughout your company.

### Observability and Insights

With Concentrate, you can monitor all of your team's Codex activity through the dashboard. This includes usage statistics, top spenders, providers and models, latency and more.

## Prerequisites

Before you begin, ensure you have:

* A Concentrate AI account with an active API key (starts with `sk-cn`)
* [Codex CLI](https://github.com/openai/codex) installed

## Quick Setup

```bash Bash theme={null}
curl -fsSL https://concentrate.ai/scripts/setup-codex.sh | bash
```

### Verify Installation

After running the setup script:

1. **Restart your terminal** or source your shell profile:
   ```bash theme={null}
   # For bash (Linux)
   source ~/.bashrc
   # For bash (macOS)
   source ~/.bash_profile
   # For zsh
   source ~/.zshrc
   ```
2. **Launch Codex:**
   ```bash theme={null}
   codex
   ```
   The CLI should start without errors and show your configured model.

## Manual Setup

If you prefer to configure Codex manually or the automated script doesn't work for your environment:

<Steps>
  <Step title="Set your API key">
    Add the following to your shell profile (`~/.bashrc`, `~/.zshrc`, etc.):

    ```bash theme={null}
    export CONCENTRATE_API_KEY="sk-cn-v1-..."
    ```

    Then reload your shell:

    ```bash theme={null}
    source ~/.bashrc  # or ~/.zshrc
    ```
  </Step>

  <Step title="Configure ~/.codex/config.toml">
    Create or edit `~/.codex/config.toml`:

    ```toml theme={null}
    model_provider = "concentrate"
    model = "openai/gpt-5.3-codex"

    [model_providers.concentrate]
    name = "concentrate"
    base_url = "https://api.concentrate.ai/v1"
    env_key = "CONCENTRATE_API_KEY"
    ```
  </Step>

  <Step title="Verify the connection">
    Launch Codex in a project directory:

    ```bash theme={null}
    cd /path/to/project
    codex
    ```

    You should see the model name from your config displayed and be able to interact with the assistant.
  </Step>
</Steps>

## Remove Concentrate AI

```bash Bash theme={null}
curl -fsSL https://concentrate.ai/scripts/uninstall-codex.sh | bash
```

## Troubleshooting

<AccordionGroup>
  <Accordion title="API key not found error" icon="key">
    If you see an error about a missing API key:

    1. Verify the environment variable is set:
       ```bash theme={null}
       echo $CONCENTRATE_API_KEY
       ```
    2. Make sure you've sourced your shell profile:
       ```bash theme={null}
       source ~/.bashrc  # or appropriate file
       ```
    3. Confirm `env_key` in your `config.toml` is set to `"CONCENTRATE_API_KEY"` (not `"OPENAI_API_KEY"`)
  </Accordion>

  <Accordion title="Invalid API key error" icon="triangle-exclamation">
    If your API key is rejected:

    1. Verify the key in your [dashboard](https://concentrate.ai)
    2. Ensure there are no extra spaces or quotes in the environment variable
    3. Check that the key starts with `sk-cn`
  </Accordion>

  <Accordion title="Connection errors" icon="wifi">
    If you cannot connect to the API:

    1. Verify `base_url` in your `config.toml` is set correctly:
       ```toml theme={null}
       base_url = "https://api.concentrate.ai/v1"
       ```
    2. Test the connection manually:
       ```bash theme={null}
       curl https://api.concentrate.ai/v1/models \
         -H "Authorization: Bearer $CONCENTRATE_API_KEY"
       ```
    3. Check your internet connection and firewall settings
  </Accordion>
</AccordionGroup>

## Next Steps

<CardGroup cols={2}>
  <Card title="Codex CLI on GitHub" icon="github" href="https://github.com/openai/codex">
    View source, report issues, and follow development
  </Card>

  <Card title="Available Models" icon="layer-group" href="/docs/api-reference/endpoint/list-models">
    Browse all supported models
  </Card>

  <Card title="API Reference" icon="code" href="/docs/api-reference/introduction">
    Explore the full API capabilities
  </Card>

  <Card title="Get Support" icon="life-ring" href="mailto:support@concentrate.ai">
    Contact our support team
  </Card>
</CardGroup>
