Create chat completion
Generate a response from a conversation.
base_url and use a Modular API key when using the OpenAI SDK.Authorizations
Modular Cloud API key. Obtain from the API keys page.
Body
Model identifier. See the supported models page.
"google/gemma-4-26b-a4b-it"
The conversation history.
Maximum number of tokens to generate.
Sampling temperature (0–2). Higher values produce more varied output.
0 <= x <= 2If true, stream partial tokens as server-sent events. Support for tools while streaming is model-dependent; set this to false if you see incomplete or malformed tool-call output.
List of functions the model may call. See the supported models page for a list of models that support tool use (function calling).
Controls when and how the model calls a tool.
none: Disables tool calls.auto(default): Lets the model decide whether to call a tool.required: Forces the model to call at least one tool.- A function object: Forces the model to call the named function.
The following example requires the model to call the get_weather function:
none, auto, required Response
Chat completion response.