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
Support
- Email: support@usefy.ai
- GitHub: github.com/sherlocq61/usefy
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.2.tar.gz
(16.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
usefy-1.0.2-py3-none-any.whl
(25.1 kB
view details)
File details
Details for the file usefy-1.0.2.tar.gz.
File metadata
- Download URL: usefy-1.0.2.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e453584dba33d86a77099d0550b0de495baf480e4f700a7eaddb9c2c02dd6372
|
|
| MD5 |
9dc1555ca26ad93757bb42a6dd531425
|
|
| BLAKE2b-256 |
9b53b6a58d7c78350b7651f4ba9b4a3dacd3cb2ee6b4265c3f6c1a19a30929f8
|
File details
Details for the file usefy-1.0.2-py3-none-any.whl.
File metadata
- Download URL: usefy-1.0.2-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
543704e24eaaf1bd99a9dfc56e6bb44ebdf92689e4f685fe75f7412caaa56757
|
|
| MD5 |
2168571124c3d77d9c54a483d56cdfca
|
|
| BLAKE2b-256 |
21a26b7c94640e15bc484e7ebdc355fdac07745f92a47e3372bf252c7def7533
|