Marketplace & Billing
Agnitra converts optimization telemetry into billable usage so monetization teams can charge on measurable outcomes (speedups, GPU hours saved) rather than seat licenses. This guide shows how billing artifacts are produced and dispatched.Usage Event Model
Every optimization returns aUsageEvent that includes:
project_id,model_name,region, and optionalmetadatafor attribution.baselineandoptimizedmetrics (latency, tokens/sec, GPU hours).gpu_hours_saved,cost_savings, andtotal_billableamounts in the configured currency.providers— list of marketplace targets that should receive the event.- Delivery receipts per provider (
status,message,dispatched_at).
result.usage_event) for programmatic pipelines.
Dispatch Flow
- Enable marketplace adapters with extras:
- Configure credentials via environment variables (for example
AWS_ACCESS_KEY_ID,STRIPE_API_KEY, or custom secrets). - Call
agnitra optimize(CLI) oragnitra.optimize(SDK). The usage meter queues dispatch tasks after telemetry is persisted. - Inspect the
dispatch_resultsin the usage event to confirm delivery. Failed dispatches include retry hints orstatus: "deferred"when credentials are absent.
usage_id so retries do not double-bill customers.
Stripe Metered Billing
- Adapter:
StripeUsageDispatcher. - Expects
stripe_product_idandstripe_meter_idconfigured per project. - Sends usage shaped for Stripe’s metered billing API with timestamps derived from the optimization run.
- Retries on
429/5xxwith exponential backoff and surfaces final status in the usage event.
AWS Marketplace
- Adapter:
AwsMarketplaceDispatcher. - Requires IAM credentials scoped to the relevant product listing.
- Converts usage events into
BatchMeterUsagepayloads grouped bydimension(oftenproject_id+ hardware tier). - Emits
skippedstatus when credentials are missing so you can reconcile in post-processing jobs.
Custom Integrations
- Implement the
UsageDispatcherprotocol to route events to internal billing, analytics, or support systems. - Reference implementation:
agnitra/core/metering/dispatchers.py. - Register custom dispatchers via
AGNITRA_TELEMETRY_EXPORT=internal,billingto enable multi-target fan-out.
Auditing & Compliance
- Store raw usage events alongside telemetry for at least 13 months (typical cloud marketplace requirement).
- Sign payloads before transmitting to third parties when operating in regulated industries.
- Log
dispatch_resultsto your SIEM to trace who was billed, when, and which kernel changes drove the charges.
Related Reading
- Telemetry Playbook — how telemetry bundles feed usage events.
- Runtime Configuration — environment variables controlling providers and credentials.
- Control Plane Reference — REST endpoints for submitting usage events directly.