Skip to main content

Usefy Python SDK - Real-time AI cost control

Project description

UsageGuard SDK

Real-time cost control for AI & API platforms. Prevent budget overruns with pre-flight checks and automatic enforcement.

Features

  • ๐Ÿ›ก๏ธ Budget Enforcement - Block requests before they cost you money
  • โšก 12ms Latency - Minimal performance impact
  • ๐Ÿ”„ Fail-Open - Your app keeps running if UsageGuard is down
  • ๐Ÿ“Š Real-time Dashboard - Monitor usage and savings
  • ๐Ÿ”‘ API Key Management - Secure authentication
  • ๐ŸŽฏ Flexible Policies - Per-project, per-user, or custom scopes

Quick Start

1. Sign Up

Get your API key at usage-guard.vercel.app/signup

2. Install

pip install usageguard

3. Use

from usageguard import UsageGuard
from openai import OpenAI

# Initialize
guard = UsageGuard(api_key="ug_live_your_key_here")

# Wrap your client
client = guard.wrap_openai(OpenAI(api_key="your_openai_key"))

# Use normally - budgets enforced automatically
response = client.chat.completions.create(
    model="gpt-4",
    messages=[{"role": "user", "content": "Hello!"}]
)

Supported Providers

  • โœ… OpenAI (GPT-4, GPT-3.5, etc.)
  • โœ… Google Gemini (Pro, Flash, etc.)
  • ๐Ÿ”œ Anthropic Claude
  • ๐Ÿ”œ Azure OpenAI
  • ๐Ÿ”œ Custom providers

Documentation

Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Your App   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”˜
       โ”‚
       โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ UsageGuard SDK  โ”‚  โ† Pre-flight check
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
       โ”‚
       โ”œโ”€โ†’ โœ… Allowed โ†’ OpenAI/Gemini
       โ”‚
       โ””โ”€โ†’ โŒ Blocked (budget exceeded)

Performance

  • Latency: 12ms avg (P99: 45ms)
  • Availability: 99.9%
  • Fail-open: Yes (requests proceed if API down)

Security

  • SHA-256 API key hashing
  • TLS encryption
  • No data retention
  • SOC 2 compliant (coming soon)

Pricing

  • Free: 10,000 requests/month
  • Pro: $29/month - 100,000 requests
  • Enterprise: Custom pricing

Sign up now

Support

License

MIT License - see LICENSE

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

usefy-1.0.0.tar.gz (16.2 kB view details)

Uploaded Source

Built Distribution

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

usefy-1.0.0-py3-none-any.whl (25.0 kB view details)

Uploaded Python 3

File details

Details for the file usefy-1.0.0.tar.gz.

File metadata

  • Download URL: usefy-1.0.0.tar.gz
  • Upload date:
  • Size: 16.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for usefy-1.0.0.tar.gz
Algorithm Hash digest
SHA256 2038265a2a02858e550a18a37e9ab3adf7de52711ae6ba0a8c5f8fbbb3b2e0cf
MD5 3778bdf4cd00e490b2f10c6801058aee
BLAKE2b-256 4ed1b8de617fb2d701d486145bb218c89da9a0ea691cd750d55f05a05a05ad77

See more details on using hashes here.

File details

Details for the file usefy-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: usefy-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 25.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for usefy-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 91b84fb00f9b218f25b59d46cbf98289e0e29a1ca4c3e2a423486c1219e60746
MD5 80c2890298cd85b21eb9212986767ea7
BLAKE2b-256 c35de6409ed19ef01e6d7ddf8b154d2dd7785a9c8bb536216866847f51ce6c53

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