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

Uploaded Python 3

File details

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

File metadata

  • Download URL: tolvyn-0.1.3.tar.gz
  • Upload date:
  • Size: 7.1 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.3.tar.gz
Algorithm Hash digest
SHA256 9d8b43b59e647a75f26c37fffe8056c57ab65155d9c141c48156c8a0f82906c5
MD5 893199da64a302565356dc06cfc41863
BLAKE2b-256 bcc0fe2f86b2ff72f71a0f1cdb58e705961f06388c86e14f70c7e136b56f431a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tolvyn-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 7.2 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 34ee3d9e6b97512e815b157d2205e64c80b0e2889e10400d8c09217e60068709
MD5 0df2a7616fc559a8a8a63c9f04f35b34
BLAKE2b-256 d7178679d87244a5cddc4ee8bca46652c57464ce64869ade1b8e5fff3db2d46d

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