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

# Codex

> Stream Codex's model usage, cost, and tool activity into Carbon — one command, no code changes.

Carbon ingests [Codex](https://openai.com/codex) through its built-in OpenTelemetry exporter. The [`@carbon-js/connect`](/documentation/connect/commands) CLI points that exporter at Carbon, so every model call, its token usage and cost, and each tool execution land in your space as events — with no SDK, no daemon, and no changes to your project.

## Quick setup

<Steps>
  <Step title="Run the interactive setup">
    `@carbon-js/connect` detects Codex, connects it, and prompts for your Carbon API key (generate one under
    **Settings → API Keys**).

    <CodeGroup>
      ```bash npm theme={null}
      npx @carbon-js/connect@latest
      ```

      ```bash pnpm theme={null}
      pnpm dlx @carbon-js/connect@latest
      ```

      ```bash bun theme={null}
      bunx @carbon-js/connect@latest
      ```
    </CodeGroup>

    Prefer to skip the prompts? Pass the app and key directly — see [API keys](/documentation/connect/api-keys).
  </Step>

  <Step title="Restart Codex">
    Restart the app so it reloads its config and begins exporting. Run a prompt, then open
    [Events](https://oncarbon.site/app/events/all) — your activity appears within seconds.
  </Step>
</Steps>

## What gets captured

Each Codex turn becomes one **LLM event** (model, token usage, cost, timing, status); each tool run becomes one **tool event**, correlated to its session and turn. Events show up under the **Codex** source, alongside everything else in your space.

<Note>
  Carbon receives **dimensions only** — model, usage, cost, timing, status, and the session/turn keys. Your prompts, the
  model's responses, and tool input/output **text** are never sent. See [Privacy](/documentation/connect/privacy).
</Note>

## Managing the connection

`@carbon-js/connect` makes a tagged, idempotent edit to Codex's own `~/.codex/config.toml`, touching only the keys it manages. To check status or revert:

```bash theme={null}
@carbon-js/connect status              # show which apps are connected
@carbon-js/connect disconnect codex
```

See [How it works](/documentation/connect/how-it-works) for exactly what the edit changes, and [Commands](/documentation/connect/commands) for the full CLI.
