Skip to content

fix(anthropic): preserve provider-qualified response model metadata #1117

Description

@giulioleone097

Client or integration

Codex App

Provider or upstream service

Anthropic

OpenCodex version

2.10.2

Endpoint or capability

/v1/responses streaming response model metadata and Codex catalog synchronization

Current behaviour

OpenCodex normalizes a routed Anthropic selector for the upstream request and then reuses the normalized bare ID in the Codex-facing Responses payload. A request for anthropic/claude-sonnet-5 therefore returns claude-sonnet-5. Codex cannot resolve that bare ID against the provider-qualified catalog row, so it may miss the model's long-context and auto-compaction metadata.

Expected behaviour

The Codex-facing response should retain anthropic/claude-sonnet-5. A bare legacy selector should be healed to the provider-qualified response model. Compatibility catalog aliases for existing bare selectors should remain hidden, carry the canonical context metadata, and be removed by restore.

Minimal redacted request or reproduction

curl -N http://127.0.0.1:10100/v1/responses \
  -H 'Authorization: Bearer REDACTED' \
  -H 'Content-Type: application/json' \
  -d '{"model":"anthropic/claude-sonnet-5","input":[{"role":"user","content":[{"type":"input_text","text":"reply OK"}]}],"stream":true,"store":false}'

Actual response or error

HTTP/1.1 200 OK
event: response.completed
data: {"response":{"model":"claude-sonnet-5", "status":"completed"}}

Upstream documentation

No public upstream specification requires the OpenCodex composite selector. The expected behavior is a concrete Codex client requirement: the response model must resolve to the same provider-qualified model metadata that OpenCodex writes into Codex's catalog.

Suggested mapping or implementation notes

Preserve the final Codex-facing routed selector before upstream normalization; use it in core, image-loop, and web-search-loop response bridges. For existing bare selectors, synchronize a hidden Anthropic compatibility alias with the canonical context metadata and an owner marker so restore can remove it safely.

Additional context and attachments

Live reproduction on 2.10.2 returned HTTP 200 and completed normally; only the response model identity was wrong.

Checks

  • I searched existing provider and compatibility issues.
  • The request and response were redacted.
  • The expected behaviour is based on an upstream specification or a concrete client requirement.

Metadata

Metadata

Assignees

No one assigned

    Labels

    providerProvider adapters, OpenAI-compat presets, upstream API quirksprovider-compatibilityProvider compatibility reportsstreamingSSE, WebSocket, terminal stream frames

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions