Lutflow — AI Cost Intelligence for LLM inference
The Lutflow SDK gives developers a first, honest handle on what LLM inference costs — and how to keep it in check. Track and enforce your provider spend in-process (OpenAI · Anthropic · Gemini), with budget strategies that fit your workflow.
pip install lutflow
Offline-first — no account, no backend needed to start.
What this SDK is today
| Capability | Status | Notes |
|---|---|---|
| In-process budget enforcement | ✅ Ships, real | Tracks token/GPU-time spend in your process and, on breach, raises, warns, runs a callback, or SIGKILLs the current process. |
| Provider wrappers | ✅ Ships, real | OpenAI, Anthropic, Google Gemini — wrap the client, spend is metered per call. |
| Pricing tables | ✅ Ships, real | Token and GPU-hour pricing with per-model overrides. |
lutflow measure |
✅ Ships, real | Small offline utility: cost & energy metrics from a telemetry export. Read-only, no network. |
Budget enforcement acts only on the current Python process (raise / warn / callback /
SIGKILLofos.getpid()) — it is not cluster-level workload termination.
The connected Lutflow platform — fleet-wide cost intelligence — is in private development.
In-process budget enforcement
Wrap your provider client; Lutflow meters every call and enforces the limit locally. This runs entirely in your process — no account, no network.
from lutflow import Client, BudgetStrategy
import openai
client = Client(
tenant_id="acme",
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}")
When the budget is exceeded, the configured strategy fires in this process:
| Strategy | Behavior (in-process) |
|---|---|
RAISE_ERROR |
Raises BudgetExceededError (default) |
WARN_ONLY |
Logs a warning, continues |
CALLBACK |
Calls a function you provide |
SELF_KILL |
Sends SIGKILL to the current process (os.getpid()) |
A context-manager form is also available:
from lutflow import budget_session
with budget_session(budget_usd=0.50, tenant_id="acme") as session:
wrapped = session.wrap(openai.OpenAI())
...
GPU-time pricing (self-hosted models)
from lutflow import Client, PricingMode
client = Client(
tenant_id="acme",
budget_usd=5.00,
pricing_mode=PricingMode.GPU_TIME,
gpu_type="nvidia-l4",
)
client.start_gpu_timer()
# ... run inference ...
cost = client.stop_gpu_timer()
lutflow measure — cost & energy metrics from a telemetry export
A small offline utility: point it at a GPU telemetry export and get a per-concurrency breakdown of cost and energy per token. Read-only, no network.
lutflow measure --from-telemetry telemetry.jsonl --price-per-hr 0.85
Installation
pip install lutflow # Core + CLI (measure + in-process enforcement)
pip install lutflow[openai] # + OpenAI wrapper
pip install lutflow[anthropic] # + Anthropic wrapper
pip install lutflow[gemini] # + Google Gemini wrapper
pip install lutflow[all] # All providers
Supported providers: OpenAI, Anthropic, Google Gemini, and self-hosted (vLLM / TGI / BentoML via GPU-time pricing).
Links
- Website: lutflow.dev
- PyPI: pypi.org/project/lutflow
- Support: oscarmatiasg@lutflow.com
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
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
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
File details
Details for the file lutflow-0.2.0.tar.gz.
File metadata
- Download URL: lutflow-0.2.0.tar.gz
- Upload date:
- Size: 42.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f5081ff3fbb05bab3d02ad55377d83860401baa2c0896d2e242c0a40aa375a83
|
|
| MD5 |
cbd4e0148a90a8fa7237a247da90b0ba
|
|
| BLAKE2b-256 |
cb6104994de5553a570962b42ba0588b9dbbdb4d684f83124aa34492b2729ce7
|
Provenance
The following attestation bundles were made for lutflow-0.2.0.tar.gz:
Publisher:
publish.yml on Lutflow/lutflow-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lutflow-0.2.0.tar.gz -
Subject digest:
f5081ff3fbb05bab3d02ad55377d83860401baa2c0896d2e242c0a40aa375a83 - Sigstore transparency entry: 2209647464
- Sigstore integration time:
-
Permalink:
Lutflow/lutflow-python@f66a7e61ebe15ddae8d14926f12a823374f95f85 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/Lutflow
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f66a7e61ebe15ddae8d14926f12a823374f95f85 -
Trigger Event:
push
-
Statement type:
File details
Details for the file lutflow-0.2.0-py3-none-any.whl.
File metadata
- Download URL: lutflow-0.2.0-py3-none-any.whl
- Upload date:
- Size: 30.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
23d0cacf0bb3e2c866eb37560ca2d688713f87d89933ef733a2b7bb401d075ac
|
|
| MD5 |
e00a829251f32681d789527ee91d2460
|
|
| BLAKE2b-256 |
acce85d466bbb7ff82b823aaf7872846027f130f34718d70d268ff341a595db7
|
Provenance
The following attestation bundles were made for lutflow-0.2.0-py3-none-any.whl:
Publisher:
publish.yml on Lutflow/lutflow-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lutflow-0.2.0-py3-none-any.whl -
Subject digest:
23d0cacf0bb3e2c866eb37560ca2d688713f87d89933ef733a2b7bb401d075ac - Sigstore transparency entry: 2209647488
- Sigstore integration time:
-
Permalink:
Lutflow/lutflow-python@f66a7e61ebe15ddae8d14926f12a823374f95f85 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/Lutflow
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f66a7e61ebe15ddae8d14926f12a823374f95f85 -
Trigger Event:
push
-
Statement type: