{
  "markdown": "<p align=\"center\">\n  <img src=\".github/logo-wordmark-animated.svg\" width=\"280\" alt=\"LLMKit\" />\n</p>\n\n<h3 align=\"center\">Measure what your AI agents cost. Stop requests before they exceed a budget.</h3>\n\n<p align=\"center\">\n  <a href=\"https://github.com/smigolsmigol/llmkit/actions/workflows/ci.yml\"><img src=\"https://github.com/smigolsmigol/llmkit/actions/workflows/ci.yml/badge.svg\" alt=\"CI\" /></a>\n  <a href=\"https://pypi.org/project/llmkit-sdk/\"><img src=\"https://img.shields.io/pypi/v/llmkit-sdk?label=python\" alt=\"PyPI\" /></a>\n  <a href=\"https://www.npmjs.com/package/@f3d1/llmkit-mcp-server\"><img src=\"https://img.shields.io/npm/v/@f3d1/llmkit-mcp-server?label=mcp\" alt=\"npm\" /></a>\n  <a href=\"https://scorecard.dev/viewer/?uri=github.com/smigolsmigol/llmkit\"><img src=\"https://api.scorecard.dev/projects/github.com/smigolsmigol/llmkit/badge\" alt=\"OpenSSF Scorecard\" /></a>\n  <a href=\"https://www.bestpractices.dev/projects/12288\"><img src=\"https://www.bestpractices.dev/projects/12288/badge\" alt=\"OpenSSF Best Practices\" /></a>\n  <a href=\"LICENSE\"><img src=\"https://img.shields.io/badge/license-MIT-blue.svg\" alt=\"MIT license\" /></a>\n</p>\n\n<p align=\"center\">\n  <a href=\"https://llmkit.sh\">Website</a> | <a href=\"https://llmkit.sh/docs\">Docs</a> | <a href=\"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\">Pricing API</a> | <a href=\"ARCHITECTURE.md\">Architecture</a> | <a href=\"SECURITY.md\">Security</a> | <a href=\"SECURITY-ASSURANCE.md\">Assurance case</a>\n</p>\n\nLLMKit is an open-source AI gateway and SDK suite for cost attribution, budget admission, and\nrequest evidence. The gateway reserves estimated spend before provider dispatch. It rejects\nrequests that cannot fit the active budget, then settles admitted reservations to actual usage when\nthe response completes.\n\nThe repository also ships local tracking surfaces that do not require an LLMKit account or proxy.\n\n## Choose a surface\n\n| Surface | Use it when | Package |\n| --- | --- | --- |\n| Python transport | You want local cost estimates around existing SDK calls | [`llmkit-sdk`](https://pypi.org/project/llmkit-sdk/) |\n| CLI wrapper | Your OpenAI or Anthropic client honors its standard base-URL environment variable | [`@f3d1/llmkit-cli`](https://www.npmjs.com/package/@f3d1/llmkit-cli) |\n| TypeScript SDK | You have an existing key and want sessions, streaming, and gateway access from TypeScript | [`@f3d1/llmkit-sdk`](packages/sdk) |\n| MCP server | You want spend, budget, and local coding-session tools inside an MCP client | [`@f3d1/llmkit-mcp-server`](packages/mcp-server) |\n| AI SDK provider | You use Vercel AI SDK 6 | [`@f3d1/llmkit-ai-sdk-provider`](packages/ai-sdk-provider) |\n| Gateway and dashboard | You need shared budgets, provider routing, receipts, and analytics | [`packages/proxy`](packages/proxy), [`packages/dashboard`](packages/dashboard) |\n\n## Quick start\n\n### Local Python tracking\n\n```bash\npip install llmkit-sdk\n```\n\n```python\nfrom llmkit import tracked\nfrom openai import OpenAI\n\ncosts = []\nclient = OpenAI(http_client=tracked(on_cost=costs.append))\n\nclient.chat.completions.create(\n    model=\"gpt-4.1\",\n    messages=[{\"role\": \"user\", \"content\": \"Summarize this incident.\"}],\n)\n\nprint(f\"${sum(item.total_cost or 0 for item in costs):.6f}\")\n```\n\nThe transport reads provider usage metadata and estimates cost from the bundled pricing catalog. It does not send tracking data to LLMKit.\n\n### Zero-code CLI tracking\n\n```bash\nnpx @f3d1/llmkit-cli -- python my_agent.py\n```\n\nUse `-v` for per-request output or `--json` for machine-readable results.\n\n### Gateway mode (existing key)\n\nGateway examples require an existing LLMKit API key. Account creation and key management are\ntemporarily unavailable while the authenticated service is restored. If you do not already have a\nkey, use one of the local tracking paths above.\n\n```python\nfrom openai import OpenAI\n\nclient = OpenAI(\n    base_url=\"https://api.llmkit.sh/v1\",\n    api_key=\"llmk_your_key_here\",\n)\n\nresponse = client.chat.completions.create(\n    model=\"gpt-4.1\",\n    messages=[{\"role\": \"user\", \"content\": \"Draft a release note.\"}],\n)\n```\n\n## The budget path\n\n<p align=\"center\">\n  <img\n    src=\".github/budget-path.svg\"\n    width=\"100%\"\n    alt=\"LLMKit authenticates each request, reserves its estimated cost, rejects requests over budget before provider dispatch, and settles admitted requests to actual usage.\"\n  />\n</p>\n\nThe control path is built around three boundaries:\n\n- **Atomic admission:** a Durable Object owns reservation state for each budget scope. Concurrent\n  requests cannot spend the same remaining balance.\n- **Dispatch-aware idempotency:** deterministic failures before dispatch release the key. After\n  provider dispatch may have occurred, failures remain terminal to avoid duplicate spend.\n- **Bounded responses:** non-streaming bodies and individual SSE frames have explicit byte limits.\n  LLMKit cancels upstream reads when a limit is exceeded.\n\nRequest receipts bind the admission decision, provider attempt, settlement, and analytics handoff\nwith stable identifiers. Database writes use an outbox, so an analytics outage does not silently erase\nbudget evidence.\n\n## MCP server\n\n```json\n{\n  \"mcpServers\": {\n    \"llmkit\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@f3d1/llmkit-mcp-server\"]\n    }\n  }\n}\n```\n\nFive local tools inspect supported Claude Code sessions and Cline task data without an LLMKit key.\nSix gateway tools query spend, budgets, keys, sessions, and service health when `LLMKIT_API_KEY`\ncontains an existing key. Together they expose 11 tools.\n\n## Pricing data\n\nThe pinned catalog is a bundled reference snapshot, not a live quote. One source file,\n[`packages/shared/pricing.json`](packages/shared/pricing.json), records the snapshot date and\ngenerates the TypeScript, Python, and MCP tables. CI rejects drift between the source and generated\nfiles. The public site renders only populated provider tables and displays the source date.\n\nThe public comparison endpoint requires no account:\n\n```text\nhttps://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\n```\n\nThe endpoint prices only the exact model keys supplied by the caller. It does not search for or\nrecommend the cheapest model. Pricing is an estimate, not a provider invoice. Provider billing rules,\nmodel modality, and catalog freshness remain part of the error boundary.\n\n## Evidence and current boundary\n\n| Claim | Evidence in this repository | Boundary |\n| --- | --- | --- |\n| Concurrent budget admission is serialized | Worker fixtures exercise competing reservations, retries, settlement, and recovery | Deterministic local Worker and database proof |\n| Retry behavior avoids duplicate dispatch | Idempotency tests cover payload mismatch, pre-dispatch release, and post-dispatch indeterminate state | Provider behavior is simulated in CI |\n| Large provider responses are bounded | Success, error, and unterminated SSE fixtures verify rejection and stream cancellation | Bound is per buffered response or SSE frame |\n| Pricing artifacts are reproducible | One generator and CI `--check` path cover all published language tables | Catalog values still require source updates |\n| Hosted recovery can be evaluated safely | Guarded staging deploy and proof runners bind an isolated Worker, database, revision, and cleanup journal | A completed hosted concurrency and outage-recovery receipt is not claimed here |\n\nSee [`STAGING_PROOF.md`](STAGING_PROOF.md) for the isolated hosted proof contract. It deliberately refuses production targets and dirty worktrees.\n\n## Project policy and design\n\n| Document | What it owns |\n| --- | --- |\n| [Governance](GOVERNANCE.md) | Decision authority, roles, disputes, and the current continuity gap |\n| [Roadmap](ROADMAP.md) | Intended and excluded work through August 2027 |\n| [Architecture](ARCHITECTURE.md) | Components, request flows, identity, storage, deployment, and failure boundaries |\n| [Security](SECURITY.md) | Security requirements, excluded guarantees, reporting, and supported versions |\n| [Security assurance](SECURITY-ASSURANCE.md) | Threat model, trust boundaries, executable evidence, residual risks, and runtime HOLDs |\n| [Accessibility](ACCESSIBILITY.md) | Public-site controls, verification method, known gaps, and language scope |\n| [Contributing](CONTRIBUTING.md) | Setup, quality gates, review expectations, and DCO sign-off |\n\n## Development\n\n```bash\ngit clone https://github.com/smigolsmigol/llmkit\ncd llmkit\ncorepack pnpm@9.15.4 install --frozen-lockfile\ncorepack pnpm@9.15.4 build\ncorepack pnpm@9.15.4 quality:pr\n```\n\nRun the Worker locally with development-only bindings:\n\n```bash\ncorepack pnpm@9.15.4 --filter @f3d1/llmkit-proxy dev\n```\n\nGeneric deploy commands are intentionally omitted. Staging and production use separate guarded scripts with explicit target confirmation.\n\n## Security\n\nProvider credentials are encrypted with AES-256-GCM using a random IV and owner/provider-bound\nadditional authenticated data. LLMKit API keys are hashed before storage. CI includes secret\nscanning, static analysis, dependency review, CodeQL, and package provenance checks.\n\nRead the [security policy and architecture](SECURITY.md) and the machine-readable\n[Security Insights snapshot](security-insights.yml). Please report vulnerabilities through\n[GitHub private vulnerability reporting](https://github.com/smigolsmigol/llmkit/security/advisories/new)\nor email `security@llmkit.sh`.\n\n## License\n\n[MIT](LICENSE)\n",
  "bytes": 9634,
  "sha": "18b6a792830bb74f3b98e07d7b91e1dfc467a5e53bd51798b82a20f97fa20d8d",
  "repo_slug": "smigolsmigol/llmkit",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_smigolsmigol_llmkit_771017fa/readme"
}