Inferrail

io.github.domondi1由 GitHub 账号 domondi1 发布v0.4.18更新于 Nov 3, 2026

面向智能体的本地、无负载的 AI 成本可视化。可按模型、路由或标记的工作查询支出。

AI 翻译由 AI 模型根据下方的原文描述翻译,可能有误。

原文描述

Local, payload-free AI cost visibility for agents. Query spend by model, route, or tagged work.

概览

Inferrail 的本地 MCP 服务;无需登录;STDIO。

暂无 AI 概览:以下信息来自注册中心条目和服务本身。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Inferrail,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

[Inferrail logo]

Inferrail

Spending limits, receipts and paid execution for AI agents.
Give each AI job a dollar budget that's enforced before the provider is called, and a cost receipt that never stores what the model said.

[CI] [PyPI version] [License: Apache-2.0]

Quickstart · For agents · How it works · Docs · tryinferrail.com

[Recording of a real Inferrail run. The gateway starts with its local dashboard. An agent script gives one AI job, contract-review-42, a $0.04 spending limit and makes six model calls: four are answered and two are blocked with HTTP 402 before reaching the model. The dashboard lists each call with its cost, then shows the job spent $0.0325 of its $0.0400 budget, with 2 requests blocked before reaching the provider.]

A real run of the gateway and dashboard with a local stand-in model: one job with a $0.04 limit, four calls answered, two refused with HTTP 402 before reaching the model. How it was recorded

What works today

Developer preview: interfaces may change before 1.0.

CapabilityWhat it doesWhereStatus
GatewayOpenAI- and Anthropic-compatible proxy you run yourself. A dollar budget per job, shared by parallel calls; a call that would exceed it gets HTTP 402 before the provider.pip install inferrailAvailable
Cost receiptsOne record per call: tokens, price, cost, status, your tags. Never prompts or responses. Totals by job, customer or any tag.local SQLite or JSONLAvailable
MCP serverRead-only get_spend and get_health tools over your local receipts.inferrail mcpPreview
Inferrail HostedThe same per-run budgets run for you, shared across agents and machines. 250 runs a month free, then USDC credits over x402. Bring your own provider key.hosted guidePreview
Web ReadOne public web page as clean markdown with a receipt, paid per call by the agent over x402 or MPP.belowPreview
Agent purchases under a job budgetOne budget covering model calls and x402 purchases; a purchase that doesn't fit is refused before it's signed. Local proof, no mainnet.exampleExperimental

Also experimental: AP invoice-exception recovery, a hosted trial gateway, and Work Economics / Economic Authority (example; Base Sepolia testnet only).

Quickstart

Requires Python 3.11+.

Try it offline. No API key, no network calls, no provider charges:

bash
pip install inferrailinferrail demoinferrail report --by customer --receipts ./inferrail-demo-receipts.jsonl

The demo sends scripted requests through the real engine to a fake provider with made-up prices labelled DEMO, and prints what they cost by customer.

Give one run a budget, inside your Python app. No config file, no second process:

python
import inferrailfrom openai import OpenAI
base_url = inferrail.start()   # the gateway, on a background thread in this processclient = OpenAI(base_url=base_url, api_key="unused")   # your key stays in OPENAI_API_KEYclient.chat.completions.create(    model="gpt-4o-mini",   # any model your account can use; `inferrail models` lists priced ones    max_tokens=200,    messages=[{"role": "user", "content": "Summarize this contract."}],    extra_headers={        "X-Inferrail-Attribute-Work-Id": "contract-review-42",   # the run        "X-Inferrail-Budget-Usd": "0.50",                        # its dollar ceiling    },)

Every call with the same work id shares that budget, including parallel calls; one that would push the run past it gets HTTP 402 before it reaches OpenAI. inferrail work contract-review-42 shows what the run cost.

More: run it as a shared gateway with the local dashboard, framework snippets (LangChain, LangGraph, OpenAI Agents SDK, CrewAI, Haystack, LlamaIndex, Microsoft Agent Framework), and other clients, including the Anthropic SDK.

For agents

Start at tryinferrail.com/llms.txt: what's live, with links to each service's guide and the OpenAPI contract.

