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

# Codex

> Connect your ChatGPT account so Codex sessions in Ona can use your ChatGPT plan.

<Note>Available on the Core plan. ChatGPT plan connections for Codex are currently supported on Ona Cloud only. [Contact sales](https://ona.com/contact/sales) to learn more.</Note>

Connect Codex when you want the Codex agent in Ona to use your ChatGPT plan for model requests. You can use Codex without this integration; without it, Codex uses the model access available to your organization.

This page covers the ChatGPT connection. For the agent itself, see [Codex Agent](/ona/agents/codex).

The running environment still consumes OCUs, but Codex model requests that use your ChatGPT plan are not billed by Ona.

## How Codex uses your ChatGPT plan

Codex runs inside the same isolated Ona Cloud environments as other agents. It can read your repository, use configured tools, run commands, and open pull requests while following your organization's policies.

After you connect your ChatGPT account, the Codex agent uses your ChatGPT plan for model requests. The connection changes model billing and limits only. Ona still provisions and meters the environment that Codex works in.

## Prerequisites

* Your organization is on the Core plan.
* Your organization uses Ona Cloud.
* An organization admin enabled the Codex integration.
* You have a ChatGPT account with Codex access.

If Codex is not listed under **User Settings > Integrations** or the service account's **Integrations** section, ask an organization admin to enable it or contact Ona support.

## Connect your ChatGPT account

1. Go to [User Settings > Integrations](https://app.ona.com/?user-settings=integrations).
2. Find **Codex**.
3. Click **Connect**.
4. Ona opens the OpenAI device authorization page and copies a one-time code.
5. Sign in to ChatGPT, enter the code, and approve the authorization.
6. Return to Ona. The dialog updates when the account is connected.

## Connect Codex for a service account

Connect Codex to a service account when automations running as that service account should use a ChatGPT plan.

1. Go to **Settings > Members > Service Accounts**.
2. Open the service account.
3. In **Integrations**, find **Codex**.
4. Click **Connect**.
5. Ona opens the OpenAI device authorization page and copies a one-time code.
6. Sign in to ChatGPT, enter the code, and approve the authorization.
7. Return to Ona. The dialog updates when the account is connected.

## Use Codex in Ona

Start an environment, open the conversation menu, and choose **Codex** when it is available. If you connected your ChatGPT account, Codex uses your ChatGPT plan for model requests from your user session. If a service account has a Codex connection, automations running as that service account can use that connection.

If you disconnect the integration, future Codex sessions for that user or service account fall back to the model access available to your organization.

## Billing and limits

* OpenAI manages ChatGPT plan usage. Ona does not charge OCUs for Codex model requests that use your connected ChatGPT account.
* Ona still charges for the environment while it is running. See [Cost & Budgets](/ona/billing/usage).
* If ChatGPT rate limits or usage limits are reached, Codex can pause or fail until the limit resets or your ChatGPT plan changes.

## Disconnect Codex

1. Go to [User Settings > Integrations](https://app.ona.com/?user-settings=integrations), or open the service account details page.
2. Find **Codex**.
3. Click **Disconnect**.

## Troubleshooting

<Accordion title="Codex is not listed">
  The integration is not enabled for your organization yet. Ask an organization admin to check **Organization Settings > Integrations**, or contact Ona support.
</Accordion>

<Accordion title="The one-time code expired">
  Close the dialog and click **Connect** again to start a new authorization flow.
</Accordion>

<Accordion title="Codex says it reached a usage limit">
  The connected ChatGPT account has likely reached a Codex limit set by OpenAI. Check your ChatGPT plan and billing details, then retry after the limit resets.
</Accordion>
