thread_id (or pass null) to start a new
conversation; the first conversation_info event carries the assigned thread_id, which you reuse
on later turns.
Reading the stream
The stream emits onlydata: lines. There are no SSE event: lines, so do not key off
them: the event kind is the type field inside each JSON payload. Lines beginning with
: are keep-alive comments and must be skipped.
Always handle
error: it is returned with HTTP 200 inside the stream, because the response has
already begun by the time the failure happens. The exact step and artifact shapes are
documented in agent-core-logic §7.
Choosing a model
A request that omitsconfig runs on the server-side default from llm: in the deployment config.
That default is the same model the web UI sends, gemini-2.5-flash, so an API turn and a
browser turn are comparable out of the box.
To run a different model, pass config:
max_tokens is clamped down to the chosen model’s own output ceiling, so a generous server-side
default cannot make a request invalid for a smaller model.
A refused endpoint_url or args key ends the turn with an error event that names the problem.
The model picker on the hosted deployments offers OpenAI, Anthropic, Google Gemini, Mistral and models self-hosted at UKP. Cohere, xAI, Together AI, DeepSeek and Alibaba Cloud are grayed out there but stay reachable through the API. A request for a provider whose key the server does not hold also ends the turn with an error event.