Claude Code + Codex · Documentation
API contracts, cost and Task Trace
Use shared client, user-task and Codex diagnostic APIs with exact identities, bounded time windows and explicit signal semantics.
Updated November 14, 2026 · Describes source behavior; verify your installed revision.
Authentication
In OIDC mode, telemetry APIs use session cookies. Unauthenticated API requests return JSON 401 with authentication_required and a login URL. Unsafe session requests require the configured Origin and permission.
Basic mode requires both configured credentials. Unauthenticated local development is an explicit opt-in; an empty password configuration is not a production login mode. Device ingestion uses its own bearer-token gate.
GET /api/session reports role, permissions and the short expiresAt; optional refreshExpiresAt is the absolute login deadline. It never returns raw IdP tokens.
Time and filters
| Parameter | Contract |
|---|---|
from, to | Use ISO 8601 with timezone and from < to. Default range is two days; default cap is 90 days. Deployment settings can change them. |
client | Shared overview: all, claude or codex; disabled sources are rejected. |
backend | Client views: all, bedrock-mantle, bedrock-runtime, anthropic or unknown. |
user, model | Existing partial filters. Model normalization and identity expressions depend on the endpoint. |
userExact, modelExact | Shared overview: exact row identities for drilldowns; verify returned applied_filters. Task routes require userExact. Codex insights accepts userExact only with profile=tools and always rejects modelExact. |
intervalHours | Wrapped routes require a finite value in (0,744]. Shared overview supports bounded subhour resolution; read actual bucket_hours and effective_range. |
group | Claude inferred session channel, not the emitting client or an SSO authorization group. |
project | Endpoint-specific, not a universal filter. Consult the complete API reference before applying it. |
Cost/Trends expose ten- and thirty-minute options only through 24 hours. Older windows use hourly rollups; arbitrary finer requests can fall back to a supported native bucket.
The browser picker accepts exact local dates and times with second precision. It serializes ISO from/to bounds and a UI-only rangeMode=time marker for shared links. The marker is not an API filter. Effective bounds still follow each endpoint’s quantization, ingestion grace and rollup rules.
Codex recorded-completion efficiency
completion_usage describes deduplicated usage-bearing completion logs, with basis="recorded_completions". It does not claim every HTTP attempt or session in the selected window has complete telemetry.
| Field | Denominator and boundary |
|---|---|
cache_hit_rate, cache_write_share | Validated cache-read/cache-write subsets divided by canonical input tokens within recorded completions. |
reasoning_share | Validated reasoning subset divided by canonical output tokens in that cohort. |
tokens_per_completion | Canonical tokens divided by recorded completion count; observed token subtotals cannot replace missing canonical components. |
cost_per_completion | Known completion costs divided by all recorded completions, retaining partial-price disclosure. |
cost_per_identified_session | Only completions with a conversation ID contribute to both the cost numerator and distinct-session denominator. |
unidentified_completions | Counted separately and excluded from the identified-session cost unit. |
completeness | Reports missing usage/session evidence, limited aggregate families, incomplete tokens and available whole-window request/session counts. |
Missing components, impossible subsets, zero denominators, all-unknown prices or limited usage can still produce null. Existing whole-window HTTP request/session ratios keep their stricter guards. The UI exposes them in an expandable section.
Collector and device APIs
| Endpoint | Contract |
|---|---|
GET /api/collector | Feature state, configured public ingestion endpoint, version, platforms, token lifetime and installScriptUrl. |
GET /api/collector/devices | Owner-scoped devices, at most 50 per page; use returned cursor unchanged. |
POST /api/collector/devices | Register with name and platform (darwin or linux). Returns the token once. |
DELETE /api/collector/devices/:id | Revoke an owned device. |
GET /api/collector/package/:platform | Authenticated download, no embedded credentials. |
GET /api/ingest/install.sh | Public installer script when device ingestion is configured. Prompts on the terminal for attribution and token; it carries no credentials. |
GET /api/ingest/package/:platform | Device-bearer-authenticated archive for darwin or linux; ten downloads per device per hour. No browser session or embedded token. |
POST /api/ingest/v1/{logs,metrics,traces} | Device bearer token only. OTLP JSON/protobuf, maximum 2 MiB, no content compression. |
Management and manual /api/collector/package/:platform downloads require OIDC collector:manage (analyst/admin). Viewer/demo access cannot manage devices. The installer script and device-token package route use the separate ingestion path. Device endpoints do not use usage-range filters; their responses and downloads are no-store.
Health and errors
/healthz is liveness; /readyz gates readiness. Protected /api/health/data reports ingestion freshness. A live process does not establish fresh telemetry.
Malformed filters fail before querying. Refresh service failures can return 503 with Retry-After: 5; expired or invalid credentials require login. Bounded query admission can reject overload instead of creating unbounded database work.
User task and Trace APIs
User detail loads the overview’s effective period by default. A chart drag updates the page and task list; a point click selects one bucket. Pending or failed overview requests do not show an old task list as current.
Use session-authenticated telemetry access. userExact selects the task's telemetry owner within the requested time range; it does not restrict dashboard readers to their own telemetry.
| Endpoint | Request and response |
|---|---|
GET /api/users/tasks | Required userExact, with the selected range’s from/to. Optional client, backend, Claude-only group, and sort=tokens|cost|subagents|duration. Returns at most 20 tasks, unattached_codex, per-client coverage and partial=true. Claude-only workflowRunId or workflowName narrows the list to one workflow run. |
GET /api/users/tasks/detail | Required list-row id, userExact and the same range bounds. Returns task, lanes, spans, truncated, span_total and why. Both a nonexistent task and an owner/range mismatch return 404. Claude tasks also return environment: the session's MCP servers and loaded plugins. |
- Both routes reject
team. Pass the returned task ID unchanged; disabled clients or malformed IDs are rejected. - Claude cost sorting ranks a candidate pool of the 100 tasks with the most observed tokens. Read
sort_candidates.limited; a costlier task outside that pool can be absent. Codex turns are costed before sorting. - Detail returns at most the newest 5,000 spans. Truncated Claude detail withholds whole-task and lane totals, models and
why. Codex completion-derived task totals do not depend on span truncation; the overlay still hides its KPI row and cost band when truncated. - Span attributes are allowlisted. Missing token components, costs, timings or subagent evidence remain unavailable. The task response is always partial because tracing is optional.
UI walkthrough · Complete task fields, identity validation and linking rules
Codex diagnostic Trace preview
The default GET /api/codex/insights profile includes traces, span latency aggregates and coverage.traces. It returns the latest 50 traces with up to the latest 200 spans each. These bounds differ from Task Trace detail's 5,000-span bound.
Statistics describe the displayed spans. A model filter applies only to spans carrying model attributes. Truncation or conflicting span identities can withhold trace-level duration/error statistics and detail. No metric or trace token observation is added to completion-log usage or cost.
The effort, tools and performance profiles do not query traces: not_requested coverage is not evidence of absent collection. profile=tools alone accepts userExact; every Codex insights profile rejects modelExact.