La documentation est disponible en anglais.

Documentation / Anthropic-compatible

Tools & streaming

Function calling and Server-Sent Events on /anthropic/v1/messages, matching the Anthropic streaming format.

Tools (function calling)

Send Anthropic tools (name, description, input_schema); the adapter maps input_schema → parameters. tool_choice maps as: {type:auto} → auto, {type:any} → required, {type:tool,name} → forced function, {type:none} → none.

Streaming SSE

With stream: true the response is text/event-stream and emits the Anthropic event sequence:

event: message_start
data: {"type":"message_start","message":{"id":"msg_...","type":"message","role":"assistant","model":"...","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":0,"output_tokens":0}}}

event: content_block_start
data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""}}

event: content_block_delta
data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Bonjour"}}

event: content_block_stop
data: {"type":"content_block_stop","index":0}

event: message_delta
data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":12,"output_tokens":34}}

event: message_stop
data: {"type":"message_stop"}
  • Tool use in stream: after the text block (index 0), each tool is emitted as a tool_use block (index ≥ 1): content_block_start → content_block_delta (input_json_delta) → content_block_stop; message_delta.stop_reason = tool_use
  • Cache hit: replayed as a single text block, then message_delta / message_stop
  • Errors mid-stream: an event: error with {type:"error", error:{type, message}}

See also Create a message and the equivalent OpenAI tools & streaming page.