Streaming

For compatible chat requests, set stream: true to receive output as it is generated. Consume the stream and close the connection when finished. Streaming can reduce the wait for the first visible text.

Image understanding

Choose a model with image input support, then supply image_url content in the messages format accepted by that endpoint. Image pricing depends on the model; check Models and pricing.

Tool calls

Define tools in the request. When the model returns tool_calls, your application executes the allowed tool and sends its result back to the model. The model’s requested call does not itself execute your code.

JSON output

For models supporting JSON mode, set response_format to { "type": "json_object" } and explicitly request JSON in the system prompt. Validate the result before using it in your application.

Length, temperature and reasoning

Set an output limit appropriate to the task. Temperature controls randomness where supported. Reasoning parameters and context limits are model-specific; do not assume every model accepts the same options. See API overview, Authentication and Gateway configuration.