Prerequisites
To use Model APIs, you need:- A Baseten account
- An API key
- The OpenAI SDK for your language
Supported models
Enable a model from the Model APIs page in the Baseten dashboard.| Model | Slug | Context |
|---|---|---|
| OpenAI GPT OSS 120B | openai/gpt-oss-120b | 128k |
| DeepSeek V3.2 | deepseek-ai/DeepSeek-V3.2 | 131k |
| DeepSeek V3.1 | deepseek-ai/DeepSeek-V3.1 | 164k |
| DeepSeek V3 0324 | deepseek-ai/DeepSeek-V3-0324 | 164k |
| Kimi K2 Thinking | moonshotai/Kimi-K2-Thinking | 262k |
| Kimi K2 0905 | moonshotai/Kimi-K2-Instruct-0905 | 128k |
| Qwen3 Coder 480B | Qwen/Qwen3-Coder-480B-A35B-Instruct | 262k |
| GLM 4.7 | zai-org/GLM-4.7 | 200k |
| GLM 4.6 | zai-org/GLM-4.6 | 200k |
Create a chat completion
- Python
- JavaScript
- cURL
Initialize the OpenAI client with Baseten’s base URL and your API key:
Features
Model APIs support the full OpenAI Chat Completions API:- Structured outputs: Generate JSON that conforms to a schema.
- Tool calling: Let the model call functions you define.
- Reasoning: Control extended thinking for complex tasks.
- Streaming: Set
stream: trueto receive responses as server-sent events.
Migrate from OpenAI
To migrate existing OpenAI code to Baseten, change three values:- Replace your API key with a Baseten API key.
- Change the base URL to
https://inference.baseten.co/v1. - Update the model name to a Baseten model slug.
Handle errors
Model APIs return standard HTTP error codes:| Code | Meaning |
|---|---|
| 400 | Invalid request (check your parameters) |
| 401 | Invalid or missing API key |
| 402 | Payment required |
| 404 | Model not found |
| 429 | Rate limit exceeded |
| 500 | Internal server error |