Know what your AI agents cost. API gateway with budget enforcement, session tracking, and MCP tools.
Measure what your AI agents cost. Stop requests before they exceed a budget.
以下摘录自该仓库的 README(片段) · 在 GitHub 读完整 README →
Website | Docs | Pricing API | Architecture | Security | Assurance case
LLMKit is an open-source AI gateway and SDK suite for cost attribution, budget admission, and
request evidence. The gateway reserves estimated spend before provider dispatch. It rejects
requests that cannot fit the active budget, then settles admitted reservations to actual usage when
the response completes.
The repository also ships local tracking surfaces that do not require an LLMKit account or proxy.
Choose a surface
| Surface | Use it when | Package |
| --- | --- | --- |
| Python transport | You want local cost estimates around existing SDK calls | llmkit-sdk |
| CLI wrapper | Your OpenAI or Anthropic client honors its standard base-URL environment variable | @f3d1/llmkit-cli |
| TypeScript SDK | You have an existing key and want sessions, streaming, and gateway access from TypeScript | @f3d1/llmkit-sdk |
| MCP server | You want spend, budget, and local coding-session tools inside an MCP client | @f3d1/llmkit-mcp-server |
| AI SDK provider | You use Vercel AI SDK 6 | @f3d1/llmkit-ai-sdk-provider |
| Gateway and dashboard | You need shared budgets, provider routing, receipts, and analytics | packages/proxy, packages/dashboard |
Quick start
Local Python tracking
The transport reads provider usage metadata and estimates cost from the bundled pricing catalog. It does not send tracking data to LLMKit.
Zero-code CLI tracking
Use -v for per-request output or --json for machine-readable results.
Gateway mode (existing key)
Gateway examples require an existing LLMKit API key. Account creation and key management are
temporarily unavailable while the authenticated service is restored. If you do not already have a
key, use one of the local tracking paths above.
The budget path
The control path is built around three boundaries:
- **Atomic admission:** a Durable Object owns reservation state for each budget scope. Concurrent
requests cannot spend the same remaining balance.
- **Dispatch-aware idempotency:** deterministic failures before dispatch release the key. After
provider dispatch may have occurred, failures remain terminal to avoid duplicate spend.
- **Bounded responses:** non-streaming bodies and individual SSE frames have explicit byte limits.
LLMKit cancels upstream reads when a limit is exceeded.
Request receipts bind the admission decision, provider attempt, settlement, and analytics handoff
with stable identifiers. Database writes use an outbox, so an analytics outage does not silently erase
budget evidence.
MCP server
Five local tools inspect supported Claude Code sessions and Cline task data without an LLMKit key.
Six gateway tools query spend, budgets, keys, sessions, and service health when LLMKIT_API_KEY
contains an existing key. Together they expose 11 tools.
Pricing data
The pinned catalog is a bundled reference snapshot, not a live quote. One source file,
packages/shared/pricing.json, records the snapshot date and
generates the TypeScript, Python, and MCP tables. CI rejects drift between the source and generated
files. The public site renders only populated provider tables and displays the source date.
The public comparison endpoint requires no account:
The endpoint prices only the exact model keys supplied by the caller. It does not search for or