---
title: "Use Codex CLI with Haimaker: Full Setup Guide (2026)"
description: "Configure OpenAI's Codex CLI to route through Haimaker for agentic coding with GPT-5.3-Codex and hundreds of other models. Copy-paste config.toml included."
date: 2026-05-16
updatedDate: 2026-06-26
location: San Francisco, CA – May 16th, 2026
image: /images/how-to-add-haimaker-codex-cli-hero.jpg
keywords: "codex cli haimaker, codex cli custom provider, codex config.toml, gpt-5.3-codex, codex cli setup, openai codex haimaker"
faq:
  - question: "Can Codex CLI use a provider other than OpenAI?"
    answer: "Yes. Codex CLI supports custom model providers through its config.toml file. Set model_provider to a custom block pointing at any OpenAI-compatible endpoint — including Haimaker at https://api.haimaker.ai/v1 — and Codex routes all requests there instead of OpenAI directly."
  - question: "How do I configure Codex CLI to use Haimaker?"
    answer: "Fastest is 'npx -y @haimaker/connect --codex', which writes ~/.codex/config.toml for you. To configure it by hand: edit ~/.codex/config.toml, set model_provider = \"haimaker\" and model = \"openai/gpt-5.3-codex\", then add a [model_providers.haimaker] block with base_url = \"https://api.haimaker.ai/v1\" and env_key = \"HAIMAKER_API_KEY\". Export HAIMAKER_API_KEY in your shell profile and run codex."
  - question: "Why route Codex CLI through Haimaker instead of OpenAI directly?"
    answer: "Haimaker gives you one API key for hundreds of models, centralized budget controls for teams, usage visibility across developers, and the ability to switch between Codex model versions or entirely different models by editing one line of config — no Codex reinstall needed."
---

