Python SDK
Python SDK
The MeshAPI Python SDK provides a native, typed client for integrating the AI model gateway into your Python 3 applications.
Requirements
- Python ≥ 3.9
httpx≥ 0.27pydantic≥ 2.0
Installation
Quick Start
You can interact with MeshAPI using either a synchronous or asynchronous client. We strongly suggest using one client instance per authentication realm (Data-Plane vs Control-Plane).
Synchronous Client
Asynchronous Client
Error Handling & Retries
The client automatically retries GET and non-streaming POST/PATCH requests on status codes 429, 502, 503, and 504 with exponential backoff.
If an error occurs, a MeshAPIError is raised:
[!WARNING] Streams do not automatically retry! If a connection drops mid-stream, the SDK raises a
MeshAPIErrorwitherror_code="stream_interrupted". You must catch this and restart the request manually if required.