Web Read sells one public web page as clean markdown, with its word count, a SHA-256 of the content and a receipt. $0.002 per delivered page, paid over x402 (USDC on Base) or MPP (Tempo); no account or API key. The payment is checked first and settled only after the page is delivered, so refusals (robots.txt, non-public addresses, non-text, over 2 MB, target-site errors) are never charged. Retrying the same url and request_id from the same wallet within 10 minutes returns the page already paid for.

bash
curl -i -X POST https://inferrail-cost-gateway.onrender.com/read/v1/page \  -H 'content-type: application/json' -d '{"url": "https://example.com/"}'# HTTP 402 with the price; an x402 or MPP client pays and repeats the request

Guides: Web Read · Hosted · service source.

MCP. Ask your agent what a job cost, from your local receipts:

bash
claude mcp add inferrail \  -e INFERRAIL_RECEIPTS_PATH=/absolute/path/to/inferrail-receipts.jsonl \  -- uvx --with "mcp>=2.0" inferrail mcp

Two read-only tools, get_spend (known cost and tokens by provider, model, route or any tag such as work_id) and get_health. They don't run inference, write files or pay for anything. Other clients: docs/integrations.md.

How it works

[Data flow. On your machine, your application sends requests to the Inferrail gateway, which reads the provider API key from its environment, forwards request content and the key to OpenAI or Anthropic, and returns the response. Separately, the gateway writes a metadata receipt (tokens, cost, status, timing, attributes, no message bodies) to a local JSONL or SQLite store that reports, the local dashboard, and MCP tools read. A usage beacon collector receives lifecycle events only if an endpoint is configured.]

The gateway routes each request by model to a configured provider, checks any budget in scope, forwards the call, and writes one receipt per request, including requests a budget refused. A cost is recorded only when the provider reports usage and a price is on file; otherwise it's unknown, never a guessed $0.

WhereWhat it sees or keeps
Your providerThe full request, exactly as it would without Inferrail, under the provider's own policies.
The gateway, in memoryYour provider key (from its own environment) and the prompts and responses it forwards.
Receipts, on your diskProvider, model, token usage, the price used and the cost, status, timing, and the attribution tags you send.
Not in receiptsPrompt and response bodies.

Attribution tags are stored as sent, so keep secrets and message content out of them. inferrail verify-payload-free prints the live receipt schema, and canary tests check that message bodies never reach receipts; neither is a security audit. The optional usage beacon sends nothing unless an endpoint is configured (details). Architecture: docs/ARCHITECTURE.md.

Current support

  • Endpoints: POST /v1/chat/completions (OpenAI-compatible) and POST /v1/messages (Anthropic-compatible), with streaming and tool calls, plus GET /v1/models.
  • Providers: OpenAI, Anthropic, and endpoints compatible with either. Built-in prices cover OpenAI and Anthropic models; others need a price in your config, or their cost stays unknown.
  • Not supported: the OpenAI Responses API, embeddings, image generation, audio and Realtime, batch, and native Gemini or Bedrock APIs. Fields the gateway can't account for are rejected with a clear error, never silently dropped.
  • Scope: only calls through a running gateway are counted.

Exact contract and non-goals: docs/PRODUCT.md. Running agent jobs that spend real money? Open a production setup request.

Documentation

Contributing, security, license

Questions and bugs: GitHub issues. Security or privacy vulnerabilities: report privately, as described in SECURITY.md. Contributing: CONTRIBUTING.md (pytest needs no API key or network). License: Apache-2.0.

来源:README.md,提交 7e3659f

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

13
  1. v0.4.18最新Nov 3, 2026
  2. v0.4.17Oct 31, 2026
  3. v0.4.16Oct 7, 2026
  4. v0.4.15Oct 6, 2026
  5. v0.4.14Oct 5, 2026
  6. v0.4.13Oct 4, 2026
  7. v0.4.12Oct 3, 2026
  8. v0.4.11Oct 1, 2026
  9. v0.4.9Oct 1, 2026
  10. v0.4.8Sep 30, 2026
  11. v0.4.6Sep 29, 2026
  12. v0.4.5Sep 26, 2026
  13. v0.1.1Sep 16, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分