Skip to content

Anthropic Messages

ProxAI uses the protocol name anthropic_messages for the Anthropic Messages API.

Protocol value
anthropic_messages
Request path
/v1/messages
Main code areas
src/protocol/anthropic/messages/wiresrc/provider/anthropic_messagessrc/ingress/anthropic_messagessrc/translation/anthropic_messages
Conversion targets
pass-through selfopenai_responses

A non-streaming Anthropic Messages response is a single top-level Message envelope:

{
"id": "msg_...",
"type": "message",
"role": "assistant",
"model": "...",
"content": [
{ "type": "text", "text": "..." }
],
"stop_reason": "end_turn",
"usage": {}
}

Multiple output pieces live in content: Vec<ContentBlock>, not in multiple top-level messages.

stop_reason explains why generation stopped:

  • end_turn — natural end of the assistant turn
  • tool_use — model requested tool execution
  • max_tokens — output was truncated by token limit
  • stop_sequence — configured stop sequence matched
  • pause_turn — turn paused
  • refusal — model refused

Wire structs use Option<T> for nullable/missing upstream fields, including compatibility providers and streaming start events.

Streaming is event-based: message_start, content block events, message_delta, and message_stop. The final stop reason is usually carried by message_delta.delta.stop_reason.

For cross-protocol streaming details, see Protocol Conversion.