Metadata-Version: 2.4
Name: demystify-gateway-sdk
Version: 0.3.0
Summary: Python SDK for the dmstfy-gateway data plane (chat, embeddings, STT, TTS via one OpenAI-compatible endpoint)
Project-URL: Homepage, https://github.com/demystify-systems/ai-services-tools/tree/main/modules/dmstfy-gateway/packages/sdk-py
Project-URL: Repository, https://github.com/demystify-systems/ai-services-tools
Author: Demystify Systems
License: MIT
Requires-Python: >=3.11
Requires-Dist: httpx<1,>=0.27
Provides-Extra: dev
Requires-Dist: mypy<2,>=1.13; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.24; extra == 'dev'
Requires-Dist: pytest<9,>=8; extra == 'dev'
Requires-Dist: ruff<0.9,>=0.8; extra == 'dev'
Description-Content-Type: text/markdown

# demystify-gateway-sdk

Python client for the **[dmstfy-gateway](https://github.com/demystify-systems/ai-services-tools/tree/main/modules/dmstfy-gateway)**
data plane — a multi-tenant, OpenAI-compatible AI gateway with virtual keys,
per-tenant rate limits, micro-USD budget ledgers, and usage metering.

Part of the [Demystify Core Services](https://github.com/demystify-systems/ai-services-tools)
suite. Sync and async clients are provided; both speak the same wire contract
the gateway's mock and live backends share, so code written against the offline
mock runs unchanged against a real deployment.

## Install

```bash
pip install demystify-gateway-sdk
# or
uv add demystify-gateway-sdk
```

## Quickstart

```python
from demystify_gateway_sdk import create_gateway_client

client = create_gateway_client(
    base_url="http://localhost:8080",
    key="dmk_your_virtual_key",
    product="my-app",
)

res = client.chat(
    model="gpt-4o-mini",
    messages=[{"role": "user", "content": "Say hello in one sentence."}],
)
print(res["choices"][0]["message"]["content"])
print("cost µUSD:", res["usage"]["cost_micro_usd"])
```

Async is symmetric:

```python
from demystify_gateway_sdk import create_async_gateway_client

client = create_async_gateway_client(base_url="http://localhost:8080", key="dmk_...")
res = await client.chat(model="gpt-4o-mini", messages=[...])
```

## Public API

| Symbol | Purpose |
| --- | --- |
| `create_gateway_client` / `GatewayClient` | Synchronous client |
| `create_async_gateway_client` / `AsyncGatewayClient` | Asyncio client |
| `SpeechResult` | Typed result for audio transcription/speech endpoints |
| `GatewayError` | Raised on non-2xx responses (carries status + error taxonomy code) |

See the [module README](https://github.com/demystify-systems/ai-services-tools/tree/main/modules/dmstfy-gateway)
for the full endpoint reference, the admin/control-plane API, and how to run the
gateway offline with zero API keys.

## License

MIT © Demystify Systems
