Skip to main content

Drop-in replacement for the OpenAI/Anthropic SDK — routes through TOLVYN for cost attribution, budget enforcement, and audit logging.

Project description

tolvyn · PyPI

PyPI version

Drop-in replacement for openai and anthropic. One line change. Every AI call metered, attributed, and governed.

Install

pip install tolvyn

Quick start

# Before
from openai import OpenAI
client = OpenAI()

# After — one line change
from tolvyn import OpenAI
client = OpenAI(
    tolvyn_api_key="tlv_live_...",
    team="backend",
    service="summariser",
)

# Everything else stays the same
response = client.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": "Hello"}],
)

Works the same way for Anthropic:

from tolvyn import Anthropic
client = Anthropic(tolvyn_api_key="tlv_live_...", team="ml", service="classifier")

What you get

  • Cost metering — every request logged with exact token counts and cost in microdollars
  • Team attribution — see spend by team and service, not just a total invoice number
  • Budget enforcement — set hard limits that block requests before they hit your provider
  • Immutable ledger — hash-chained audit trail, verifiable at any time
  • Drop-in — no changes to your existing API calls, models, or response handling

Environment variable mode

export TOLVYN_API_KEY="tlv_live_..."
export OPENAI_API_KEY="sk-..."     # your real provider key (stored encrypted on TOLVYN)
from tolvyn import OpenAI
client = OpenAI()  # picks up TOLVYN_API_KEY automatically

Full docs: docs.tolvyn.io/python-sdk Free trial: tolvyn.io


© 2026 TOLVYN. All rights reserved.

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

tolvyn-0.1.5.tar.gz (7.9 kB view details)

Uploaded Source

Built Distribution

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

tolvyn-0.1.5-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

Details for the file tolvyn-0.1.5.tar.gz.

File metadata

  • Download URL: tolvyn-0.1.5.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for tolvyn-0.1.5.tar.gz
Algorithm Hash digest
SHA256 19f569414abe65e44174c922cc06b3afe1d7ef780627b2d0aa464d91713b706f
MD5 d39838de3a24b69e1ef606772f5f8e99
BLAKE2b-256 4aed3f951f5064dd49bbaf0a2200d6bdfd98d8578ffdf378517dc05574c4189a

See more details on using hashes here.

File details

Details for the file tolvyn-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: tolvyn-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 7.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for tolvyn-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 6b2ba6f8b94372bf428639524a1959e659a809d8a6cee81c9b607f8610cec058
MD5 ec26313fac692f6be540f6fa2c60da33
BLAKE2b-256 d4e61951c03de6c494f88420249f6b560d477afe20dc79b2eea95e53ba5e2e33

See more details on using hashes here.

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