Vercel Python SDK
Official Vercel Python SDK. Current version is 0.4.0 (Feb 2026), released as beta Oct 2025. PyPI package is 'vercel', imports as 'vercel'. SDK only covers Blob, Sandbox, Runtime Cache, and OIDC — it does NOT wrap the Vercel REST API (deployments, projects, domains). Five competing PyPI packages exist for Vercel-related Python work: vercel (official), vercel-sdk (official alias), vercel_blob (community), vercel_storage (community), vercelpy (community). Most tutorials predate the official SDK and use community packages.
Warnings
- breaking The official 'vercel' SDK (pip install vercel) does NOT cover the Vercel REST API (deployments, projects, teams, domains). It only covers Blob, Sandbox, Runtime Cache, and OIDC. Agents expecting deployment management will get ImportError or AttributeError.
- breaking Five competing PyPI packages for Vercel Python work: 'vercel' (official), 'vercel-sdk' (official alias), 'vercel_blob' (community), 'vercel_storage' (community), 'vercelpy' (community). They have incompatible APIs. Installing the wrong one fails silently with wrong import paths.
- breaking BlobClient() raises an exception if BLOB_READ_WRITE_TOKEN env var is not set and no token is passed. Error is not a standard Python exception — it's a custom BlobError with no obvious message about which env var is missing.
- breaking Runtime Cache only works inside Vercel Functions at runtime. Outside of Vercel (local dev, CI), it falls back to an in-memory cache silently. Code that works locally may behave differently in production if it relies on tag-based invalidation.
- gotcha Sandbox requires VERCEL_OIDC_TOKEN (injected automatically in Vercel Functions) or a valid Vercel CLI login locally. Running Sandbox code outside Vercel without CLI credentials raises authentication errors.
- gotcha Blob put() adds a random suffix to filenames by default (add_random_suffix=True). Files uploaded as 'photo.jpg' are stored as 'photo-AbCdEfGh.jpg'. The returned URL reflects the actual stored name.
- gotcha SDK is in beta. Breaking changes between minor versions have occurred without major version bump. Official docs warn to pin the version.
Install
-
pip install vercel -
pip install vercel-sdk
Imports
- BlobClient
from vercel.blob import BlobClient
- AsyncBlobClient
from vercel.blob import AsyncBlobClient
Quickstart
import os
from vercel.blob import BlobClient
# Requires BLOB_READ_WRITE_TOKEN env var
client = BlobClient() # reads BLOB_READ_WRITE_TOKEN automatically
# Upload
uploaded = client.put(
'assets/hello.txt',
b'hello from python',
access='public',
content_type='text/plain',
)
print(uploaded.url)
# List
listing = client.list_objects(prefix='assets/')
for blob in listing.blobs:
print(blob.url)
# Download and delete
content = client.get(uploaded.url)
client.delete([uploaded.url])
# Runtime Cache
from vercel.cache import get_cache
cache = get_cache(namespace='my-app')
cache.set('key', {'value': 42}, {'ttl': 60, 'tags': ['my-tag']})
result = cache.get('key') # dict or None
cache.expire_tag('my-tag')