Skip to main content

GPU Financial Firewall — budget enforcement for AI inference

Project description

Lutflow — GPU Financial Firewall

Budget enforcement for AI inference workloads. Track costs, enforce budgets, kill runaway GPU spending in real time.

pip install lutflow

5-Line Quickstart

from lutflow import Client
import openai

client = Client(tenant_id="acme", budget_usd=10.00)
wrapped = client.wrap(openai.OpenAI())
response = wrapped.chat.completions.create(model="gpt-4o", messages=[{"role": "user", "content": "Hello!"}])

Lutflow tracks every token, calculates cost, and terminates the process if the budget is exceeded.

CLI

# GPU price lookup (powered by TinyFish)
lutflow lookup --gpu nvidia-l4

# Deploy with budget enforcement
lutflow deploy --model TinyLlama/TinyLlama-1.1B-Chat-v1.0 --budget 0.10

# Live dashboard
lutflow watch

# Check deployment status
lutflow status <deployment_id>

# Manual kill
lutflow kill <deployment_id> --reason overspend

Installation

pip install lutflow            # Core + CLI
pip install lutflow[openai]    # With OpenAI wrapper
pip install lutflow[anthropic] # With Anthropic wrapper
pip install lutflow[all]       # All providers + Kafka transport

SDK Usage

Token-Based Pricing (API Providers)

from lutflow import Client, BudgetStrategy

client = Client(
    tenant_id="my-tenant",
    api_key="lut_xxx",
    budget_usd=10.00,
    on_budget_exceeded=BudgetStrategy.RAISE_ERROR,
)

wrapped = client.wrap(openai.OpenAI())
response = wrapped.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": "Hello!"}],
)

print(f"Spent: ${client.accumulated_cost_usd:.4f}")
print(f"Remaining: ${client.remaining_budget_usd:.4f}")

GPU-Time Pricing (Self-Hosted Models)

from lutflow import Client, PricingMode

client = Client(
    tenant_id="my-tenant",
    budget_usd=5.00,
    pricing_mode=PricingMode.GPU_TIME,
    gpu_type="nvidia-l4",
)

client.start_gpu_timer()
# ... run inference ...
cost = client.stop_gpu_timer()

GPU Price Lookup (TinyFish)

from lutflow.tinyfish import TinyFishClient

tf = TinyFishClient()  # Uses TINYFISH_API_KEY env var
result = tf.fetch_all_prices(gpu_type="nvidia-l4")

best = result.cheapest
print(f"Cheapest: {best.provider} at ${best.spot_usd_per_hour:.2f}/hr")

Budget Strategies

Strategy Behavior
SELF_KILL Sends SIGKILL to the process (default)
RAISE_ERROR Raises BudgetExceededError
WARN_ONLY Logs warning, continues execution
CALLBACK Calls a custom function you provide

Supported Providers

  • OpenAI — GPT-4o, GPT-4, GPT-3.5, embeddings
  • Anthropic — Claude 3.5, Claude 3 Opus/Sonnet/Haiku
  • Google — Gemini 1.5 Pro/Flash
  • Self-hosted — vLLM, TGI, BentoML (GPU-time pricing)

Environment Variables

Variable Description
LUTFLOW_ENDPOINT API endpoint (default: https://api.lutflow.dev)
TINYFISH_API_KEY TinyFish API key for live GPU pricing

Links

License

Business Source License 1.1 (BSL 1.1)

  • Free for: internal use, development, testing, evaluation, non-commercial use
  • Commercial license required for: offering GPU cost management as a service
  • Change Date: March 29, 2030 (converts to Apache 2.0)

See LICENSE for full terms. For commercial licensing: licensing@lutflow.com

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

lutflow-0.1.0a1.tar.gz (28.9 kB view details)

Uploaded Source

Built Distribution

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

lutflow-0.1.0a1-py3-none-any.whl (30.2 kB view details)

Uploaded Python 3

File details

Details for the file lutflow-0.1.0a1.tar.gz.

File metadata

  • Download URL: lutflow-0.1.0a1.tar.gz
  • Upload date:
  • Size: 28.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for lutflow-0.1.0a1.tar.gz
Algorithm Hash digest
SHA256 33a70d36041084b05de3da7e0a17eee8785c5e6630c19c5614a44c99b2cbc9a6
MD5 2ef298f19687912906e10f443de529a9
BLAKE2b-256 69e2c8e4356b195c150dcd8a97adef2640ab38725771736e8b9631e8bec24581

See more details on using hashes here.

File details

Details for the file lutflow-0.1.0a1-py3-none-any.whl.

File metadata

  • Download URL: lutflow-0.1.0a1-py3-none-any.whl
  • Upload date:
  • Size: 30.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for lutflow-0.1.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 e7149ec8f0624a571b13108809d8e973fb22619614d002033192ce7e552a63cb
MD5 4467f98add6c96fe9d63bcaf0fb96951
BLAKE2b-256 fbca319aa623402022b287fa46631f9a92b7bd468b7f5e73e868826efd900bb8

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