Integration guide
From model call to customer margin.
Ganivra stays outside your model request path. Initialize once, attach the current tenant’s ID, and let Ganivra calculate provider cost, customer economics, trends, and margin.
SDK & REST API
Integration instructions.
Return here whenever you need to connect another service, review the event contract, or update your instrumentation.
Technical cost signals
Model and provider · input, output, and cached tokens · latency · status and errors · execution IDs
Business context
Your product or site · current tenant/customer ID · workflow · feature · prompt version · optional revenue
No customer registration required.
Read the signed-in tenant or account ID from your own request context and send it as customer_id. Every new value appears automatically in customer economics and cohorts.
- Your Ganivra workspace
- Your company
application- Product, site, or domain
customer_id- Current B2B tenant/account
- Plan assignment
- Only needed to calculate revenue automatically
python -m pip install ganivraimport ganivra
ganivra.init(api_key="your_key")This alone captures cost telemetry. No prompt or response content is collected.
def run_ai(account, request):
with ganivra.trace(
application="voice-platform",
customer_id=account.id,
workflow="outbound_call",
feature="sales_agent",
metadata={"plan": account.plan},
):
client.responses.create(...)Use a stable pseudonymous tenant ID—not a person’s name. Do this inside each authenticated request; Ganivra discovers customers automatically. Metadata accepts additional bounded JSON dimensions. Configure or assign a pricing plan separately when you want subscription, credit, token, or usage revenue.
What your team owns
A small, explicit contract.
Ganivra needs operational facts from the call and stable business identifiers from your application. Everything else can be added incrementally.
Execution telemetry
Provider, model, operation, token or unit usage, latency, status, and stable event/execution/step IDs.
Business attribution
application, dynamic customer_id, workflow, feature, and prompt version connect spend to the product and customer that caused it.
Revenue configuration
Assign subscription, token, credit, execution, or hybrid plans—or import billing actuals. Per-call revenue is not required.