Create an API key
Use a personal API key to authenticate your requests. Reuse a saved key or create one:- Open API keys and sign in. If you don’t have an account, create one first.
- Select Create API key and enter a name such as
quickstart. - Select Personal, then Create API key.
- Copy the key. Baseten only shows it once.
YOUR_API_KEY with your key and run:
BASETEN_API_KEY. Keep the key out of source code and version control.
Send a request
Call the Chat Completions API with Python, JavaScript, or cURL. The SDK examples use Baseten’s base URL and API key; you don’t need an OpenAI account. Themodel field selects the hosted model, GLM 5.3 in this example, and messages contains your input.
- Python
- JavaScript
- cURL
You’ll need uv to run this example.Save this code as Run it.
chat.py:chat.py
--with openai installs the SDK for this run:Next steps
- Choose another Model API and replace the
modelvalue with its slug. - Stream the response to display text as the model generates it.
- Deploy from Explore if you need a model on dedicated GPUs with your own scaling settings.