---
title: "Codex CLI with EU-hosted models · Setup guide"
description: "Run OpenAI's Codex CLI on open-weight models processed in EU data centres. Add a model_providers block to config.toml and keep code in Europe."
canonical: "https://inference.eu/integrations/openai-codex/"
language: "en"
---

Coding agents · OpenAI Codex CLI

# Use OpenAI Codex CLI with open-source models hosted in the EU

Codex CLI is OpenAI's open-source coding agent for the terminal. It supports custom model providers in its config.toml, so you can keep the agent and run it on open-weight models at inference.eu, processed in European data centres and covered by a GDPR data processing agreement.

[Contact sales](https://inference.eu/contact/)[Setup](#setup)

1.  01API format: OpenAI
2.  02EU data centres
3.  03Covered by one DPA

## Set it up in a few minutes

1.  1

    Create an API key in your inference.eu account and export it as `INFERENCE_EU_API_KEY`.

2.  2

    Install Codex CLI, for example with `npm install -g @openai/codex`.

3.  3

    Add the `[model_providers.inference-eu]` table to `~/.codex/config.toml` and set `model_provider = "inference-eu"`.

4.  4

    Set `model` to an inference.eu model id such as `qwen3-coder-480b-a35b-instruct`.

5.  5

    Run `codex` in your repository and give it a small task to confirm that commands and file edits work.

~/.codex/config.toml

```
model = "qwen3-coder-480b-a35b-instruct"
model_provider = "inference-eu"

[model_providers.inference-eu]
name = "inference.eu"
base_url = "https://api.inference.eu/v1"
env_key = "INFERENCE_EU_API_KEY"
wire_api = "responses"
```

## What Codex CLI is

Codex CLI is a coding agent from OpenAI that runs locally in your terminal. It reads your code, proposes and applies changes, runs commands inside a sandbox and asks for approval according to the mode you choose. The same agent powers the Codex IDE extension and can be scripted with `codex exec` for CI jobs.

Codex is built to work with OpenAI's models, but its configuration lets you define your own model providers with a base URL and an API key. That is the route to running it on open-weight models hosted in the EU.

## How the configuration works

Custom providers live in `~/.codex/config.toml` under `[model_providers.<id>]`. `base_url` points at inference.eu, `env_key` names the environment variable that holds your key, and `wire_api = "responses"` selects the Responses API, which current Codex versions use for every provider. inference.eu serves the Responses API, so streaming, tool calls and reasoning items work as Codex expects.

Set `model_provider` to the provider id and `model` to the model id. The ids `openai`, `ollama` and `lmstudio` are reserved, which is why the example uses `inference-eu`. Provider settings must sit in your user config: Codex ignores `model_providers` in project-level config files.

## Which models to choose

`qwen3-coder-480b-a35b-instruct` is a good default. It is trained for agentic coding and handles Codex's shell-heavy workflow of reading files, running tests and applying patches. For tasks that need more planning across a large codebase, try `glm-5.3` or `kimi-k3`, both of which follow tool schemas closely.

`gpt-oss-120b` is the closest match to the reasoning style Codex was designed around and responds quickly, which suits quick fixes and `codex exec` runs in CI. Use profiles in config.toml to switch between models without editing the file each time.

## Troubleshooting

If Codex asks you to sign in with ChatGPT, it is still using the built-in `openai` provider. Check that `model_provider` is set at the top level of `~/.codex/config.toml`, not inside a table. A 401 error means `INFERENCE_EU_API_KEY` is not set in the shell that started Codex.

A 404 usually means `base_url` has an extra path; it should end in `/v1`. "Model not found" means the `model` value differs from the inference.eu model id. If the agent stops after one step or prints commands instead of running them, the model is not returning tool calls; switch to one of the coding models above.

## Keeping code and data in the EU

Codex sends model requests from your machine to the provider you configure. With inference.eu as the provider, prompts, file contents and command output are processed in EU data centres and never used for training. We sign a data processing agreement under Article 28 GDPR, share our subprocessor list and bill in euros.

No OpenAI account is needed for this setup. Be aware that features tied to OpenAI's cloud, such as Codex cloud tasks, do not use your custom provider. For a fully EU-based setup, run Codex locally with the custom provider and leave those features off.

## OpenAI Codex CLI

Category

Coding agents

Maker

OpenAI

API format

OpenAI

Processing

EU data centres

Website

[developers.openai.com](https://developers.openai.com/codex)

Documentation

[developers.openai.com](https://developers.openai.com/codex/config-reference)

## OpenAI Codex CLI: common questions

The questions buyers, developers and legal teams ask us most. Something missing? Ask us directly.

Yes. With a custom provider in config.toml and \`env\_key\` pointing at your inference.eu key, Codex sends model requests to inference.eu and does not need a ChatGPT sign-in or an OpenAI API key. Cloud features that run on OpenAI's infrastructure are a separate matter.

Current Codex versions talk to every provider through the Responses API, and \`responses\` is the only supported value. inference.eu serves the Responses API, so tool calls, streaming and reasoning output work with Codex out of the box.

In your user config, \`~/.codex/config.toml\`. Codex ignores \`model\_provider\` and \`model\_providers\` in project-scoped config files, so a block committed to a repository will not take effect. Admins can enforce a provider for everyone with a managed requirements file.

Start with qwen3-coder-480b-a35b-instruct for general coding work. GLM-5.3 and Kimi K3 suit larger refactors, and gpt-oss-120b is quick for small fixes and scripted runs. Test them on a real task in your repository before settling on one.

Codex is still using the default \`openai\` provider. Make sure \`model\_provider = "inference-eu"\` sits at the top of config.toml, before any table header, and that the provider id matches the \`\[model\_providers.inference-eu\]\` table exactly.

Model requests go to the provider in your config, here inference.eu. Codex cloud tasks and other hosted features run on OpenAI's side and are not covered. Keep to local sessions with the custom provider if your code must stay with an EU processor.

Yes. Install Codex on the runner, write the config.toml with the custom provider, store the key as a CI secret exposed as \`INFERENCE\_EU\_API\_KEY\`, and call \`codex exec\` with your prompt. The same model ids work as in interactive sessions.

Define profiles in config.toml, each with its own \`model\` and the same \`model\_provider\`, then start Codex with \`--profile\`. You can also pass \`-m <model id>\` on the command line for a one-off run.

Usually a wrong \`base\_url\`. It should be the inference.eu base URL ending in \`/v1\`, with no \`/responses\` or \`/chat/completions\` suffix, because Codex adds the endpoint path itself. Check for a trailing slash or a typo in the host.

Model requests are processed in EU data centres, never used for training, and covered by an Article 28 GDPR data processing agreement with a published subprocessor list. Combine that with Codex's sandbox and approval modes, and review the setup with your security and data protection teams.

[Ask a question](https://inference.eu/contact/)

## Related

[All integrations](https://inference.eu/integrations/)

-   [Claude CodePoint Claude Code at inference.eu with ANTHROPIC\_BASE\_URL and run it on open-weight models processed in EU data centres. No Anthropic account needed.Coding agents](https://inference.eu/integrations/claude-code/)
-   [OpenCodeRun the OpenCode terminal agent on open-weight models processed in EU data centres. Add one provider block to opencode.json and keep your code in Europe.Coding agents](https://inference.eu/integrations/opencode/)
-   [OpenAI SDK (Python and JavaScript)Point the official OpenAI Python or JavaScript SDK at inference.eu with base\_url and an API key, and call open-weight models processed in the EU.SDKs](https://inference.eu/integrations/openai-sdk/)
-   [AiderRun the Aider pair programmer on open-weight models processed in EU data centres. Two environment variables and the openai/ model prefix are all it takes.Coding agents](https://inference.eu/integrations/aider/)

## Move your AI workloads to EU infrastructure

Tell us which models you use and roughly how much traffic you have. We reply within one working day with pricing and next steps.

-   Reply within one working day
-   Pricing for your volume
-   DPA ready to sign
