Documentation IndexFetch the complete documentation index at: /llms.txtUse this file to discover all available pages before exploring further.
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
WebSocket message type reference
{ "type": "init", "payload": { "model": "claude-sonnet-4-5-20250929", "systemPrompt": "You are a helpful assistant.", "maxTurns": 10, "tools": [], "mcpServers": [] } }
model
string
systemPrompt
maxTurns
number
tools
array
mcpServers
allowedTools
string[]
disallowedTools
maxBudgetUsd
{ "type": "prompt", "payload": { "message": "What is 2 + 2?", "model": "claude-sonnet-4-5-20250929" } }
message
outputFormat
object
{ "type": "sdk_message", "payload": { "type": "user", "message": "Hello, Claude!" } }
type
user
{ "type": "tool_result", "payload": { "callId": "call_abc123", "result": { "content": [ { "type": "text", "text": "Result data" } ], "isError": false } } }
callId
tool_call
result
result.content
result.isError
boolean
{ "type": "control", "payload": { "action": "close" } }
close
{ "type": "ping", "payload": { "timestamp": 1704067200000 } }
{ "type": "control", "payload": { "action": "ready", "data": { "sessionId": "session_abc123" } } }
ready
session_info
{ "type": "sdk_message", "payload": { "type": "assistant", "subtype": "text", "text": "Hello! " } }
text
thinking
tool_use
{ "type": "tool_call", "payload": { "id": "call_abc123", "name": "get_weather", "input": { "city": "Paris" } } }
id
name
input
{ "type": "result", "payload": { "type": "result", "subtype": "success", "text": "The answer is 4.", "total_cost_usd": 0.0012, "duration_secs": 1.5, "session_id": "session_abc123", "usage": { "input_tokens": 50, "output_tokens": 20 } } }
"result"
subtype
success
error
interrupted
total_cost_usd
duration_secs
session_id
usage
{ "type": "error", "payload": { "code": "BUDGET_EXCEEDED", "message": "AI budget exceeded for this period", "details": { "budgetType": "ai", "used": 1000000, "limit": 1000000 } } }
code
details
{ "type": "pong", "payload": { "timestamp": 1704067200000 } }