Founding keys are opena year free at 6,000 req/hour, for the first 1,000 developersClaim yours
Documentation 29

Codex Analytics API quickstart · 3 min read

Codex, measured. Straight from the authenticated reference.

The ChatGPT Codex Enterprise Analytics API — workspace usage, credits, per-client splits, and code attribution — for a simulated org running a two-seat Codex trial. Every response validates against the OpenAPI OpenAI publishes for it, and the dollars reconcile with the OpenAI Platform's own cost report to the micro-cent.

01Point your calls at chatgpt.
02Read the workspace analytics
03Pin a snapshot for CI

01 / Base URL + auth

One host, one workspace, an Admin key.

Point requests at https://chatgpt.sandboxapis.dev. Paths, envelopes, and headers mirror api.chatgpt.com exactly — the {object: "page"} envelopes, the req_… request ids, and the error bodies the real host serves (an OpenAI {error} envelope with a top-level status, sent as text/plain with a base64 twin in x-error-json — odd, and mirrored because it is real). Auth is a workspace-scoped Admin key with the codex.enterprise.analytics.read scope; any value passes here.

Every read is scoped to a workspace UUID — there is no list-workspaces endpoint, on the real API or here. Real admins copy theirs out of the ChatGPT admin console; this universe has exactly one: 2c9bcd8f-c169-4ce5-a266-c8cba93fbad5.

request.sh
curl -H 'Authorization: Bearer any-key' \
  "https://chatgpt.sandboxapis.dev/v1/analytics/codex/workspaces/2c9bcd8f-c169-4ce5-a266-c8cba93fbad5/usage?limit=5"

Using a key? Keys & rate limits → — a SandboxAPIs key rides the same Bearer slot and lifts the anonymous limit.

02 / The reads that matter

Usage, code reviews, review responses.

report.sh
# Per-user daily rows: threads, turns, credits, tokens, code attribution
# (start_time 1777224000 = this pin's 90-day window start; end_time is exclusive)
curl -H 'Authorization: Bearer any-key' \
  "https://chatgpt-v1.snap.sandboxapis.dev/v1/analytics/codex/workspaces/2c9bcd8f-c169-4ce5-a266-c8cba93fbad5/usage?start_time=1777224000"

# The same window as workspace-wide aggregates — one row per day
curl -H 'Authorization: Bearer any-key' \
  "https://chatgpt-v1.snap.sandboxapis.dev/v1/analytics/codex/workspaces/2c9bcd8f-c169-4ce5-a266-c8cba93fbad5/usage?start_time=1777224000&group=workspace"

# Codex code reviews, and how humans responded to them
curl -H 'Authorization: Bearer any-key' \
  "https://chatgpt-v1.snap.sandboxapis.dev/v1/analytics/codex/workspaces/2c9bcd8f-c169-4ce5-a266-c8cba93fbad5/code_reviews?start_time=1777224000"
curl -H 'Authorization: Bearer any-key' \
  "https://chatgpt-v1.snap.sandboxapis.dev/v1/analytics/codex/workspaces/2c9bcd8f-c169-4ce5-a266-c8cba93fbad5/code_review_responses?start_time=1777224000"

03 / A real response

Live from the universe.

