Repository navigation
Description
Client or integration
Claude Code
Area
Proxy and routing
Summary
On the installed OpenCodex 2.80.0, Claude Code transcript records can lack requestId for responses handled by the proxy, even though OpenCodex records its own ocx-... request ID in durable request history. A downstream usage collector then has no deterministic per-call key to relate the Claude transcript to the authoritative proxy record.
This is a correlation gap, not evidence that OpenCodex failed to record or price the request. A collector can continue counting the proxy ledger once and keep the unlinked transcript as unresolved; it cannot safely infer whether an unlinked native-model transcript was a direct Anthropic call or an OCX call.
Observed evidence
Read-only inspection of the installed 2.80.0 source shows:
src/server/index/startup-warnings.tsdefineswithRequestLogId(response, requestId)and sets onlyx-opencodex-request-id.- The
/v1/messagesroute insrc/server/index/serve-options.tsdoes not expose that log ID through the Anthropic-compatiblerequest-idresponse header. - Claude Code's persisted metadata can have an absent top-level
requestIdwhile proxy request-history rows retain their OCX request IDs. - The retained proxy usage metadata does not provide a corresponding Claude message ID or upstream request ID that can be joined to those old transcript rows. A conversation-level hash is not a per-call join key.
message.idis insufficient: native passthrough can preserve an upstream Anthropic message ID, so its shape alone does not prove which route answered.
No prompts, credentials, real request IDs, account details, local paths, usage totals, or transcript bodies are attached.
Reproduction
Use an isolated fake HOME and the existing mocked-server test setup; a paid provider call is unnecessary.
- Configure a mock Anthropic Messages upstream and start the real proxy server through the existing Claude integration test harness.
- Send a
POST /v1/messagesrequest with a regular native Claude model identifier, first streaming and then non-streaming. Let the mock return a normal Messages response and usage. - Inspect the downstream response headers and the corresponding durable request-history ID.
- Inspect the metadata a Claude Code client persists from the response: its
requestIdis obtained from the protocolrequest-idheader, not the customx-opencodex-request-idheader. - Observe that the proxy has a durable OCX ID but the client may retain no matching ID, preventing exact transcript-to-ledger correlation.
The current report combines installed-source inspection and existing transcript/ledger metadata observations. No new live model call was made for this report. The mocked procedure describes a regression test the maintainers can run.
Expected behavior
A logged /v1/messages response should expose a stable, documented correlation ID through metadata Claude Code actually persists, and that ID should identify the same durable proxy request-history row.
Please cover native and translated responses, streaming and non-streaming responses, and logged refusals. Preserve stream cancellation, response bodies, existing header semantics, and privacy boundaries. Responses which have no log row should not acquire a misleading ledger association.
If request-id is used for the OCX log ID, document how any upstream Anthropic request ID is represented separately. An alternative supported correlation contract that Claude Code persists would also address the issue.
This would help future records. It does not retroactively prove the route of old records that lack any shared key; timestamps, model names, or approximate token matches must not be treated as exact reconstruction.
Version
Installed @bitkyc08/opencodex 2.80.0
Operating system
Linux
Provider and model
Anthropic Messages-compatible native Claude route; the issue is the client/proxy correlation contract rather than a particular model.
Duplicate search
Searched this repository's issues and PRs for request-id, requestId transcript, x-opencodex-request-id, and transcript accounting.
Related #1217 covers durable stream diagnostics and the custom correlation header; it does not cover Claude Code persisting the standard Messages header. #6775 concerns test HOME isolation, not response-to-transcript correlation. No exact duplicate was found in these targeted searches.
Checks
- I searched existing issues and documentation.
- I removed secrets, tokens, account details, request credentials, and personal data.
Activity
fix(claude): expose the durable OCX request id as request-id on Messa…
lidge-jun commentedon Oct 9, 2026
Fixed on
devby #6831 (merge commit 4504a56).When the proxy writes a request-history row for a
/v1/messagesresponse, the standardrequest-idheader andx-opencodex-request-idnow both carry that row's durable OCX id. This covers native and translated routes, streaming and non-streaming responses, and the refusals that are logged. Responses without a log row get no ledger id. On native Anthropic routes, the upstream's own request id moves tox-opencodex-upstream-request-id, and only a boundedreq_...value is carried. Both names are exposed through CORS. Bodies, SSE payloads andmessage.idare unchanged. The contract is documented in the proxy formats reference. It ships with the next release.Older transcripts are not linked retroactively, as you noted. A live Claude Code transcript capture was not part of this change's verification.