Basic streaming
The streaming API differs by language: Python uses a separatestream() method, Node.js passes stream: true to create(), and Go returns channels.
- Python
- Node.js
- Go
stream() is a separate method from create(). It returns a sync iterator.Async streaming (Python)
UseAsyncMeshAPI to stream in async contexts.
Cancelling a stream
- Python
- Node.js
- Go
Break out of the iterator at any point — no cleanup needed.
Stream recovery (Python)
Streams do not automatically retry mid-stream. If the connection drops, aMeshAPIError with error_code="stream_interrupted" is raised. Catch it and restart:
Non-streaming
create() requests retry automatically on 429, 502, 503, and 504. Streams never retry automatically — the client would have to re-generate content already received.