Skip to main content
Method: client.generate_text() (stream parsed chunks with client.stream_chat()).

Example

Streaming

Key parameters

  • model (required): Target model id.
  • messages (required): Ordered messages with roles system|user|assistant|tool; content as strings or parts.
  • Sampling: temperature (0–2), top_p (0–1), top_k (>=1), seed (int, optional).
  • Length/penalties: max_output_tokens (int), presence_penalty and frequency_penalty (-2 to 2), stop (string|string[]).
  • Tools: tools (definitions), tool_choice (auto/none/specific tool), max_tool_calls (int), parallel_tool_calls (bool).
  • Logprobs: logprobs (bool), top_logprobs (0–20).
  • Output: response_format (json/text), metadata (object passthrough), stream (bool), service_tier.
  • Gateway extras: usage (bool to request usage), meta (bool to include meta block).

Returns

ChatCompletionsResponse
Or SSE lines when streaming
Last modified on July 26, 2026