Know what your AI work costs.Without keeping what it said.
Self-hosted gateway. Payload-free receipts. Apache 2.0.
tryinferrail.com
No account. Personal hosted gateway in seconds — demo mode needs no key at all.
Or self-host:pip install inferrail
Runs on your own machine. No account, ever, for this path either.
Three commandsto a real, payload-free receipt.
pip install inferrail
pip install inferrailApache-2.0. No account required, ever, for this path.
inferrail serve --quickstart
inferrail serve --quickstartPrints the exact one-line base_url change for the OpenAI SDK and the Anthropic SDK — copy-pasteable, printed on startup.
inferrail report
inferrail reportA one-line summary prints to your terminal the instant each request completes. No key yet? inferrail demo runs the same real pipeline offline, zero-key.
A real receipt — every field this schema can ever hold
{
"receipt_id": "ir_9e841cb322de",
"route": "passthrough",
"provider": "openai",
"model": "gpt-4o-mini",
"status": "success",
"prompt_tokens": 812,
"completion_tokens": 143,
"estimated_cost_usd": "0.000362",
"attributes": {"customer": "acme", "work_id": "wid_contract_1"},
"total_latency_ms": 842.1
// no "prompt", "messages", "content", or "response" field exists on this schema
}
Work, not tokensA contract review costs $2.14 and completed. Not "you spent $4,000 on GPT-4 last month."
Inferrail groups related requests under a work_id you choose — a support ticket, an invoice, a contract review — and attaches the outcome your application declares for it. The answer it gives back is about the unit of work, not the raw token count.
One work_id, several requests, one answer
Tag a request with X-Inferrail-Attribute-Work-Id: wid_contract_1 (or -a work_id=... via inferrail try), then inferrail work outcome wid_contract_1 --status resolved when your application knows how it ended. inferrail work wid_contract_1 gives you this back — the engineer who's been answering "what does this feature cost us per customer?" with a spreadsheet gets a real number after a day of traffic: inferrail report --by customer.
What Inferrail keeps, and what it doesn'tStated plainly, including what it doesn't protect.
Schema plus tests
Receipts have no field for prompts or responses
A receipt is a small, explicit set of fields: route, provider, model, token counts, price snapshot, cost, status, timing, and your own attribution tags. None of them is a message field, and the gateway never hands message bodies to the receipt builder. Canary tests in this project's CI check that for success, error, and streaming requests. Attribution tags are stored exactly as you send them, so keep secrets and message content out of them. See the schema yourself, no key needed:
inferrail verify-payload-freePrints the real, running schema and checks its field names. It is a schema check, not a security audit: it cannot inspect values you store, your logs, or your provider.
The honest limit
Your provider still sees the prompt
Inferrail is a pass-through gateway, not a privacy barrier against OpenAI or Anthropic. The request still reaches them exactly as it would without Inferrail in the path. What is narrower and testable: Inferrail's own receipts and telemetry are built without message bodies. The self-hosted gateway reads your provider key from its own environment. The hosted trial is different: if you add a real key there, the hosted process holds it in memory and handles your traffic.
Never overspend on workThe cap fires before the bill does.
One flag, on the quickstart path
A daily ceiling, enforced before the provider is ever called
For the founder or ops lead who's had a surprise provider bill: set a global, block-mode daily cap in the same command that starts the gateway. A request that would cross it is rejected with HTTP 402 — a machine-readable error naming the exact budget, the limit, and what was spent so far — before any provider is contacted. The block itself is still recorded as a normal receipt, so nothing about it is hidden after the fact.
inferrail serve --quickstart --daily-budget-usd 5.00Scoped budgets (per-project, per-work_id, warn-instead-of-block) via inferrail budget set — see the full design.
Watch it arriveA local dashboard, left open on a second monitor.
Local, no account, same process as the gateway
Live Feed, Work, Budgets, Recover, Connect, Settings
Receipts land in the Live Feed the moment they're recorded. The Work screen rolls them up by work_id; Budgets shows the burn bar against whatever cap you set; Recover surfaces anything waiting on human review; Connect gives you copy-paste snippets (curl, the Anthropic SDK, the OpenAI SDK, LangChain) generated against your own running instance, not a generic placeholder host. Served by the exact same process as the gateway — nothing leaves your machine to render it.
inferrail serve --quickstart --app-modePrints a ready-to-open dashboard URL with a per-install token already embedded.
Your agents can askCost and health, over MCP — read-only.
stdio MCP server
get_spend and get_health
get_spend aggregates your local receipt ledger by provider, model, route, or any attribution tag you've attached, over an optional time window — reads a local file, makes no network call, can't incur provider cost. get_health checks whether a gateway is reachable and reports the most recent receipt as evidence of activity, without ever making a new inference call as a side effect.
See it on a real jobAP invoice-exception recovery, built on this same receipt substrate.
One eligible invoice-extraction exception, decided (one permitted machine retry, or your established human-review path), executed, and recorded — the same payload-free cost discipline applied to one real, whole job, not just one request.
Self-serve sandbox
Get your own key and run it — four commands, no signup
A demo instance runs at inferrail-ap-exceptions.onrender.com — Render's free tier, with no persistent disk: every record on it is synthetic and disposable, gone on the next restart or idle spin-down, never used for real customer data. POST /v1/sandbox issues you your own short-lived, isolated API key — no account, no human in the loop. Run the four commands below, unmodified, from any machine with curl. Every response is tagged "sandbox": true; the key expires, is capped in size, and is rate-limited. Prefer zero network calls? pip install inferrail && inferrail ap demo runs the same decision engine locally instead.
curl -s -X POST https://inferrail-ap-exceptions.onrender.com/v1/sandbox1. get a sandbox key · no account needed · the instance may take a minute to wake if it's been idle
export API_KEY=sbx_paste-your-key-herepaste the "api_key" value from step 1's response above
curl -s -X POST https://inferrail-ap-exceptions.onrender.com/v1/decisions \
-H "Authorization: Bearer $API_KEY" -H "Content-Type: application/json" -d '{
"work_id": "SANDBOX-DEMO-1",
"checkpoint_attempt_id": "SANDBOX-DEMO-1-checkpoint",
"failure_type": "low_confidence",
"confidence": 0.6,
"cost_so_far_usd": "0.10",
"policy_config": {
"eligible_failure_types": ["low_confidence", "validation_check_failed"],
"retry_floor": 0.5,
"human_review_threshold": 0.75,
"max_retry_cost_usd": "1.00",
"decision_deadline_seconds": 86400
}
}'2. create a decision — a real policy evaluation, not canned output
curl -s -X POST https://inferrail-ap-exceptions.onrender.com/v1/decisions/SANDBOX-DEMO-1/retry-attempts \
-H "Authorization: Bearer $API_KEY" -H "Content-Type: application/json" -d '{
"attempt_id": "SANDBOX-DEMO-1-attempt-1",
"status": "success",
"cost_usd": "0.06",
"validation_passed": true,
"validator_version": "ap.validator/v1"
}'3. record a retry attempt, as your own RetryAdapter would
curl -s https://inferrail-ap-exceptions.onrender.com/v1/report \
-H "Authorization: Bearer $API_KEY"4. read your own report back — expect retry_resolved, observed_cost_complete: true
Self-hosted, optional
Deploy your own AP Exceptions instance
Run the AP decision/persistence/reporting steps over an authenticated HTTP API instead of a local store — isolated per API key, with rate limits and a documented crash-recovery path. Retry execution always happens in your own process, never on this service.
Deploy your own instanceFull contract
Failure types, retry method, validation, human-review handoff
Supported failure types, the retry method and its cost boundary, the validation contract, the human-review handoff, versioned policy config, persistence/idempotency, and the auditable report — the same discipline as the gateway's own receipts, applied to one whole job.
See the full contractWorks with what you haveOpenAI SDK, Anthropic SDK, curl, LangChain.
Two wire formats, real streaming, real tool use
OpenAI-compatible and Anthropic-compatible, both wire-native
A genuine, separate /v1/messages passthrough — not a translation of /v1/chat/completions — with real streaming and tool use, priced from an independently-verified catalog. This is what makes pointing Claude Code, or any Anthropic SDK client, at Inferrail work, alongside every OpenAI-SDK-based tool and LangChain's own OpenAI-compatible client.
Experimental, testnet onlySecondary capabilities for autonomous agents.
For autonomous agents
Buy Work Economics per call
Submit payload-free economic metadata for one unit of AI work and get back a normalized cost analysis plus a commercial receipt, paid per call over x402 — no subscription, no Inferrail account.
See the Work Economics capabilityAlso experimental, testnet only
Coordinate a shared spending boundary
Inferrail Economic Authority lets multiple agents coordinate a caller-declared, cooperative spending boundary, paid per session over x402. Inferrail records and coordinates it within its own service only; it does not control external wallets, providers, or network spending, and is not real-world spend enforcement.
See the Economic Authority capability