Skip to main content
Model APIs let you call hosted open-source LLMs without deploying or managing infrastructure. Use models such as DeepSeek V4 Pro, GLM 5.2, and Kimi K2.6 through APIs compatible with the OpenAI and Anthropic SDKs. See the full list of supported models. In this quickstart, you will set an API key and base URL, then send a request to a hosted LLM.

Set up your API key and SDK

Create a Baseten account and a personal API key, then install a client SDK.
Export your API key
Install a client SDK

Run inference

All Model APIs work with the OpenAI SDK. Anthropic SDK support is in beta. Models may also support tool calling, structured outputs, reasoning, and other features. Call a model using the OpenAI SDK. This example uses zai-org/GLM-5.2, but you can swap in any supported model.
To create a chat completion:
chat.py
Success looks like this:

Stream the response

Streaming returns tokens as the model generates them instead of waiting for the full response. Use it for chat interfaces and other interactive applications.
Set stream=True to receive tokens as the model generates them:
stream.py

Explore Model API features

Structured outputs

Generate JSON that conforms to a schema you define.

Tool calling

Let the model invoke functions and use the results in its response.

Reasoning

Enable extended thinking for multi-step problem solving.

Next steps

Platform overview

Explore hosted models, dedicated deployments, training, and production operations.

Deploy your first model

Deploy a Hugging Face model on dedicated GPUs with config.yaml and the Baseten CLI.