Skip to main content

Usefy Python SDK - Real-time AI cost control

Project description

Usefy 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 Usefy 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 usefy.ai/signup

2. Install

Python:

pip install usefy

JavaScript:

npm install usefy

3. Use

Python:

from usefy import UsefyClient
from openai import OpenAI

# Initialize
guard = UsefyClient(api_key="us_live_your_key_here", project_id="your_project")

# 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!"}]
)

JavaScript:

import { UsefyClient } from 'usefy';
import OpenAI from 'openai';

const guard = new UsefyClient({
    apiKey: 'us_live_your_key_here',
    projectId: 'your_project'
});

const openai = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });
const client = guard.wrapOpenAI(openai);

const response = await 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
  • โœ… And more...

Documentation

Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Your App   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”˜
       โ”‚
       โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚   Usefy 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

Pricing

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

Sign up now

Support

License

MIT License - USEFY LTD

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: usefy-1.0.1.tar.gz
  • Upload date:
  • Size: 16.4 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.1.tar.gz
Algorithm Hash digest
SHA256 0df671a54deb08406aefdf74af3688367fe235a6c08f23e3c2a2aba99bed93f2
MD5 1ddf779a092b2c714e309737428a2fdd
BLAKE2b-256 68a471beeb61a10e8bd8a27241ac108844654f024e69dd80b975b39f34eccf1c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: usefy-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 25.1 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 891dc86661aa19d24607856868c4c132cf1aad53002b342aaa0b46311f3716a5
MD5 d26b28a9f23df33ecfec886fcc022612
BLAKE2b-256 2a39619bab2bbdd8169ca57dcb39aacbc797ec35050dcb7daecf3e29d3ce1691

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