Skip to main content

Baseten Python SDK

PyPI

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.13.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for baseten 0.13.1
File Size Uploaded Provenance Actions
baseten-0.13.1.tar.gz 530.7 kB With provenance Details for baseten-0.13.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for baseten 0.13.1
File Interpreter ABI Platform Actions
baseten-0.13.1-py3-none-any.whl Python 3 none any Details for baseten-0.13.1-py3-none-any.whl

Total release size: 753.0 kB

Release files / baseten-0.13.1.tar.gz

Download URL baseten-0.13.1.tar.gz
Size 530.7 kB
Tags Source
SHA-256 checksum
How to use checksums
11d74b197c5de2f318b6207ec0103d2ead58cf8f10c93a82de7e609552de02c7
BLAKE2b-256 checksum
How to use checksums
0b9fbbcc33f99be835f43a2dadc684d95fa4f20ed81eecd21c9b7268fbef817b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 23, 2026.

Transparency log

Release files / baseten-0.13.1-py3-none-any.whl

Download URL baseten-0.13.1-py3-none-any.whl
Size 222.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
627d90fb2c582ad9483bd3df0748780c63006068a0a6aaa6c614e7bf03f6f666
BLAKE2b-256 checksum
How to use checksums
cd6598e0325f6227db0009f9998ff31b4a3116c0c0acacdd56f459929559440f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 23, 2026.

Transparency log

Security for baseten 0.13.1

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for baseten-0.13.1.tar.gz

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 23, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.13.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page