Skip to main content

Vercel Mesh for Python

vercel-mesh is a thin httpx-shaped layer for service-to-service calls over Vercel Mesh.

It automatically resolves the current Vercel OIDC token and sends it as x-vercel-trusted-oidc-idp-token so one service can call another through Mesh without manually wiring auth headers.

Installation

pip install vercel-mesh

Sync usage

import os

import vercel.mesh as mesh

response = mesh.get(os.environ["PAYMENTS_API_BASE_URL"])
response.raise_for_status()
data = response.json()

Async usage

import os

import vercel.mesh as mesh

async with mesh.AsyncClient() as client:
    response = await client.get(os.environ["PAYMENTS_API_BASE_URL"])
    response.raise_for_status()
    data = response.json()

Reusing a client

import os

import vercel.mesh as mesh

with mesh.Client(timeout=10.0) as client:
    response = client.post(os.environ["PAYMENTS_API_BASE_URL"], json={"ok": True})

vercel.mesh.Client and vercel.mesh.AsyncClient subclass httpx.Client and httpx.AsyncClient, so methods like get, post, request, build_request, send, and stream all work as expected.

Raw httpx

If you already have your own httpx client, reuse the auth layer directly:

import httpx

from vercel.mesh import TrustedOidcAuth

auth = TrustedOidcAuth()

async with httpx.AsyncClient(auth=auth) as client:
    response = await client.get("https://example.vercel.app")

Framework context

When this code runs inside a Vercel Function, the package reads the incoming x-vercel-oidc-token header via vercel.headers.set_headers(...), just like the existing vercel.oidc helpers.

from collections.abc import Callable

from fastapi import FastAPI, Request
from vercel.headers import set_headers

app = FastAPI()


@app.middleware("http")
async def vercel_context_middleware(request: Request, call_next: Callable):
    set_headers(request.headers)
    return await call_next(request)

If no request-scoped token is available, vercel-mesh falls back to the same local refresh and environment variable behavior as vercel.oidc.

Responses are standard httpx.Response objects.

Metadata

Release files for vercel-mesh 0.1.0

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

Source distribution (sdist)

Source distribution for vercel-mesh 0.1.0
File Size Uploaded
vercel_mesh-0.1.0.tar.gz 5.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for vercel-mesh 0.1.0
File Interpreter ABI Platform
vercel_mesh-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 10.3 kB

Release files / vercel_mesh-0.1.0.tar.gz

Download URL vercel_mesh-0.1.0.tar.gz
Size 5.6 kB
Tags Source
SHA-256 checksum
How to use checksums
4fae305dd21ce14941aa874c649ffd9a1b760db48d41da013106fc0b03460653
BLAKE2b-256 checksum
How to use checksums
5bf70b11eb28b89016459fd592f5cb493b3b6e4ab50dea159799d5c2a9671749
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.0

Release files / vercel_mesh-0.1.0-py3-none-any.whl

Download URL vercel_mesh-0.1.0-py3-none-any.whl
Size 4.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c34ab43e58e8dece897ddce58a981a131041cae453d7644d9dafbf60499814b1
BLAKE2b-256 checksum
How to use checksums
cba4d98f5efb98938c9f1b19449b795740683b15fea6d4f5ac84aba689b7890b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.0

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

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