Skip to main content

Python SDK for the dmstfy-gateway data plane (chat, embeddings, STT, TTS via one OpenAI-compatible endpoint)

Project description

demystify-gateway-sdk

Python client for the 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 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

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

Quickstart

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:

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 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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

demystify_gateway_sdk-0.3.0.tar.gz (24.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

demystify_gateway_sdk-0.3.0-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file demystify_gateway_sdk-0.3.0.tar.gz.

File metadata

  • Download URL: demystify_gateway_sdk-0.3.0.tar.gz
  • Upload date:
  • Size: 24.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for demystify_gateway_sdk-0.3.0.tar.gz
Algorithm Hash digest
SHA256 209c9134241e60761fc9c130d749a1324d16c075f2f9cc654ba697c244d80239
MD5 59b31e07f125830c70c86e9ab400560e
BLAKE2b-256 950150d9065394c5c085474ba74e8c7245925d7ba7b8f39f2b2530228b06d083

See more details on using hashes here.

Provenance

The following attestation bundles were made for demystify_gateway_sdk-0.3.0.tar.gz:

Publisher: publish-pypi.yml on demystify-systems/ai-services-tools

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file demystify_gateway_sdk-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for demystify_gateway_sdk-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9ecb49b7098cece1060b4ba567a0f61ef3375f518433d33703c7037184714406
MD5 edcfd8dcd2fe0056679a75715f8f9ce6
BLAKE2b-256 6f0cd37ee9cb0d49e79d1c21e6d320d7eee70de174b5f55c5af62b7dcd7498bf

See more details on using hashes here.

Provenance

The following attestation bundles were made for demystify_gateway_sdk-0.3.0-py3-none-any.whl:

Publisher: publish-pypi.yml on demystify-systems/ai-services-tools

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page