Skip to main content

AI usage metering & EU AI Act-ready audit trails — 3 lines of code.

Project description

ProjectBlock

AI usage metering & EU AI Act-ready audit trails. The infrastructure layer between your app and your LLM — 3 lines of code.

Install

pip install projectblock

Quickstart

import os
os.environ["PROJECTBLOCK_API_KEY"] = "pb_your_key_here"

from projectblock import gate, record

# 1. Check budget before calling your LLM
await gate("user_123", budget_usd=5.00)

# 2. Call your LLM as usual
response = await openai.chat.completions.create(model="gpt-4o", messages=messages)

# 3. Meter + audit in one call
await record(
    "user_123",
    model="gpt-4o",
    cost_usd=0.0023,
    tokens_input=response.usage.prompt_tokens,
    tokens_output=response.usage.completion_tokens,
)

gate() fails open by default — if ProjectBlock is unreachable, your app keeps working.

Get an API key

Sign up at project-block.com.

Docs

Full API reference: api.project-block.com/docs

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

projectblock-0.2.0.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

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

projectblock-0.2.0-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: projectblock-0.2.0.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for projectblock-0.2.0.tar.gz
Algorithm Hash digest
SHA256 b34fd1d29bc7468e8942a8c14c4f76f8dbbba2cafa5946dae221e981e2999450
MD5 3f4e1b1df909e5838bb5988d4575fe77
BLAKE2b-256 33c4b6d8b9cfd14405870c9996ae2a52b7452f22bf2236ac7e51ce60bd288853

See more details on using hashes here.

File details

Details for the file projectblock-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: projectblock-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for projectblock-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4096fb774f6f9320f7073c977d0cc491798d86c0cf4f4ca09cfb9dc479b8b7f1
MD5 a16828a23b0e41ded3dd6f6e5d080899
BLAKE2b-256 f4d2a65fe959acb56714c8a128b8133fe58c575ba2d185fd2a273f039d3be807

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