Chat Completions
Create chat completions using Baseten Model APIs, an OpenAI-compatible endpoint for managed LLMs.
Replace OpenAI with Baseten
To call a Baseten model with an existing OpenAI client, change the base URL, API key, and model slug.- Python
- JavaScript
- cURL
base_url and api_key when initializing the client:https://model-{model_id}.api.baseten.co/environments/production/sync/v1/chat/completions. See deployed model endpoints for URL formats.Authorizations
Body
Request body for creating a chat completion.
The model slug to use for completion, such as deepseek-ai/DeepSeek-V4.1-Flash-1017. Find available models at Model APIs.
Maximum number of tokens to generate. If your request input plus max_tokens exceeds the model's context length, max_tokens is truncated. If your request exceeds the context length by more than 16k tokens or if max_tokens signals no preference, context reservation is throttled to 49512 tokens. Higher max_tokens values slightly deprioritize request scheduling.
1 <= x <= 262144Per-request reasoning controls. max_tokens caps reasoning tokens independently of the top-level max_tokens and overrides the model's default reasoning cap. Enforced on DeepSeek V4 Flash 0731, where reasoning is otherwise capped at 4096 tokens per request; other models ignore it. Applies when reasoning is enabled.
How much reasoning a reasoning-capable model performs before answering. The gateway accepts none, minimal, low, medium, high, xhigh, and max; models without reasoning support ignore the parameter. See the Model APIs reasoning page for per-model values.
none, minimal, low, medium, high, xhigh, max Response
Successful response
A chat completion response returned by the model.