For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
DocsAPI ReferenceSDKs
DocsAPI ReferenceSDKs
      • Overview
      • Chat Completions
      • Prompt Templates
      • Files & Batches
      • Embeddings
      • Image Generation
      • Responses (Reasoning)
      • Compare (Multi-model)
      • Models
      • Error Handling
LogoLogo
On this page
  • Python SDK
  • Install
  • Authentication
  • Type hints
Python SDK

Python SDK Overview

||View as Markdown|
Was this page helpful?
Edit this page
Next

Chat Completions

Built with

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)