Codex
Track OpenAI Codex agent usage via OpenTelemetry for per-session cost attribution.
What this provider does
The Codex provider collects usage data from OpenAI Codex-based agents via OpenTelemetry (OTel). Codex agents emit cost and token telemetry as they run — StackSpend receives that telemetry and turns it into estimated cost line items, broken down by session and agent.
This works the same way as the Claude OTel provider. Cost figures are estimated from agent telemetry, not pulled from a billing API, so they are useful for trend tracking, attribution, and early warning — not as an exact invoice replacement.
No credentials are required. StackSpend generates a connection ID that you embed in your OTLP endpoint URL.
Who should use this
Teams running OpenAI Codex-based agents locally or in CI who want per-session cost attribution without switching to a different billing integration. If your agents support OTLP export, this is the fastest way to get Codex spend into StackSpend dashboards and alerts.
| Metric | Detail |
|---|---|
| Latency | ~1 hour |
| Historical data | From setup date |
| Setup time | ~5 minutes |
Setup
Add the Codex provider
- In StackSpend, go to Providers and click Add provider.
- Select Codex from the list.
- No credentials are required. Click Create Provider.
- Copy the generated connection ID from the provider page. You will use it to construct your OTLP endpoint URL in the next step.
Configure OTel export
Point your Codex agent's OTLP exporter at the StackSpend ingest endpoint. Replace {connectionId} with the connection ID from Step 1.
Logs and metrics endpoints:
https://app.stackspend.com/api/v1/public/ingest/otel/codex/{connectionId}/v1/logs
https://app.stackspend.com/api/v1/public/ingest/otel/codex/{connectionId}/v1/metrics
https://app.stackspend.com/api/v1/public/ingest/otel/codex/{connectionId}/v1/tracesIf your exporter accepts a single base URL and appends signal paths automatically, use:
https://app.stackspend.com/api/v1/public/ingest/otel/codex/{connectionId}Verify
Run your Codex agent. Data appears in StackSpend within approximately 1 hour of the first telemetry payload being received. To confirm, return to the Providers page and check the Last synced timestamp next to the Codex entry.
