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

# Codex CLI

> Use Codex CLI with NagaAI by adding a custom provider that points to NagaAI's OpenAI-compatible API.

Codex CLI is OpenAI's open-source local coding agent that runs in your terminal. You can connect it to NagaAI by defining a custom provider in `~/.codex/config.toml` and using your **NagaAI API key**.

## Setup

<Steps>
  <Step title="Install Codex CLI">
    Follow the official installation instructions: [openai/codex](https://github.com/openai/codex)
  </Step>

  <Step title="Create a NagaAI API key">
    Create an API key in the [NagaAI Dashboard](https://naga.ac/dashboard).

    <Info>
      If you’re new to NagaAI, follow the [Quickstart](/get-started/quickstart) first.
    </Info>
  </Step>

  <Step title="Configure Codex CLI to use NagaAI">
    Open `~/.codex/config.toml` and add a custom provider that points to NagaAI’s OpenAI-compatible API:

    ```toml theme={null}
    model_provider = "naga-ai"
    model_reasoning_effort = "high"
    model = "gpt-5.3-codex"

    [model_providers.naga-ai]
    name = "naga-ai"
    base_url = "https://api.naga.ac/v1"
    env_key = "NAGAAI_API_KEY"
    ```

    <Note>
      `gpt-5.3-codex` is one example starter model. You can also use any NagaAI model that supports tools. See [models with tools support](https://naga.ac/models?parameters=tools).
    </Note>
  </Step>

  <Step title="Set your API key">
    Codex reads the API key from the environment variable named in `env_key`.

    <Tabs>
      <Tab title="Shell (macOS/Linux/WSL)">
        ```bash theme={null}
        export NAGAAI_API_KEY="YOUR_NAGAAI_API_KEY"
        ```
      </Tab>

      <Tab title="Windows PowerShell">
        ```powershell theme={null}
        $env:NAGAAI_API_KEY="YOUR_NAGAAI_API_KEY"
        ```
      </Tab>
    </Tabs>

    <Warning>
      Keep real API keys out of version control and shell history where possible.
    </Warning>
  </Step>

  <Step title="Start Codex">
    In your project directory:

    ```bash theme={null}
    codex
    ```

    Your requests will be sent through NagaAI using the provider defined in `config.toml`.
  </Step>
</Steps>

## Notes

* Config file: `~/.codex/config.toml`
* Base URL: `https://api.naga.ac/v1`
* API key env var: `NAGAAI_API_KEY`
* Example starter model: `gpt-5.3-codex` ([browse tools-capable models](https://naga.ac/models?parameters=tools))
* If you use Codex project trust levels, configure them in the same `config.toml` file

## Try it

* “Summarize this repository: structure, build system, and entry points.”
* “Find where feature X is implemented and list the relevant files.”
* “Run tests and fix the first failing test.”
* “Refactor module Y and update all call sites.”
