Documentation
MarginFuse answers one question your billing system cannot: which customers cost you more in AI than they pay you. It connects your revenue to the cost of every AI request, and it can stop the requests that lose money before they run.
Two ways to integrate
They are the same SDK and you can move between them. The difference is whether MarginFuse is allowed to answer before your provider call, or only hears about it afterwards.
Measure
track()
One call after each AI request. Fire and forget, never blocks, never throws. You get margin per customer, per plan and per feature. Free forever.
Protect
guard()
One wrapper around the request. MarginFuse answers first, so a policy can downgrade the model, ask for a top-up, or stop the call. Runs in dry-run until you say otherwise.
What the SDK promises
It sits inside somebody else’s request path and holds their API key, so two rules hold the whole design together.
- It never breaks your application. It does not throw into your code, and it does not block your request on MarginFuse being reachable. If a decision does not come back in time, the request proceeds unprotected and says so.
- It never runs a call it was told not to run. Enforcement that leaks is worse than none: the customer pays and nothing is saved.
Neither is a promise in prose. Both are scenarios in a shared conformance suite that every MarginFuse SDK, in every language, is driven through before it can be published.