[Codex CLI](https://github.com/openai/codex) is OpenAI's open-source local coding agent that runs in your terminal. It supports custom model providers, so you can point it at [Haimaker](https://haimaker.ai) and get one API key, budget controls, and hundreds of models behind Codex's agentic workflow without changing how you work.

This guide covers the one-command setup with `@haimaker/connect`, then the full manual `config.toml` walkthrough if you'd rather wire it by hand.

## What is Codex CLI?

Codex CLI is OpenAI's first-party terminal coding agent. It reads your codebase, edits files, runs commands, and iterates on tasks autonomously. Out of the box it talks to OpenAI directly, but the `config.toml` provider system lets you swap in any OpenAI-compatible API. Haimaker is one of them: it routes requests across providers with unified pricing and a single key.

## Quick Start

The quickest path skips the config file entirely. Point Codex at Haimaker in a single command:

```bash
export HAIMAKER_API_KEY=your-haimaker-key
npx -y @haimaker/connect --codex
```

[`@haimaker/connect`](/connect) writes the `model_provider` setting and the `[model_providers.haimaker]` block into `~/.codex/config.toml`, verifies the key, and exits — no proxy or router stays in the request path. Add `--model openai/gpt-5.3-codex` (or any ID from the [model hub](https://haimaker.ai/models)) to pin a model, or `--pick-model` to choose interactively. Then run `codex`. To undo it, run `npx @haimaker/connect --uninstall --codex`.

Prefer to wire it by hand, or want to understand each setting? The steps below set up the same thing manually.

#### Step 1: Install Codex CLI

Follow the [Codex CLI installation instructions](https://github.com/openai/codex) to install the CLI on your system.

#### Step 2: Get your Haimaker API key

1. Sign up or log in at [haimaker.ai](https://haimaker.ai)
2. Grab your API key from the dashboard
3. Keep it handy — you'll add it to your shell environment in Step 4

#### Step 3: Configure Codex for Haimaker

Codex uses a `config.toml` file, typically located at `~/.codex/config.toml`. Create or edit this file with the following configuration:

```toml
model_provider = "haimaker"
model_reasoning_effort = "high"
model = "openai/gpt-5.3-codex"

[model_providers.haimaker]
name = "haimaker"
base_url = "https://api.haimaker.ai/v1"
env_key = "HAIMAKER_API_KEY"
```

#### Step 4: Set your API key

Export your Haimaker API key in your shell profile:

```bash
# Add to ~/.zshrc, ~/.bashrc, or ~/.config/fish/config.fish
export HAIMAKER_API_KEY="your-haimaker-api-key"
```

Codex reads the key from the environment variable named in `env_key` (here, `HAIMAKER_API_KEY`). Make sure it's set in your current shell before starting Codex — open a new terminal or run `source ~/.zshrc` after editing.

#### Step 5: Start Codex

Navigate to your project directory and run:

```bash
cd /path/to/your/project
codex
```

Your requests now route through Haimaker.

## Configuration Reference

#### Core Settings

| Setting | Description | Example |
| ------- | ----------- | ------- |
| `model_provider` | Provider block to use for model requests | `"haimaker"` |
| `model` | Model ID from Haimaker's model hub | `"openai/gpt-5.3-codex"` |
| `model_reasoning_effort` | Reasoning effort level for Codex models | `"low"`, `"medium"`, `"high"`, `"xhigh"` |
| `show_raw_agent_reasoning` | Whether to display reasoning tokens in the UI | `true` or `false` |
| `personality` | Agent personality preset | `"pragmatic"`, `"helpful"`, etc. |

#### Haimaker Provider Block

```toml
[model_providers.haimaker]
name = "haimaker"
base_url = "https://api.haimaker.ai/v1"
env_key = "HAIMAKER_API_KEY"
```

- **`base_url`**: Haimaker's OpenAI-compatible API endpoint. Use `https://api.haimaker.ai/v1`.
- **`env_key`**: The environment variable name Codex reads your API key from.

#### Project Trust Levels

Codex supports per-project trust levels. Add project paths to control what the agent can access:

```toml
[projects."/path/to/trusted/project"]
trust_level = "trusted"

[projects."/path/to/untrusted/project"]
trust_level = "untrusted"
```

- **`trusted`**: Agent has full access (run commands, edit files).
- **`untrusted`**: Agent has restricted access for safety.

## Why use Haimaker with Codex CLI?

#### Provider failover

Haimaker routes requests across multiple upstream providers. If one is unavailable or rate-limited, Haimaker can fail over to another, keeping long coding sessions uninterrupted.

#### Organizational controls

For teams, Haimaker provides centralized budget management. Set spending limits, allocate credits, and avoid surprise cost overruns across every developer running Codex.

#### Usage visibility

Track Codex usage from your Haimaker dashboard — costs, token usage, and request patterns in one place, instead of reconciling per-developer OpenAI bills.

#### Model flexibility

Switch between Codex versions (`openai/gpt-5.2-codex`, `openai/gpt-5.3-codex`) or jump to an entirely different model without touching your Codex install. Just edit one line in `config.toml`. Haimaker is typically about 5% cheaper than going to providers directly, which adds up fast on agentic workloads that burn tokens.

## Adding more models

Codex isn't limited to a single model. Point `model` at anything in [Haimaker's model hub](https://haimaker.ai/models) — Claude, Gemini, GLM, Qwen, DeepSeek, and more — using the exact model ID from the hub:

```toml
model = "anthropic/claude-sonnet-4-6"
```

Model IDs follow the format shown on the hub. Copy them exactly; case and formatting matter.

## Troubleshooting

**Auth errors.** Make sure `HAIMAKER_API_KEY` is exported in the shell you launched Codex from. Test the key directly:

```bash
curl https://api.haimaker.ai/v1/models \
  -H "Authorization: Bearer $HAIMAKER_API_KEY"
```

**Model not found.** Verify the model ID against [haimaker.ai/models](https://haimaker.ai/models). Use the exact format (e.g., `openai/gpt-5.3-codex`), not a shortened name.

**Config not picked up.** Confirm `config.toml` is at `~/.codex/config.toml` and that `model_provider` matches the `[model_providers.<name>]` block name exactly.

<a href="https://app.haimaker.ai/sign-up?utm_source=blog&utm_medium=cta&utm_campaign=codex_cli" class="cta-button">GET YOUR HAIMAKER API KEY</a>

## Resources

- [Codex CLI on GitHub](https://github.com/openai/codex)
- [Haimaker model hub](https://haimaker.ai/models)
- [Connect any coding agent in one command](/connect)
- [Add Haimaker to OpenCode](/blog/how-to-add-haimaker-opencode)

---

This same pattern works for any OpenAI-compatible API. Swap the `base_url` and model names and Codex will route wherever you point it.

Questions? Hit us up in [Discord](https://discord.gg/6fG89cbZ).
