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.2.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.2-py3-none-any.whl (25.1 kB view details)

Uploaded Python 3

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

Hashes for usefy-1.0.2.tar.gz
Algorithm Hash digest
SHA256 e453584dba33d86a77099d0550b0de495baf480e4f700a7eaddb9c2c02dd6372
MD5 9dc1555ca26ad93757bb42a6dd531425
BLAKE2b-256 9b53b6a58d7c78350b7651f4ba9b4a3dacd3cb2ee6b4265c3f6c1a19a30929f8

See more details on using hashes here.

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

Hashes for usefy-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 543704e24eaaf1bd99a9dfc56e6bb44ebdf92689e4f685fe75f7412caaa56757
MD5 2168571124c3d77d9c54a483d56cdfca
BLAKE2b-256 21a26b7c94640e15bc484e7ebdc355fdac07745f92a47e3372bf252c7def7533

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