200 · application/json
{
  "object": "page",
  "data": [
    {
      "object": "workspace.codex.usage.result",
      "start_time": 1778544000,
      "end_time": 1778630400,
      "user_id": "user-1xqjx4x194cobz",
      "actor": {
        "type": "ACCOUNT_USER",
        "user_id": "user-1xqjx4x194cobz",
        "email": "pythia@olympus-labs.dev"
      },
      "totals": {
        "threads": 2,
        "turns": 8,
        "credits": 35.96,
        "estimated_cost_usd": 0.5364,
        "uncached_text_input_tokens": 190000,
        "cached_text_input_tokens": 380000,
        "text_output_tokens": 13000,
        "text_total_tokens": 583000
      },
      "clients": [
        {
          "client_id": "CODEX_IDE_VSCODE",
          "threads": 2,
          "turns": 6,
          "credits": 25.172,
          "estimated_cost_usd": 0.37548,
          "uncached_text_input_tokens": 133000,
          "cached_text_input_tokens": 266000,
          "text_output_tokens": 9100,
          "text_total_tokens": 408100
        },
        {
          "client_id": "CODEX_CLI",
          "threads": 0,
          "turns": 2,
          "credits": 10.788,
          "estimated_cost_usd": 0.16092,
          "uncached_text_input_tokens": 57000,
          "cached_text_input_tokens": 114000,
          "text_output_tokens": 3900,
          "text_total_tokens": 174900
        }
      ],
      "models": [
        {
          "model": "gpt-5.6-luna",
          "speed": "fast",
          "credits": 0.76,
          "estimated_cost_usd": 0.0084,
          "uncached_text_input_tokens": 25000,
          "cached_text_input_tokens": 50000,
          "text_output_tokens": 2000,
          "text_total_tokens": 77000
        },
        {
          "model": "gpt-5.6-terra",
          "speed": "standard",
          "credits": 35.2,
          "estimated_cost_usd": 0.528,
          "uncached_text_input_tokens": 165000,
          "cached_text_input_tokens": 330000,
          "text_output_tokens": 11000,
          "text_total_tokens": 506000
        }
      ],
      "code_attribution": {
        "lines_of_code": {
          "added": 0,
          "removed": 0,
          "committed": 0,
          "total_committed_lines": 0,
          "committed_percentage": 0
        },
        "commits": {
          "with_codex_contribution": 0,
          "with_codex_contribution_percentage": 0,
          "total_commits": 0
        }
      }
    },
    {
      "object": "workspace.codex.usage.result",
      "start_time": 1778716800,
      "end_time": 1778803200,
      "user_id": "user-1xqjx4x194cobz",
      "actor": {
        "type": "ACCOUNT_USER",
        "user_id": "user-1xqjx4x194cobz",
        "email": "pythia@olympus-labs.dev"
      },
      "totals": {
        "threads": 1,
        "turns": 2,
        "credits": 30.8,
        "estimated_cost_usd": 0.4788,
        "uncached_text_input_tokens": 151000,
        "cached_text_input_tokens": 302000,
        "text_output_tokens": 16000,
        "text_total_tokens": 469000
      },
      "clients": [
        {
          "client_id": "CODEX_IDE_VSCODE",
          "threads": 1,
          "turns": 2,
          "credits": 21.56,
          "estimated_cost_usd": 0.33516,
          "uncached_text_input_tokens": 105700,
          "cached_text_input_tokens": 211400,
          "text_output_tokens": 11200,
          "text_total_tokens": 328300
        },
        {
          "client_id": "CODEX_CLI",
          "threads": 0,
          "turns": 0,
          "credits": 9.24,
          "estimated_cost_usd": 0.14364,
          "uncached_text_input_tokens": 45300,
          "cached_text_input_tokens": 90600,
          "text_output_tokens": 4800,
          "text_total_tokens": 140700
        }
      ],
      "models": [
        {
          "model": "gpt-5.6-luna",
          "speed": "fast",
          "credits": 0.72,
          "estimated_cost_usd": 0.0084,
          "uncached_text_input_tokens": 20000,
          "cached_text_input_tokens": 40000,
          "text_output_tokens": 3000,
          "text_total_tokens": 63000
        },
        {
          "model": "gpt-5.6-terra",
          "speed": "standard",
          "credits": 30.08,
          "estimated_cost_usd": 0.4704,
          "uncached_text_input_tokens": 131000,
          "cached_text_input_tokens": 262000,
          "text_output_tokens": 13000,
          "text_total_tokens": 406000
        }
      ],
      "code_attribution": {
        "lines_of_code": {
          "added": 0,
          "removed": 0,
          "committed": 0,
          "total_committed_lines": 0,
          "committed_percentage": 0
        },
        "commits": {
          "with_codex_contribution": 0,
          "with_codex_contribution_percentage": 0,
          "total_commits": 0
        }
      }
    }
  ],
  "has_more": true,
  "next_page": "bzoy"
}

04 / Pin a snapshot

Deterministic CI.

The *.snap. base URL is byte-identical on every request, with credit rates and model IDs frozen at the pin's snapshot date — a spend fixture that never moves under your dashboards. chatgpt-v1 rides the same artifact as openai-2020-10, which is why the two hosts agree on a pinned run as exactly as they do live.

.env
# reproducible in CI
export CODEX_ANALYTICS_BASE_URL=https://chatgpt-v1.snap.sandboxapis.dev
export CODEX_WORKSPACE_ID=2c9bcd8f-c169-4ce5-a266-c8cba93fbad5

Tour the universe → · Coverage manifest → · Versioning & pinning →