# Codex - Documentation

> Connect Codex to Novita's OpenAI-compatible LLM API endpoint.

> For the complete documentation index, see [llms.txt](/llms.txt). Markdown is available with `Accept: text/markdown` and `.md` URL variants.

Source: /docs/guides/codex

# Codex

Connect Codex to Novita’s OpenAI-compatible LLM API endpoint.

Codex is an AI coding tool that runs in your terminal. You can connect Codex to Novita’s OpenAI-compatible LLM API endpoint and use Novita models for code understanding, generation, refactoring, and debugging tasks.

Codex currently supports the Responses API only. Configure `wire_api = "responses"` as shown below, and do not switch this integration to Chat Completions mode.

##

[​](#prerequisites)

Prerequisites

Before you begin, prepare the following values:

- API key: Create or copy an API key from [Key Management](https://novita.ai/settings/key-management).

- Base URL: `https://api.novita.ai/openai/v1`

- Model ID: Copy the model ID you want to use from the Model Hub, such as `deepseek/deepseek-v3.1`.

Keep your API key private. Use it only in your local Codex configuration and never commit it to a Git repository.

##

[​](#install-codex)

Install Codex

Before installing Codex, make sure [Node.js 18 or higher](https://nodejs.org/en/download/) is installed on your machine.
On macOS, if you use Homebrew, you can install Node.js with:

```
brew install node
```

Check your Node.js and npm versions:

```
node -v
npm -v
```

Install the Codex CLI:

```
npm install -g @openai/codex
```

Check the Codex version:

```
codex --version
```

##

[​](#configure-your-api-key)

Configure your API key

Open your shell configuration file, for example `~/.zshrc`:

```
nano ~/.zshrc
```

Add the following environment variable:

```
export NOVITA_API_KEY=""
```

Reload your shell configuration and confirm the variable is available:

```
source ~/.zshrc
echo $NOVITA_API_KEY
```

##

[​](#configure-codex)

Configure Codex

Open the Codex configuration file:

```
mkdir -p ~/.codex
nano ~/.codex/config.toml
```

Add the following configuration, and replace `model` with the Novita model ID you want to use:

```
model_provider = "novita"
model = "deepseek/deepseek-v3.1"

[model_providers]
[model_providers.novita]
name = "Novita"
wire_api = "responses"
requires_openai_auth = true
base_url = "https://api.novita.ai/openai/v1"
env_key = "NOVITA_API_KEY"
```

##

[​](#start-codex)

Start Codex

Go to your project directory and start Codex:

```
cd
codex
```

You can now enter a coding task, for example:

```
Read this project and summarize the main modules.
```

If Codex returns an authentication or model error, check that:

- `NOVITA_API_KEY` is available in the current terminal session.

- `model` exactly matches the Model ID in Novita’s Model Hub.

- `base_url` is set to `https://api.novita.ai/openai/v1`.

Last modified on June 25, 2026
