Anthropic Messages to OpenAI Responses
Anthropic Messages to OpenAI Responses
Section titled “Anthropic Messages to OpenAI Responses”This page documents the conversion path used when the provider speaks Anthropic Messages and the client expects OpenAI Responses output.
Non-streaming response mapping
Section titled “Non-streaming response mapping”| Anthropic concept | Responses target | Notes |
|---|---|---|
Message envelope | Responses response envelope | Anthropic returns one final message; Responses returns an envelope with output[]. |
| Text block | Message output item/content part | Preserve visible text order. |
tool_use block | function_call output item | Preserve call identity using Responses item/call identifiers. |
thinking block | Reasoning output item plus continuation envelope | Keep visible thinking as Responses reasoning content and store the Anthropic signature in encrypted_content for a compatible client to replay. |
redacted_thinking block | Reasoning output item continuation envelope | Carry provider-opaque data in the same client-held envelope; do not expose it as visible content. |
stop_reason | Responses terminal status and output state | Map terminal behavior, not just field names. |
Thinking continuation across turns
Section titled “Thinking continuation across turns”Anthropic thinking signatures and redacted-thinking payloads are provider-scoped,
but they are required when a client replays assistant history back to Anthropic.
For the anthropic_messages → openai_responses pair, ProxAI writes a versioned
continuation envelope into the standard Responses
reasoning.encrypted_content field. On a later
openai_responses → anthropic_messages request, it recognizes that envelope,
removes it from the Responses representation, and restores the original
Anthropic thinking or redacted_thinking block.
This is client-carried state, not proxy persistence. It only round-trips when the
client preserves and replays Responses reasoning items. The envelope is prefixed
and JSON-encoded, not cryptographically encrypted or authenticated; the
encrypted_content name is the existing Responses carrier field. An unknown
encrypted_content value is provider-scoped and is trace-skipped during
Responses-to-Anthropic translation; only the versioned ProxAI prefix identifies
restorable continuation data.
Streaming event mapping
Section titled “Streaming event mapping”| Anthropic event | Responses-side behavior |
|---|---|
message_start | Initialize response and usage state. |
content_block_start | Emit or stage a Responses output item depending on block type. |
content_block_delta | Emit text, reasoning, or function-argument deltas. |
content_block_stop | Finalize the current Responses item/content part. |
message_delta | Update stop and usage metadata; may not have a standalone Responses event. |
message_stop | Emit Responses terminal event such as response.completed. |
Identity differences
Section titled “Identity differences”| Anthropic | Responses | Consequence |
|---|---|---|
Content block index | Stable item_id plus output index | The translator must mint/track item ids for Responses events. |
Tool id / tool result linkage | Function call item id and call_id | Do not expose raw provider ids as the only client identity. |
| Message-level terminal metadata | Response status plus item status | Terminal state may need to update both envelope and output items. |
Lossy areas
Section titled “Lossy areas”- Anthropic content block
indexis stream-local; Responses item identity is client-visible and can be stable across turns. - Provider-specific thinking metadata is preserved only for clients that replay ProxAI’s continuation envelope; other provider-specific metadata may still have no Responses equivalent.
- Anthropic
pause_turnand refusal metadata need behavior-preserving target semantics. - Usage and stop metadata may arrive late in streams.