Baseten Python SDK
Python SDK for Baseten. See the API documentation and usage below.
⚠️ SDK may change in incompatible ways between releases until the SDK reaches 1.0.
Install
pip install baseten
Usage
Current SDK only has barebones client. Here is usage example of the barebones underlying client:
from baseten.client import ManagementClient
with ManagementClient(api_key="my-api-key") as client:
for model in client.api.get_models().models:
print(model.name)
Or for async:
from baseten.client import AsyncManagementClient
async with AsyncManagementClient(api_key="my-api-key") as client:
for model in (await client.api.get_models()).models:
print(model.name)
Sandboxes
baseten.sandbox creates and works with sandboxes. HTTP/2 is used when the h2 package is installed, which is strongly recommended:
pip install "baseten" "httpx[http2]"
from baseten.sandbox import SandboxClient
with SandboxClient(api_key="my-api-key") as client:
sandbox = client.create()
try:
sandbox.fs.write(path="/tmp/hello.txt", content="hello")
result = sandbox.process.exec(
command="cat /tmp/hello.txt", wait_for_completion=True
)
print(result.stdout)
finally:
client.delete(name=sandbox.name)
AsyncSandboxClient is the same for async code. Operations the SDK does not wrap are available on the generated clients, through client.raw_api for the control plane and sandbox.raw_api for a sandbox. See the API documentation for the rest.
Upgrading from 0.8.2 and earlier
Version 0.9.0 is a rewrite and shares no API with the earlier baseten releases.
Code written against 0.8.2 or earlier will not work. Pin baseten<0.9 to keep it.
Metadata
Release files for baseten 0.12.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| baseten-0.12.0.tar.gz | 488.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| baseten-0.12.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 692.4 kB
Release files / baseten-0.12.0.tar.gz
| Download URL | baseten-0.12.0.tar.gz |
|---|---|
| Size | 488.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
90958219e1d009580b6cc2e1f942bf1a355e6465c0813a167f05d48b3d97d347
|
|
BLAKE2b-256 checksum How to use checksums |
87238bfaff676045178aa293528d2f2bfda22b4d381748c221abb52e41335e63
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 7, 2026.
Transparency logRelease files / baseten-0.12.0-py3-none-any.whl
| Download URL | baseten-0.12.0-py3-none-any.whl |
|---|---|
| Size | 203.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
aa54a1c807fb58891e91c529557e70d06ff241ebb31070cc162fabf40840757c
|
|
BLAKE2b-256 checksum How to use checksums |
fcb0f5928a885febe4697e5b98739789b13ecd322b718a499ecba69338fa0c29
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 7, 2026.
Transparency log