Llmkit

io.github.smigolsmigol由 GitHub 帳號 smigolsmigol 發布v0.4.10更新於 Oct 25, 2026

AI cost tracking: 11 tools for spend, budgets, and Claude Code + Cursor + Cline costs

概覽

AI 產生的概覽

本機 MCP 伺服器,讓助理查看 AI 編碼工作階段成本,並在設定 LLMKit 金鑰後查詢花費、預算、金鑰與服務健康狀態。

可以做什麼
檢查本機編碼工作階段:讀取支援的 Claude Code 工作階段與 Cline 任務資料,了解代理成本,不需 LLMKit 金鑰。查詢閘道花費與預算:設定金鑰後透過 LLMKit 閘道查看花費、預算狀態與工作階段。檢查金鑰與服務健康:查詢 API 金鑰和閘道服務狀態。依內建定價目錄快照估算成本,而非供應商即時報價。
適用情境
適合讓助理報告 Claude Code、Cursor 或 Cline 工作階段的成本,或針對既有的 LLMKit 閘道帳戶查看花費與預算狀態。本機檢查不需帳戶;閘道查詢需要既有金鑰。
執行需求
透過 stdio 在本機執行,通常以 npx 從 npm 套件啟動,因此需要 Node.js。LLMKIT_API_KEY 環境變數為選用,僅用於啟用閘道工具;本機工具不需它。LLMKIT_PROXY_URL 可覆寫預設的託管代理位址。帳戶建立與金鑰管理目前無法使用,閘道功能需既有金鑰。
安裝前請注意
閘道工具預設會向託管 LLMKit 代理送出查詢,除非將 LLMKIT_PROXY_URL 指向其他位址,否則花費、預算、金鑰與工作階段資料會離開本機。LLMKIT_API_KEY 是機密,應透過環境變數提供,不要提交到程式庫。本機工具會讀取磁碟上的 Claude Code 工作階段與 Cline 任務資料。定價為內建估算,並非供應商帳單。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Llmkit,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

[LLMKit]

Measure what your AI agents cost. Stop requests before they exceed a budget.

[CI] [PyPI] [npm] [OpenSSF Scorecard] [OpenSSF Best Practices] [MIT license]

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

SurfaceUse it whenPackage
Python transportYou want local cost estimates around existing SDK callsllmkit-sdk
CLI wrapperYour OpenAI or Anthropic client honors its standard base-URL environment variable@f3d1/llmkit-cli
TypeScript SDKYou have an existing key and want sessions, streaming, and gateway access from TypeScript@f3d1/llmkit-sdk
MCP serverYou want spend, budget, and local coding-session tools inside an MCP client@f3d1/llmkit-mcp-server
AI SDK providerYou use Vercel AI SDK 6@f3d1/llmkit-ai-sdk-provider
Gateway and dashboardYou need shared budgets, provider routing, receipts, and analyticspackages/proxy, packages/dashboard

Quick start

Local Python tracking

bash
pip install llmkit-sdk
python
from llmkit import trackedfrom openai import OpenAI
costs = []client = OpenAI(http_client=tracked(on_cost=costs.append))
client.chat.completions.create(    model="gpt-4.1",    messages=[{"role": "user", "content": "Summarize this incident."}],)
print(f"${sum(item.total_cost or 0 for item in costs):.6f}")

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

bash
npx @f3d1/llmkit-cli -- python my_agent.py

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.

python
from openai import OpenAI
client = OpenAI(    base_url="https://api.llmkit.sh/v1",    api_key="llmk_your_key_here",)
response = client.chat.completions.create(    model="gpt-4.1",    messages=[{"role": "user", "content": "Draft a release note."}],)

The budget path

[LLMKit authenticates each request, reserves its estimated cost, rejects requests over budget before provider dispatch, and settles admitted requests to actual usage.]

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

json
{  "mcpServers": {    "llmkit": {      "command": "npx",      "args": ["-y", "@f3d1/llmkit-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:

text
https://api.llmkit.sh/v1/pricing/compare?mode=text-token&models=anthropic%2Fclaude-sonnet-4-6%2Copenai%2Fgpt-4o&input=1000&output=1000&cacheRead=0&cacheWrite=0

The endpoint prices only the exact model keys supplied by the caller. It does not search for or recommend the cheapest model. Pricing is an estimate, not a provider invoice. Provider billing rules, model modality, and catalog freshness remain part of the error boundary.

Evidence and current boundary

ClaimEvidence in this repositoryBoundary
Concurrent budget admission is serializedWorker fixtures exercise competing reservations, retries, settlement, and recoveryDeterministic local Worker and database proof
Retry behavior avoids duplicate dispatchIdempotency tests cover payload mismatch, pre-dispatch release, and post-dispatch indeterminate stateProvider behavior is simulated in CI
Large provider responses are boundedSuccess, error, and unterminated SSE fixtures verify rejection and stream cancellationBound is per buffered response or SSE frame
Pricing artifacts are reproducibleOne generator and CI --check path cover all published language tablesCatalog values still require source updates
Hosted recovery can be evaluated safelyGuarded staging deploy and proof runners bind an isolated Worker, database, revision, and cleanup journalA completed hosted concurrency and outage-recovery receipt is not claimed here

See STAGING_PROOF.md for the isolated hosted proof contract. It deliberately refuses production targets and dirty worktrees.

Project policy and design

DocumentWhat it owns
GovernanceDecision authority, roles, disputes, and the current continuity gap
RoadmapIntended and excluded work through August 2027
ArchitectureComponents, request flows, identity, storage, deployment, and failure boundaries
SecuritySecurity requirements, excluded guarantees, reporting, and supported versions
Security assuranceThreat model, trust boundaries, executable evidence, residual risks, and runtime HOLDs
AccessibilityPublic-site controls, verification method, known gaps, and language scope
ContributingSetup, quality gates, review expectations, and DCO sign-off

Development

bash
git clone https://github.com/smigolsmigol/llmkitcd llmkitcorepack [email protected] install --frozen-lockfilecorepack [email protected] buildcorepack [email protected] quality:pr

Run the Worker locally with development-only bindings:

bash
corepack [email protected] --filter @f3d1/llmkit-proxy dev

Generic deploy commands are intentionally omitted. Staging and production use separate guarded scripts with explicit target confirmation.

Security

Provider credentials are encrypted with AES-256-GCM using a random IV and owner/provider-bound additional authenticated data. LLMKit API keys are hashed before storage. CI includes secret scanning, static analysis, dependency review, CodeQL, and package provenance checks.

Read the security policy and architecture and the machine-readable Security Insights snapshot. Please report vulnerabilities through GitHub private vulnerability reporting or email [email protected].

License

MIT

來源:README.md,提交 fc92e59

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v0.4.10最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分