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.4.tar.gz (7.4 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.4-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tolvyn-0.1.4.tar.gz
  • Upload date:
  • Size: 7.4 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.4.tar.gz
Algorithm Hash digest
SHA256 82f916d29ec5221bacbb632ffd5a0acb7fcd8b63b29fc340c27b9c88b5e963a3
MD5 9bf21d2ad81e1e7b49d6a89ece3dd447
BLAKE2b-256 f2e2b2b4f54dc81c24ce852b786eb2c7ee544d9d8b96f54b4592eae2c122416d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tolvyn-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 7.4 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 0ba05292b1fbc5e559cc27f748d2d9dbe792b5738f4dd9c241f68bae1a173fcd
MD5 9536ab6d14b8c51a0f5d1b33d8a20afc
BLAKE2b-256 45316955ee818c556fdf5d16bd3d63c5a0a6152e84aeae0c6e9b4a6db485b807

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