Skip to main content

Usefy SDK - Thin wrapper for AI providers via Usefy proxy

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-2.0.0.tar.gz (17.6 kB view details)

Uploaded Source

Built Distribution

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

usefy-2.0.0-py3-none-any.whl (26.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for usefy-2.0.0.tar.gz
Algorithm Hash digest
SHA256 c173a7057ece04b97ddeef9bf7024d0c5b176feeef84204293d209fdf2903939
MD5 8e61a364cdf6b90db3046773303a44e1
BLAKE2b-256 327efd84e71a3b317e3ce95a4f493d2e4faac00390efda53829028404ee2477c

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for usefy-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6e09ce990e33cffadd3a319299046321ce0b8eea41fa0b44427900c67be32275
MD5 17af40ff7d87a7aa1bcad973d19a9550
BLAKE2b-256 374a6c52a9fea721a95e0ae52d934cecba69738588a8b574dbce03ce613ee93f

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