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

# Codex CLI Integration Guide

> Configure OpenAI Codex CLI with Infercom's EU sovereign inference. Agentic coding assistant with Responses API support and full GDPR compliance.

[Codex CLI](https://github.com/openai/codex) is OpenAI's open-source agentic coding assistant that runs in your terminal. It can read files, write code, run commands, and iterate on its work using the Responses API.

<Info>
  **Requires Responses API** - Codex CLI uses the `/v1/responses` endpoint which Infercom supports with MiniMax-M2.7.
</Info>

## Prerequisites

* Node.js 18 or later
* npm or yarn
* [Infercom API key](https://cloud.infercom.ai/apis)

## Installation

```bash theme={null}
npm install -g @openai/codex
```

Verify installation:

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

<Warning>
  **macOS users:** If macOS blocks the binary as "malware", go to **System Preferences > Security & Privacy** and click "Allow Anyway", or run:

  ```bash theme={null}
  xattr -d com.apple.quarantine $(which codex)
  ```
</Warning>

## Configuration

Codex CLI supports custom providers via a TOML configuration file.

### Step 1: Set Environment Variable

```bash theme={null}
export INFERCOM_API_KEY="your-infercom-api-key"
```

<Tip>
  Add this to your shell profile (`~/.bashrc`, `~/.zshrc`) for persistence.
</Tip>

### Step 2: Create Config File

Create `~/.codex/config.toml`:

```toml theme={null}
# Define Infercom as a provider
[model_providers.infercom]
name = "Infercom (EU Sovereign)"
base_url = "https://api.infercom.ai/v1"
env_key = "INFERCOM_API_KEY"
wire_api = "responses"

# Default profile using MiniMax-M2.7
model_provider = "infercom"
model = "MiniMax-M2.7"
```

<Tip>
  For complex tasks requiring deeper reasoning, Codex CLI supports profiles with different models. You can use a frontier model (Claude, GPT, Gemini) for planning and MiniMax-M2.7 for execution. See [Codex documentation](https://github.com/openai/codex) for profile configuration.
</Tip>

### Step 3: Verify Setup

Run Codex in any project directory:

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

You should see Codex start with:

```
model: MiniMax-M2.7
provider: infercom
```

## Model

Use `MiniMax-M2.7` - optimized for agentic coding with 192K context and built-in reasoning.

## Usage

### Interactive Mode

Start Codex in your project directory:

```bash theme={null}
cd your-project
codex
```

Type your request and Codex will:

* Read relevant files
* Write or edit code
* Run terminal commands
* Iterate until the task is complete

### Example Tasks

* "Add error handling to the login function"
* "Write unit tests for the User class"
* "Refactor this file to use async/await"
* "Find and fix the bug causing the test to fail"

### Non-Interactive Mode

For scripted or one-shot use, use the `exec` subcommand:

```bash theme={null}
codex exec "Add input validation to auth.py"
```

## Configuration Options

Full `~/.codex/config.toml` reference:

```toml theme={null}
# Default model to use
model = "MiniMax-M2.7"

# Provider to use
model_provider = "infercom"

# Approval mode: "suggest" (default), "auto-edit", or "full-auto"
approval_mode = "suggest"

# Sandbox mode for command execution
sandbox = "docker"  # or "none" to disable

[model_providers.infercom]
name = "Infercom (EU Sovereign)"
base_url = "https://api.infercom.ai/v1"
env_key = "INFERCOM_API_KEY"
wire_api = "responses"
```

### Approval Modes

| Mode        | Behavior                                              |
| ----------- | ----------------------------------------------------- |
| `suggest`   | Shows diffs and asks before applying (default)        |
| `auto-edit` | Automatically applies file changes, asks for commands |
| `full-auto` | Automatically applies all changes                     |

## Troubleshooting

### Connection Errors

Verify your configuration:

```bash theme={null}
# Check API key is set
echo $INFERCOM_API_KEY

# Test API directly
curl -s https://api.infercom.ai/v1/responses \
  -H "Authorization: Bearer $INFERCOM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"MiniMax-M2.7","input":"Hello"}' | jq .status
```

Expected output: `"completed"`

### Model Not Found

Ensure the model name is exact (case-sensitive): `MiniMax-M2.7`

### Slow Responses

MiniMax-M2.7 runs at 400+ tokens/sec. If responses seem slow:

1. Check your network connection
2. Large context (many files) increases processing time
3. First request may be slower due to model loading

## Why Codex CLI with Infercom?

| Feature               | Benefit                                         |
| --------------------- | ----------------------------------------------- |
| **EU Sovereign**      | Data processed in Germany, GDPR compliant       |
| **Responses API**     | Native support for Codex's agentic architecture |
| **Fast inference**    | 400+ tokens/sec with MiniMax-M2.7               |
| **No vendor lock-in** | Open-source tool, standard API                  |

## Next Steps

* [Aider](/en/agentic-coding/aider) - Alternative terminal-based tool
* [OpenCode](/en/agentic-coding/opencode) - Modern TUI with similar features
* [Responses API](/en/features/responses-api) - API documentation for custom integrations
