Read-only MCP tools over Inferrail's local receipt ledger: attributed spend and gateway health.
Copy the AI prompt to install this server into Claude Code, Cursor, or another agent β or use 1-click editor setup below.
We haven't yet run this listing's install command through our automated sandbox check. This isn't a red flag β we're steadily working through the catalog.
π‘ Paste the JSON block into your client's configuration file under mcpServers, then restart the application.
Know what your AI work costs.
Inferrail turns supported OpenAI chat-completion traffic into local,
attributable economic receipts. Give related requests a customer-defined
work_id, declare an outcome when your application knows one, and inspect the
known inference economics associated with that work without storing prompts,
responses, or tool payloads in Inferrail's own records.
For the supported chat-completions surface, Inferrail records known cost when
measured usage and a verified price are available. Otherwise it reports
unknown, never a fabricated $0.
Current main / upcoming Work Economics release. Work Economics was added
after the current PyPI release. To try the current product before the next
release, install from main:
The demo needs no API key, no network call, and no provider billing. It runs
canned requests through Inferrail's real engine with made-up prices labeled
DEMO, then shows receipts, attribution, work-level economics, and explicit
unknown evidence.
Stable PyPI release. pip install inferrail currently installs 0.1.2.
It includes the gateway, receipts, reports, and TaskTransaction, but not the
new work commands. It remains the stable released install until the next
package publication.
work_id that your application
defines.You decide what a unit of work means: a contract review, support resolution, coding task, research run, or document-processing job. Inferrail associates economic evidence with the identifier your application supplies; it does not interpret the business meaning of that identifier or its outcome.
Request economics: what known inference economics belong to one request?
Work Economics: what known inference economics belonged to the customer-defined unit of work those requests were performing?
This is not a full cost of work, COGS, margin, or business-value calculation.
The following uses real provider requests and requires OPENAI_API_KEY:
For a gateway client, the equivalent generic attribution header is:
The deterministic offline demo includes this synthetic example:
resolved is only the demo application's own outcome meaning. Inferrail does
not treat any outcome status as universally successful.
If Inferrail cannot verify the price for an observed inference event, its cost
remains unknown rather than being treated as zero. No receipt evidence is
also not the same thing as known zero cost.
inferrail try is the shortest route to one real receipt. It uses your
existing OPENAI_API_KEY; if it is not set, Inferrail prints what is required.
It prints the response, receipt, measured tokens, known cost or unknown, the
local receipt path, and the next report command.
One payload-free JSON receipt per supported request:
(Trimmed β the full record also carries pricing provenance, status, route, timestamp, latency, and retry count. See Privacy boundary below for the complete shape.)
One task is rarely one call. Tag every request belonging to one unit of work with the same attribution value, then ask Inferrail what the task cost:
This TaskTransaction example uses real provider requests and a task_id.
The offline demo instead correlates requests with work_id and shows Work
Economics. Over HTTP, an
X-Inferrail-Attribute-Task-Id: bug_9281 header does the same thing;
inferrail.track_task(task_id=...) (see Attribute spend
below) attaches it automatically to every nested call in an agent run, no
header-threading required. See
docs/adr/0008.
For a long-running application, start the separate gateway process. The gateway process must have access to the provider credential through the configured environment variable; a key held only inside application memory is not automatically transferred to the gateway.
The response is standard OpenAI choices/usage plus a non-standard
inferrail block (route, provider, latency, retries) any OpenAI client
already ignores. X-Inferrail-Attribute-* headers are optional
attribution β never forwarded upstream. See
examples/basic_chat_request.py for a
minimal Python client, or point a supported OpenAI-compatible chat client at
http://127.0.0.1:8000/v1. An OpenAI SDK client that does not set base_url
can use its existing OPENAI_BASE_URL environment mechanism instead.
The default receipt is one JSONL line per supported request in
./inferrail-receipts.jsonl, relative to the gateway's working directory.
Treat that file as machine/audit evidence; use inferrail report for the
human aggregate, inferrail transaction <task-id> for receipt-only task
grouping, and inferrail work <work-id> for work-attributed inference
economics plus a customer-declared outcome.
"model" normally selects a named route from inferrail.yaml (e.g.
"default"), which maps to a provider + underlying model. If
default_provider is set in your config, a model that matches no route
is instead forwarded to that provider unchanged β so "model": "gpt-5.6-sol" works with no route pre-registered for it. Named routes
always take priority. This passthrough is on by default for the
zero-config quickstart path, off by default otherwise. Full design:
docs/adr/0007.
Three ways to attach business context to a request, all landing in the
same attributes: dict[str, str] on its receipt:
X-Inferrail-Attribute-<Name>: <value>, e.g.
X-Inferrail-Attribute-Task-Id: bug_9281.inferrail try): --customer/--workflow shorthand, or
generic -a <name>=<value> for anything else, including task_id.inferrail.track_task attaches
X-Inferrail-Attribute-Task-Id to every outgoing request for the
duration of a with block or decorated function β no threading a
task_id parameter through nested function signatures by hand.No reviews yet β be the first to share how this listing worked for you.
Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.
[](https://allmcps.com/mcp/inferrail)<a href="https://allmcps.com/mcp/inferrail"><img src="https://allmcps.com/api/badge/inferrail?style=directory" alt="Inferrail on AllMCPs" /></a>