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

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for projectblock-0.1.0.tar.gz
Algorithm Hash digest
SHA256 237577b1801a95799db6699e33e38b9b544b3d19838da37401e1e48a6d90985a
MD5 fbe93cde6bac7f45e7551e08366d0f2b
BLAKE2b-256 0491029e61c60d9d45f742d491665610567c7dbf092e351ac2fe916da59a9189

See more details on using hashes here.

File details

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

File metadata

  • Download URL: projectblock-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.6 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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f3079a734d7d994c0db31b810bc052a7ebe2d9ee8fae865a17c542959bff94a4
MD5 dcb3283dd4ba8075949e1a42d70ba1bb
BLAKE2b-256 b18f65f7c02a23745a099cca1c1d490c1502342585fe911da86aff1405793373

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