# Use Codex with Aperture

Last validated Jun 27, 2026

\[Missing snippet: aperture\_release\_note.mdx]

Configure [Codex][xt-codex] to send requests through [Aperture by Tailscale][kb-aperture] so your organization gets centralized API key management, usage tracking, and session logging.

## Prerequisites

Before you begin, you need:

* An Aperture instance with at least one configured OpenAI-compatible provider, accessible from your device. Refer to [get started with Aperture][kb-get-started] if you have not set this up.
* The Aperture host URL accessible from your device. Use `http://`, not `https://`.
* [Codex][xt-codex] installed on your device.

\[Missing snippet: aperture\_tls\_warning.mdx]

\[Missing snippet: aperture\_any\_provider.mdx]

## Configure Codex

To configure Codex to use Aperture, create or edit the Codex configuration file (`~/.codex/config.toml`) to use the Aperture URL as the `base_url` and set the model to a Codex-compatible model:

```toml
model = "gpt-5.3-codex"
model_provider = "llm-ai-ts-net"
model_reasoning_effort = "high"

[model_providers.llm-ai-ts-net]
name = "Tailscale AI Gateway"
base_url = "http://<aperture-hostname>/v1" # Required: Aperture URL

# Required for Codex models
wire_api = "responses"
```

The `wire_api = "responses"` setting configures Codex to use the OpenAI Responses API format. You do not need to configure an API key because Aperture injects credentials automatically.

> **Note:**
>
> To forward each client's own credential instead of injecting a shared key, set the upstream provider to passthrough mode. Aperture then forwards the credential the client sends. A personal OpenAI platform API key uses the `api.openai.com` endpoint, while a ChatGPT subscription account such as Plus, Pro, or Team uses the ChatGPT backend endpoint and a different configuration. For more information, refer to [Set up passthrough mode][kb-use-passthrough-mode] and [Route a ChatGPT subscription through Aperture][kb-codex-subscriptions].

## Verify the connection

1. Send a test message in Codex.
2. Open the Aperture dashboard at `http://<aperture-hostname>/ui/` and confirm the request appears on the **Logs** page (admin only).

If the request does not appear, refer to the [Aperture troubleshooting guide][kb-aperture-troubleshooting].

\[Missing snippet: aperture\_connect\_next\_steps.mdx]

[kb-aperture-troubleshooting]: /docs/aperture/troubleshooting

[kb-aperture]: /docs/aperture

[kb-codex-subscriptions]: /docs/aperture/how-to/use-passthrough-mode/codex-subscriptions

[kb-get-started]: /docs/aperture/get-started

[kb-use-passthrough-mode]: /docs/aperture/how-to/use-passthrough-mode

[xt-codex]: https://github.com/openai/codex
