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

# Codex

> High-reasoning capabilities for complex tasks and critical reviews

## Overview

Codex is powered by OpenAI's models and offers high-reasoning capabilities for complex tasks and critical reviews.

## Latest Models

* **GPT-6 Astra** - OpenAI's newest model with advanced reasoning capabilities
* **GPT-5.6 Luna** - Fast model for everyday coding work
* **GPT-5.6 Terra** - Balanced default for most tasks
* **GPT-5.6 Sol** - Highest reasoning effort in the 5.6 family
* **GPT-5.5** - Previous generation flagship

## Authentication

Codex supports three authentication methods:

> [tab] OpenAI API Key
>
> **Pay-as-you-go API access**
>
> 1. Get an API key at [OpenAI Platform](https://platform.openai.com/api-keys)
> 2. In [Blocks Dashboard](https://blocks.team), go to **Dashboard** → **Agents**
> 3. Select **Codex** and choose "API Key"
> 4. Paste your API key (starts with `sk-`)

> [tab] OpenAI Subscription
>
> **Connect your ChatGPT Plus/Pro/Team subscription**
>
> 1. In [ChatGPT Security Settings](https://chatgpt.com/#settings/Security), scroll to the bottom and make sure **Enable device code authorization for Codex** is toggled ON
> 2. In [Blocks Dashboard](https://blocks.team), go to **Settings** → **Agents** → **Codex** → **Authentication** and set the authentication method to **Subscription** (or switch to the **Personal** tab there to connect for your user only)
> 3. Click **Sign in with ChatGPT**
> 4. Open the link shown (`auth.openai.com/codex/device`), sign in to ChatGPT, and enter the short code displayed in Blocks
> 5. Return to Blocks — the connection completes automatically within a few seconds. If it does not, click **I've entered the code**
>
> This uses your subscription instead of pay-as-you-go billing. The code is valid for 15 minutes; if it expires, click **Get a new code**. You can connect more than one — see [Multiple Subscriptions](#multiple-subscriptions) below.
>
> > [!NOTE]
> >
> > If the device code authorization toggle is missing or locked, your ChatGPT workspace admin controls it — ask them to turn it on, or use an API key instead.

> [tab] Blocks
>
> **Run on Blocks LLM credits**
>
> 1. In [Blocks Dashboard](https://blocks.team), go to **Settings** → **Agents** → **Codex**
> 2. Set **Authentication Method** to "Blocks"
>
> There is no API key to set. Requests route through the Blocks AI Gateway and usage draws on your Blocks LLM credits.

### Multiple Subscriptions

A workspace can hold up to 10 OpenAI subscriptions. Add them under **Settings** → **Agents** → **Codex** → **Authentication** → **Workspace** → **Add subscription**. Each one is named when you connect it so you can tell them apart in the list. The name cannot be changed afterwards.

For each session, Blocks picks the subscription with the lowest usage, so work spreads across them instead of exhausting one.

Your own subscription under **Settings** → **Agents** → **Codex** → **Authentication** → **Personal** is still a single connection, and it is included in the same selection:

* Sessions you start from the Blocks dashboard use your personal subscription
* Sessions started from GitHub, Slack, Linear, and other external tools use it too, as long as you have [linked that account](https://docs.blocks.team/using-blocks/workspaces/linked-accounts)
* If an external account cannot be matched to a Blocks user, the session uses the workspace subscriptions
* If your personal subscription runs out of usage, the session falls back to the workspace subscriptions

### Migrating to the New OpenAI Subscription Flow

Connecting a subscription by pasting `~/.codex/auth.json` has been replaced by **Sign in with ChatGPT**. The old flow tended to stop working after a while, leaving the connection stuck on authentication errors until you reconnected; the new one stays stable. Existing connections keep working, so there is nothing to do right away, but re-link yours when convenient:

1. Go to **Settings** → **Agents** → **Codex** → **Authentication**. A connection made with the old flow shows a "Legacy connection" notice on its row
2. Click **Add subscription** and connect with **Sign in with ChatGPT**
3. Once the new subscription is listed, disconnect the legacy one from its menu

Because a workspace now holds several subscriptions, connecting adds a row rather than replacing the old one — so the legacy connection has to be removed separately.

If you also connected an OpenAI subscription at the user level, go to **Settings** → **Agents** → **Codex** → **Authentication** → **Personal** and click **Reconnect**. User subscriptions are still a single connection, so reconnecting migrates it in place with no disconnect needed.

## Setting as Default

To use Codex automatically for all requests:

1. Go to **Dashboard** → **Agents**
2. Select "Set as default agent" from Codex's dropdown menu

## Using Codex

Once configured, Codex is used automatically if it's your default agent:

```
@blocks can you implement this feature?
```

Or use the `/codex` slash command to use it specifically:

```
@blocks /codex implement this API endpoint
```

## Best For

* Complex reasoning tasks
* Critical code reviews
* Advanced problem solving
* Detailed analysis
* Architecture decisions
* In-depth explanations

## Cost

Codex uses your OpenAI API key or subscription:

* Check pricing at [OpenAI Pricing](https://openai.com/pricing)
* Monitor usage in [OpenAI Dashboard](https://platform.openai.com/usage)
* API usage is billed by OpenAI based on tokens

With the **Blocks** authentication method there is no OpenAI bill. Requests route through the Blocks AI Gateway and are billed against your Blocks LLM credits.

## Next Steps

> [card] [Claude Code](https://docs.blocks.team/using-blocks/agents/claude-code.md)
>
> Learn about Claude Code

> [card] [Gemini CLI](https://docs.blocks.team/using-blocks/agents/gemini-cli.md)
>
> Explore Gemini CLI (experimental)


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