Create Chat Completion
client.chat.completions.create(params)/v1/chat/completionsCreate an OpenAI-compatible chat completion with any supported SandBase chat model. Provider-compatible fields are preserved when supported by the selected route.
Request body
ChatCompletionCreateParamsModel identifier from the Models API.
Conversation messages using roles supported by the selected provider, commonly system, developer, user, assistant, or tool.
Sampling temperature from 0 to 2.
Default: 1
Nucleus sampling threshold.
Default: 1
Maximum number of output tokens.
Return incremental Server-Sent Events.
Default: false
Sequence or sequences that stop generation.
Function definitions available to the model.
Controls whether and which tool is selected.
Default: auto
Allow supported models to emit multiple tool calls in one turn.
Provider-compatible end-user identifier.
JSON object or JSON Schema output configuration.
Provider-compatible reasoning effort setting.
Reasoning configuration such as effort or max_tokens.
Thinking configuration such as type or budget_tokens.
Provider-specific parameters for routes that require protocol translation.
Number of completion choices to generate.
Default: 1
Presence penalty from -2 to 2.
Default: 0
Frequency penalty from -2 to 2.
Default: 0
Streaming options such as include_usage.
Streaming and tools
Set stream to true for SSE; the stream ends with data: [DONE]. Add stream_options.include_usage for the final usage chunk. Tool calls and multimodal content follow the OpenAI-compatible schema.
Provider compatibility
SandBase preserves additional compatible fields on same-protocol routes. Cross-protocol and provider-specific field support varies; use extra_body where applicable.
Errors
Invalid request body or unsupported parameter.
Missing or invalid API key.
Organization spending limit reached.
Model not found or unavailable.
Rate limit exceeded.
Request persistence or organization lookup failed.
The selected provider returned an invalid response.
No provider route succeeded.