Python SDK Overview

View as Markdown

Python SDK

Official Python SDK for Mesh API, an AI model gateway that gives you instant access to 300+ LLMs through a single OpenAI-compatible API.

Python 3.9+. Built on httpx and Pydantic v2. Sync and async clients with first-class type hints.

Install

$pip install meshapi
$# or
$uv add meshapi
$# or
$poetry add meshapi

Authentication

All requests require a Mesh API key (prefixed with rsk_). You can get your key at meshapi.ai.

1client = MeshAPI(base_url="https://api.meshapi.ai", token="rsk_...")

This single key provides access to all available resources, including chat, embeddings, images, files, batches, models, and templates.

Type hints

Every request and response is a Pydantic v2 model. Import what you need:

1from meshapi import (
2 MeshAPI,
3 AsyncMeshAPI,
4 MeshAPIConfig,
5 MeshAPIError,
6 ChatCompletionParams,
7 # ...
8)