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

Uploaded Python 3

File details

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

File metadata

  • Download URL: tolvyn-0.1.2.tar.gz
  • Upload date:
  • Size: 7.0 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.2.tar.gz
Algorithm Hash digest
SHA256 c09b46f1ccba22e41021de7ecfcad6fbdb4e80fb72dbdf161713844e1a957090
MD5 6b811f06bfe3a8176b66ca0f61d44254
BLAKE2b-256 b143292b7ee2e6331e011d00048857059ae10ac4bae7fe32f2307207fb7c575c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tolvyn-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 7.0 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1b16fc8d35f11541294b900f44518c3be63fe25dd8abc637992976eeab55ff00
MD5 e69e0ff0230af7f3bafac39db9eb1c31
BLAKE2b-256 55ccbe82e66d5707c0e96de95f9e0c56e4ca3e61450669d533d5612cfe447545

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