POST /api/spaces/stream
Request body
array
required
Array of conversation turns in order. Each entry has a
role and content.Multi-turn conversation
To continue a conversation, include the full history:Response
The endpoint returns a streaming text response. The model may execute tools (search, retrieval, calculation) transparently and synthesize results into the final response.Integration notes
- Include full history — the model has no memory between requests. Always send the complete conversation history for multi-turn interactions.
- Set timeouts — the Spaces stream can run for several seconds on complex queries. Set a timeout of at least 30 seconds.
- Log request IDs — capture the request ID from the response headers for debugging.
- Sanitize inputs — validate and normalize user inputs before sending. Never forward raw, unvalidated user input directly to the API in a production application.