> ## Documentation Index
> Fetch the complete documentation index at: https://docs.meshrouter.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Python SDK

> Official meshrouter Python package for sync + streaming MESH calls.

The Python SDK supports Python 3.10+. It ships sync helpers for every MESH API surface and uses the
stdlib `urllib` so it has no third-party runtime dependencies.

## Install

```bash theme={null}
pip install meshrouter
```

Package: [`meshrouter`](https://pypi.org/project/meshrouter/).

## First request

```python theme={null}
from meshrouter import MeshClient

mesh = MeshClient(api_key="mesh_live_...")

reply = mesh.create_chat_completion(
    model="auto",
    messages=[{"role": "user", "content": "hello MESH"}],
)

print(reply.data["choices"][0]["message"]["content"])
print("receipt:", reply.receipt_id, "$", reply.total_usd)
```

The SDK defaults to `https://api.meshrouter.app/v1`. Pass `base_url=...` to override.

## Streaming

```python theme={null}
response = mesh.create_chat_completion(
    model="mesh/claude-sonnet-4.5",
    messages=[{"role": "user", "content": "stream this"}],
    stream=True,
)

for event in mesh.iter_sse(response.data):
    if event.event == "message.delta":
        print(event.data.get("delta", ""), end="", flush=True)
```

## Models catalogue

```python theme={null}
models = mesh.list_models()
for m in models.data["data"]:
    print(m["id"], m.get("owned_by"), m.get("pricing"))
```

## Operations helpers

```python theme={null}
mesh.get_current_account()
mesh.update_account_limits(
    "acct_live",
    {"monthlyUsdLimit": 500, "requestsPerMinute": 120},
)

mesh.get_usage(account_id="acct_live")
mesh.get_logs(account_id="acct_live", limit=50)
mesh.get_monitoring_summary(account_id="acct_live", window="1h")

intent = mesh.get_payment_intent("pay_live")
```

## OpenAI compatibility

Prefer the OpenAI Python client? See [OpenAI-compatible client](/sdks/openai-compatible) for the
drop-in path. The MESH SDK is for when you want native helpers for receipts, payments, accounts, and
the MESH-specific monitoring/admin surface.
