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.2.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.2.0-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: demystify_gateway_sdk-0.2.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.2.0.tar.gz
Algorithm Hash digest
SHA256 292fecee338ade23b20088b63057afeed7f1c2ed1d186a9ae48c63d654541abc
MD5 769e0283b4860db0b9c755b1b474a0cd
BLAKE2b-256 8289560b7828ceb697ae86850d8529227f195acb61123d7d4723e2f28047d556

See more details on using hashes here.

Provenance

The following attestation bundles were made for demystify_gateway_sdk-0.2.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.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for demystify_gateway_sdk-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 91ba3c065fc48c7f2fc7ece46db5985109641f3f66eba30958661d86dc02eb14
MD5 d234ca24cba02de740f1c4d188712887
BLAKE2b-256 d4fb153720e224096ca82c150faed5d61077bf3fdccb3fc114274e32a1877f13

See more details on using hashes here.

Provenance

The following attestation bundles were made for demystify_gateway_sdk-0.2.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