Anthropic Messages API adapter.
Handles the wire format for the /v1/messages endpoint.
Capabilities
- Streaming via SSE with content block events
- Tool/use calling with
input_json_deltaaccumulation - Extended thinking with
thinkingcontent blocks and signatures - Model listing (returns hardcoded model list)
Request format
Messages use Anthropic's content block format:
- Text:
%{"type" => "text", "text" => "..."} - Tool use:
%{"type" => "tool_use", "id" => ..., "name" => ..., "input" => ...} - Thinking:
%{"type" => "thinking", "thinking" => "...", "signature" => "..."}
System prompts are sent as a top-level "system" field.
Developer messages are merged into the system prompt.
SSE events
event: content_block_start— new content block (tool use or thinking)event: content_block_delta— incremental text, thinking, or JSONevent: content_block_stop— block complete (tool calls emitted here)event: message_delta— stop reason and usageevent: message_stop— end of stream