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

# Codex CLI

> Point the OpenAI Codex CLI at Venice models with a local config.toml so coding agent requests run through Venice's private, OpenAI-compatible API.

This guide shows how to run OpenAI Codex CLI with Venice using Codex's official config paths: `~/.codex/config.toml` (user-level) or `.codex/config.toml` (project-level).

<CardGroup cols={3}>
  <Card title="Simple Setup" icon="gear">
    One config file in your project
  </Card>

  <Card title="OpenAI Compatible" icon="plug">
    Uses Venice's OpenAI-compatible API
  </Card>

  <Card title="Model Flexibility" icon="microchip">
    Swap in any supported Venice text model
  </Card>
</CardGroup>

***

## Prerequisites

* A Venice API key from [venice.ai/settings/api](https://venice.ai/settings/api)
* Codex CLI installed and working on your machine

***

## Setup

<Steps>
  <Step title="Create the project config path">
    From your project root:

    ```bash theme={"system"}
    mkdir -p .codex
    ```
  </Step>

  <Step title="Create .codex/config.toml">
    Create the file and paste the configuration below:

    ```toml theme={"system"}
    #:schema https://developers.openai.com/codex/config-schema.json

    model = "openai-gpt-54" # use any Venice model
    model_provider = "venice"
    model_reasoning_effort = "high"
    personality = "pragmatic"
    sandbox_mode = "workspace-write"

    [model_providers.venice]
    name = "Venice"
    base_url = "https://api.venice.ai/api/v1/"
    experimental_bearer_token = "YOUR VENICE API KEY"
    wire_api = "responses"
    ```
  </Step>

  <Step title="Replace the two placeholders">
    Update:

    * `model` with the Venice model ID you want to use
    * `experimental_bearer_token` with your real Venice API key

    You can browse available model IDs in the [text model catalog](/models/text).
  </Step>

  <Step title="Run Codex CLI normally">
    Start Codex CLI from the same project. It will load `.codex/config.toml` (for trusted projects) and route requests through Venice.
  </Step>
</Steps>

***

## Official Codex Config Locations

* **User defaults**: `~/.codex/config.toml`
* **Project overrides**: `.codex/config.toml` (loaded only for trusted projects)

If you want Venice settings to apply everywhere, put the same config in `~/.codex/config.toml`.

***

## Configuration Precedence (Highest First)

1. CLI flags and `--config` overrides
2. Profile values (`--profile <name>`)
3. Project config layers (`.codex/config.toml`, closest directory wins)
4. User config (`~/.codex/config.toml`)
5. System config (`/etc/codex/config.toml`, Unix)
6. Built-in defaults

***

## Notes

* Keep your API key private and never commit real keys to git.
* Codex ignores project `.codex/` config when a project is marked untrusted.
* If you switch models, only update the `model` field.
* The `wire_api = "responses"` setting is required for this provider setup.

***

## Resources

<CardGroup cols={2}>
  <Card title="Venice API Reference" icon="book" href="/api-reference/api-spec">
    Full endpoint and parameter docs
  </Card>

  <Card title="Venice Text Models" icon="list" href="/models/text">
    Available model IDs
  </Card>
</CardGroup>
