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

# Codex (CLI & Desktop)

> Set up Codex (CLI & Desktop) with TrueFoundry AI Gateway using the setup wizard.

Connect Codex (CLI & Desktop) to your organization's gateway. The wizard configures its models and optional MCP servers and Skills.

The Codex CLI and desktop app share configuration. Run setup once to configure both.

## Run setup

With Codex installed, [install the setup tool](https://www.truefoundry.com/docs/ai-gateway/personal-setup.md#install-the-setup-tool), then run:

```bash theme={"dark"}
tfy-local-ai-setup personal codex
```

Sign in to your organization, choose the models recommended by your administrator and any MCP servers or Skills you need, then review and approve the changes. You can skip MCP servers and Skills. See the [overview](https://www.truefoundry.com/docs/ai-gateway/personal-setup.md#connect-your-agents) for the shared wizard walkthrough.

## Choose a compatible model

Choose a Virtual Model whose slug is an OpenAI model ID, such as `gpt-5.4`, rather than a provider-prefixed ID. Ask your administrator for a compatible model if none is listed. See [why Codex needs a Virtual Model](https://www.truefoundry.com/docs/ai-gateway/openai-codex-cli.md#why-you-need-a-virtual-model).

![Codex default model settings](https://mintcdn.com/truefoundry/6Os5PQcPcHaNsbQT/images/ai-gateway/personal-setup/codex-models.png?fit=max\&auto=format\&n=6Os5PQcPcHaNsbQT\&q=85\&s=cf4eb9a41293ec757c92f31cdd0a76b2)

Example default model shared by the CLI and desktop app.

## Open Codex

* **CLI:** open a new terminal and launch `codex`.
* **Desktop:** open or restart the Codex app and start a new conversation with the configured model.

Follow any remaining actions in the setup completion summary.

## Optional: authorize MCP servers

For servers requiring sign-in, run this in a terminal, replacing `<server-name>` with the configured server's name:

```bash theme={"dark"}
codex mcp login <server-name>
```

## Verify the connection

Select your configured model in a new conversation and ask: `Reply exactly TFY-CHAT-OK. Do not use tools.` Confirm that a response arrives without an authentication or model error. Then [verify the request in the gateway](https://www.truefoundry.com/docs/ai-gateway/personal-setup.md#verify-the-connection).

For manual configuration and advanced options, see the [Codex (CLI & Desktop) integration guide](https://www.truefoundry.com/docs/ai-gateway/openai-codex-cli.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.