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

# Codex

> Connect Codex so Sazabi can hand issue fixes to it and follow the result in the issue thread.

## Supported capabilities

Manual log sourceCore integration

* **Manual log source**: [Codex](https://docs.sazabi.com/catalogs/log-sources/coding-agents/codex.md) — Add an \[otel] section to your Codex config to ship session telemetry — prompts, tool calls, and model API requests — to Sazabi via Codex's built-in OTLP exporter.
* **Core integration**: [Codex](https://docs.sazabi.com/catalogs/integrations/codex.md#core-integration) — Connect Codex so Sazabi can hand issue fixes to it and follow the result in the issue thread.

Each connection method has its own setup and permissions. Connecting one method does not enable the others.

## Core integration

## About

Connecting Codex lets Sazabi hand an issue's fix to Codex. You choose **Fix** on an issue, Codex works in your repository and opens a pull request, and Sazabi follows its progress in the issue thread. Codex is a **coding agent** integration: one of the agents listed under [**Settings > Integrations**](https://app.sazabi.com/settings/integrations) that Fix can hand off to.

## Prerequisites

* A ChatGPT plan, or an OpenAI API key and an executor (environment) key.
* Organization admin access in Sazabi.
* Repository access for Codex: Install [Sazabi's GitHub App](https://docs.sazabi.com/catalogs/integrations/github.md) on the repositories your projects use. Codex reaches repositories through that installation.

## Set up in the dashboard

**Step 1**

### Get your credentials

Create a ChatGPT sign-in, or two OpenAI keys from the same OpenAI project and owner: an **OpenAI API key** from [OpenAI API keys](https://platform.openai.com/api-keys) and an **OpenAI environment key** from [Agents > Environments > Keys](https://platform.openai.com/agents?tab=environments\&environment_view=keys). The environment key runs inside the sandbox and can only connect environments; fixes cannot start without it. ChatGPT sign-in usage counts against the connected person's ChatGPT plan.

**Step 2**

### Open the Codex integration

In the dashboard, go to [**Settings > Integrations**](https://app.sazabi.com/settings/integrations) and open **Codex**.

**Step 3**

### Connect your account

Choose **Connect**. Sign in with ChatGPT (the default: choose **Start sign-in** and approve the device code), or switch to API keys and paste the OpenAI API key and the OpenAI environment key.

**Step 4**

### Check repository access

The connection page's **Repositories** section shows which repositories Fix can hand to Codex. **Default coding agent** is set per project, so it appears only when you open the connection from a project's settings: open the project, go to its **Integrations** settings, select Codex, and choose **Use this account**. Fix then hands off to it without asking.

## Set up with the CLI

You can also connect Codex with the [Sazabi CLI](https://docs.sazabi.com/reference/cli.md) (installed and authenticated; see [CLI reference](https://docs.sazabi.com/reference/cli/integrations.md)).

Codex connects with a ChatGPT sign-in or with API keys. To sign in with ChatGPT, run the command below; it runs `codex login` on your machine, so the Codex CLI must be installed and on your `PATH`:

```bash theme={"system"}
sazabi integrations codex connect
```

To connect with API keys instead, pass both keys as the `apiKey` and `executorKey` credentials. Read them from environment variables rather than pasting them inline:

```bash theme={"system"}
export OPENAI_API_KEY=...         # your OpenAI API key
export CODEX_EXECUTOR_KEY=...     # your OpenAI environment key
sazabi integrations connect codex \
  --credentials "{\"apiKey\":\"$OPENAI_API_KEY\",\"executorKey\":\"$CODEX_EXECUTOR_KEY\"}"
```

Run `sazabi integrations list` to confirm the connection, or `sazabi integrations providers --json` to see each provider's credential fields.

## Fix issues

Open an issue in the project inbox, choose **Fix**, and pick Codex. Confirm the repository, and the base branch if asked, then choose **Fix with Codex**. Codex works in the repository and opens a pull request; its progress, questions, and pull request appear in the issue thread.

From the CLI, hand the fix off and follow the attempt with `sazabi agent-dispatches` (see [CLI reference](https://docs.sazabi.com/reference/cli/agent-dispatches.md)):

```bash theme={"system"}
sazabi issues fix "$ISSUE_ID" --agent codex
sazabi agent-dispatches list --issue-id "$ISSUE_ID"
```

`sazabi agent-dispatches reply` answers a question from the agent, and `sazabi agent-dispatches cancel` stops the attempt.

## Verify

Choose **Fix** on an open test issue and hand it to Codex. Confirm the attempt appears in the issue thread within a minute, and that `sazabi agent-dispatches list --issue-id "$ISSUE_ID"` lists it with Codex as the agent.

## Troubleshooting

**Codex did not accept this key** - The key is wrong, revoked, or from the wrong account. Create a new one and reconnect.

**Codex can't reach any repositories yet** - Install [Sazabi's GitHub App](https://docs.sazabi.com/catalogs/integrations/github.md) on the repositories your projects use. Codex reaches repositories through that installation.

**Fix doesn't offer Codex** - Confirm the connection shows connected under [**Settings > Integrations**](https://app.sazabi.com/settings/integrations), and that the issue's project has a repository Codex can reach.

## Further reading

> [card] [Issues](https://docs.sazabi.com/guides/detect/issues.md)
>
> Open, investigate, and resolve issues.

> [card] [Integrations](https://docs.sazabi.com/catalogs/integrations.md)
>
> Browse the core integrations.

> [card] [Codex telemetry](https://docs.sazabi.com/catalogs/log-sources/coding-agents/codex.md)
>
> Send Codex session telemetry to Sazabi.


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