tools / tool_calls and streaming

POST /v1/chat/completions accepts OpenAI-style tools, tool_choice in the body and returns tool_calls and related fields (exact shape depends on implementation and upstream). Agents, IDE plugins, OpenClaw, Hermes, etc. often combine these with SSE streaming.

content: null in messages

For assistant messages that include tool_calls, some clients send content: null to match the OpenAI API. This service’s schema accepts null and normalizes it internally (see chatMessageSchema and related source comments). For custom clients, avoid sending invalid types for content (Zod validation still applies).

Errors and fallback under streaming (SSE)

  • On success: HTTP 200 + text/event-stream.
  • Failures before any output: may trigger primary/standby route switching (see Models and routing).
  • Failures after output has started: no further route switching; errors appear as SSE events or connection end; clients should parse error events / retry accordingly.

On the SDK side, see GatewaySseError in Error types.

Relation to the shipped HTTP README

  • Full request fields and error codes: HTTP service README shipped with your deployment

See also

Back to docs home