runtime guard active meter sync active

RUNTIME BILLING FOR AI SYSTEMS AND INFRASTRUCTURE.

AI is a black box.
Open it.

Meter AI calls in your runtime, enforce spend limits, and block overages before they execute.

Read docs

Free for 10K calls/month • No credit card

Scroll
POST /v1/chat/completions
modelgpt-4o user_iduser_123 tenant_idtenant_acme functionOpenAI.post schemabody.messages[0].content:string path/api/chat
200 OK
response_schemachoices[0].message.content:string total_tokens5247 prompt_tokens842 completion4405 latency_ms1284
stripe.meter_event
nameai_tokens_metered value5247 customer_idcus_ABC123 event_idevt_1AbC2DeF policystripe_metering + token_burst_guard
FUNCTION FLOW20 active
step 1TRIGGER: POST /api/chat
step 2FX: OpenAI.post · POST /api/chat
step 3💰 BILLING EVENT: usage_amount = 0 tokens
step 4ENFORCEMENT: blocked (478)
Runtime billing infrastructure

Runtime policy enforcement, not post-hoc alerts.

Catch expensive calls before they run. Every policy decision is linked to the full request path.

  • Stop over-limit calls early
  • Trace every block to source
  • Ship billing-ready events
See Documentation →

Your AI bill is lying to you.

What actually happens in production:

One malformed prompt triggered 47 retries.
The team noticed only when the invoice jumped. By $847.
UsageFlow sees the chain in real time and blocks before you're charged.
See How It Works →

Provider-aligned billing telemetry.

Read token values from provider responses and emit exact billing events with stable customer identity mapping.

prompt_tokens: 842
completion_tokens: 4,405
total: 5,247 tokens → $0.052
Stripe event: evt_1AbC2DeF ✓ delivered
View Integration Docs →

Every request becomes a billing decision - before execution.

Runtime Function Path

Request trigger to billing event in one sequence.

TRIGGERLIVE
→ API Request

POST /api/chat

72 req schema
LIVE
</> FX chatCompletion()UsageFlow
chatCompletion()

/src/ai.ts

Active
step 1
</> FX OpenAI.post() UsageFlow
OpenAI.post()

<from openai>

Active
step 2

Two Layers. One Platform.

UsageFlow meters AI calls and AI infrastructure at API and function level. Function-level where cost matters. API-level everywhere else.

Function-Level Metering

For AI calls, models, and expensive infra operations.

  • Provider token usage and cost
  • Retry loops (47 attempts)
  • Pre-execution blocking

47 retries = $847 • blocked before spend ✓

API-Level Metering

For traditional endpoints and quotas.

  • Request counts
  • Endpoint usage
  • Rate limiting

/api/users: 1,247 requests • quota: 950/1,000

Use Function-Level When:
  • Enforcing runtime spend limits
  • Billing by tokens, model, or function path
Use API-Level When:
  • Counting API requests
  • Managing quotas and standard rate limits

Most tools see the request. UsageFlow sees inside it.

Feature UsageFlow Kong OpenMeter
Function-Level Metering
API-Level Metering
Pre-Execution Blocking

Built to integrate: billing events, policy alerts, webhooks, and custom sinks.

Stripe Stripe Slack Webhooks Custom sinks

Meter at both levels with one integration.

One integration. Both layers. No extra config. Works across leading model providers and your internal function calls.

Node.jsNodeJS
import { ExpressUsageFlowAPI } from '@usageflow/express';
const usageFlow = new ExpressUsageFlowAPI('YOUR_API_KEY');
app.use(usageFlow.createMiddleware());
✓ Function-level: AI calls, tokens, retries, costs ✓ API-level: requests, quotas, rate limits
PythonPython
from usageflow.fastapi import UsageFlowMiddleware
app.add_middleware(UsageFlowMiddleware, api_key="YOUR_API_KEY")
✓ Function-level: AI calls, tokens, retries, costs ✓ API-level: requests, quotas, rate limits

FAQ

Clear answers on setup, performance, metering layers, and billing behavior.

UsageFlow intercepts supported AI function calls before they execute. If policy would be exceeded, the call is stopped before provider billing.
No. One integration tracks both. Use function-level metering for expensive AI operations and API-level metering for endpoint quotas.
Metering and observation are sub-millisecond in typical paths. Enforcement checks add minimal overhead relative to model latency.
No. UsageFlow runs as an SDK in your app runtime. No proxy, sidecar, or gateway migration required.
Gateways work at the HTTP layer. UsageFlow agents sit in your app runtime, report to the Ledger for metering and policy, and surface everything in the Console — so you catch retries, tool fanout, and function-level cost.
Built for teams shipping AI products.

Make AI spend enforceable.

Meter AI calls and infrastructure, enforce runtime policy, and ship Stripe-ready events from one control plane.

Read Documentation

Free for 10K calls/month • JavaScript & Python ready now • Golang API layer only