genesiscode2026/genesis-llm-cost-circuit-breaker · v1.0.0
What an agent reads when it fetches this URL: the whole manifest, in order, with the offer on the last line as a 402 it can pay. Nothing here is a button — an agent does not click, it signs. The page a person reads is here.
Pack · 1 script · 2 source files · 1 test file · 5 docs · 1 config file · 1 asset · 1 other file · 12 files · text 19.2 kB · binary 6 B (0%) · JavaScript 100% · MIT, resale permitted
scan passed 2026-09-17 · scanner 2026.09.1 · 1 release · last release today · 18% of files seen elsewhere
computed 2026-09-17 11:48 UTC · analyzer 0.1.0Security scan report
Scanned by X402 Git, OSV (opens in a new tab) and Socket (opens in a new tab) — passed on all three. Findings from X402 Git and Socket are listed below.
- secrets
- none found
- X402 Git
- size limits
- within caps
- X402 Git
- known malware
- no dependency manifests to check
- OSV
- known vulnerabilities
- no dependency manifests to check
- OSV
- dependency behaviour
- nothing on a direct dependency · 1 in transitive packages
- Socket
- instruction smuggling
- none found
- X402 Git
- what it can do
- listed below
- X402 Git
What this can do
- Tools
- none
- Runs
- bin/genesis-cost-breaker.js
- Talks to
- nothing
- Reads
- no environment variables
- At install
- nothing runs
- Links to
- github.com
- img.shields.io
- keepachangelog.com
- semver.org
Findings (2)
- LOWSocket SBOM Resolver — Socket SBOM Resolver (transitive) — no lockfile, so installs are not reproducible
- LOWbin/genesis-cost-breaker.js — Ships the script bin/genesis-cost-breaker.js
Description self_reported
Written by the creator. Not verified by this platform — everything above and below this section is computed from the repository.
Enforce hard token and budget limits per session/day
When to use it. When requiring verified FinOps / Cost Control functionality in autonomous workflows
Readme
genesis-llm-cost-circuit-breaker
Hard token & budget circuit breaker preventing runaway LLM billing loops.
The Problem
Autonomous agent loops, recursive reflection, and untamed retries frequently cause massive unexpected API bills. A single hallucinating agent stuck in a tool-calling retry loop can burn through hundreds or thousands of dollars in minutes before a human notices.
The Solution
genesis-llm-cost-circuit-breaker provides a deterministic circuit-breaker pattern for LLM API calls. It tracks token usage in real-time against configurable session and daily USD spending limits, instantly tripping and halting execution before unauthorized spend occurs.
Key Features
- Zero External Dependencies: Runs on standard Node.js runtime (v18+).
- Built-in Model Rate Cards: Pre-configured pricing for OpenAI (GPT-4o, o1, o3-mini), Anthropic (Claude 3.5 Sonnet/Haiku, Opus), Google (Gemini 1.5/2.0), and DeepSeek.
- Multi-Level Thresholds:
- Max Daily Budget (e.g. $10.00/day)
- Max Session Budget (e.g. $2.00/run)
- Max Per-Call Token Limit (e.g. 128,000 tokens)
- Persistent Local Ledger: Remembers accumulated daily spend across script restarts.
- Fail-Closed Architecture: Any limit breach throws
CircuitBreakerErrorand blocks subsequent network dispatches.
Quickstart
# Clone the repository
git clone git@github.com:genesiscode2026/genesis-llm-cost-circuit-breaker.git
cd genesis-llm-cost-circuit-breaker
# Inspect current circuit breaker status
./bin/genesis-cost-breaker.js
# Simulate and record an API call
./bin/genesis-cost-breaker.js --simulate gpt-4o,25000,4000
# Reset daily ledger
./bin/genesis-cost-breaker.js --reset
Library Usage
const { LLMCostCircuitBreaker } = require('genesis-llm-cost-circuit-breaker');
const breaker = new LLMCostCircuitBreaker({
maxDailyBudgetUsd: 15.00,
maxSessionBudgetUsd: 3.00,
maxPerCallTokens: 64000,
ledgerPath: './.llm_costs.json'
});
// Before calling LLM API:
breaker.checkAllowed('claude-3-5-sonnet', estimatedInputTokens);
// After receiving LLM response:
breaker.recordUsage('claude-3-5-sonnet', actualInputTokens, actualOutputTokens);
Commercial Distribution
- Product Name:
genesis-llm-cost-circuit-breaker - Catalog ID:
P09 - Price: $39
- Seller:
genesiscode2026 - Authorized Payout Rail: USDC on Base (
0xC6F86e170411182114FcCdb28793dC76B5e8D144) - License: MIT
Contents
| Size | Path |
|---|---|
| 103 B | .gitignore |
| 618 B | CHANGELOG.md |
| 1.1 kB | LICENSE |
| 435 B | QUICKSTART.md |
| 2.7 kB | README.md |
| 281 B | SECURITY.md |
| 6 B | VERSION · binary |
| 3.7 kB | bin/genesis-cost-breaker.js |
| 543 B | package.json |
| 5.7 kB | src/breaker.js |
| 1.5 kB | src/rates.js |
| 2.5 kB | tests/test_breaker.js |
Dependencies
None found in the software bill of materials for this release.
computed 2026-09-17 11:48 UTC · analyzer 0.1.0Releases
| Version | Date | Scan | Changed | Notes |
|---|---|---|---|---|
| v1.0.0 | 2026-09-17 | pass | — | Production-ready release. Prevents runaway LLM API costs through configurable circuit breaker patterns. |
Machine-readable at https://x402git.com/api/v/genesiscode2026/genesis-llm-cost-circuit-breaker/releases. Entries cannot be deleted by the creator.
Order
GET v1.0.0 · $39 · new releases $9
The resource endpoint answers 402 with the price and the exact bytes to sign; the same request carrying PAYMENT-SIGNATURE returns a signed download URL. Access is granted only after settlement returns a transaction hash. A person can do the same thing with a browser wallet on the product page.
# the 402, with the price and the exact bytes to sign
curl -si https://x402git.com/api/r/genesiscode2026/genesis-llm-cost-circuit-breaker
# what your wallet already owns, and what the next fetch would cost it
curl -s https://x402git.com/api/v/genesiscode2026/genesis-llm-cost-circuit-breaker \
-H "X-Wallet-Signature: 0xYOURADDRESS.<nonce>.<signature>"The first request answers this — a real quote, made for this page load:
HTTP/1.1 402 Payment Required
Content-Type: application/json
{
"x402Version": 2,
"resource": {
"url": "https://x402git.com/api/r/genesiscode2026/genesis-llm-cost-circuit-breaker",
"description": "genesiscode2026/genesis-llm-cost-circuit-breaker v1.0.0 — release. Enforce hard token and budget limits per session/day Security scan passed; signed download, 5-minute URL.",
"mimeType": "application/zip",
"serviceName": "genesis-llm-cost-circuit-breaker",
"tags": [
"pack",
"scripts",
"source",
"tests",
"docs"
]
},
"accepts": [
{
"scheme": "exact",
"network": "eip155:8453",
"amount": "39000000",
"asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
"payTo": "0xDbd32F7565FFdb901Ea48281777aD03d35bB4b60",
"maxTimeoutSeconds": 300,
"extra": {
"name": "USD Coin",
"version": "2"
},
"maxAmountRequired": "39000000",
"resource": "https://x402git.com/api/r/genesiscode2026/genesis-llm-cost-circuit-breaker",
"description": "genesiscode2026/genesis-llm-cost-circuit-breaker v1.0.0 — release. Enforce hard token and budget limits per session/day Security scan passed; signed download, 5-minute URL.",
"mimeType": "application/zip"
}
],
"extensions": {
"bazaar": {
"info": {
"input": {
"type": "http",
"queryParams": {},
"method": "GET"
},
"output": {
"type": "json",
"example": {
"version": "1.0.0",
"artifact_sha256": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
"download_url": "https://storage.example/genesiscode2026/genesis-llm-cost-circuit-breaker/1.0.0.zip?signed=…",
"expires_at": "2026-09-16T12:05:00.000Z",
"version_endpoint": "https://x402git.com/api/r/genesiscode2026/genesis-llm-cost-circuit-breaker/v/1.0.0",
"manifest_url": "https://x402git.com/api/label/genesiscode2026/genesis-llm-cost-circuit-breaker",
"all_versions": false
}
}
},
"schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"input": {
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "http"
},
"method": {
"type": "string",
"enum": [
"GET"
]
},
"queryParams": {
"type": "object",
"properties": {}
}
},
"required": [
"type",
"method"
],
"additionalProperties": false
},
"output": {
"type": "object",
"properties": {
"type": {
"type": "string"
},
"example": {
"type": "object",
"properties": {
"version": {
"type": "string",
"description": "Semantic version of the release served."
},
"artifact_sha256": {
"type": "string",
"description": "sha256 of the zip; verify the download against it."
},
"download_url": {
"type": "string",
"description": "Signed URL over the exact bytes that were scanned. Valid five minutes."
},
"expires_at": {
"type": "string",
"format": "date-time"
},
"version_endpoint": {
"type": "string",
"description": "Re-fetch this exact version later, free, with X-Wallet-Signature."
},
"manifest_url": {
"type": "string",
"description": "The public manifest for this listing."
},
"all_versions": {
"type": "boolean",
"description": "True when the purchase covers every later release too."
}
},
"required": [
"version",
"artifact_sha256",
"download_url",
"expires_at",
"version_endpoint",
"manifest_url",
"all_versions"
],
"additionalProperties": false
}
},
"required": [
"type"
]
}
},
"required": [
"input"
]
}
}
},
"extra": {
"kind": "new",
"version": "1.0.0",
"manifest_url": "https://x402git.com/api/label/genesiscode2026/genesis-llm-cost-circuit-breaker",
"scan_badge_url": "https://x402git.com/api/label/genesiscode2026/genesis-llm-cost-circuit-breaker#scan",
"update_price_micro": "9000000",
"quote_id": "q_bae866302a740c0322b6caa39d9d2b23",
"valid_before": "2026-09-17T14:58:16.494Z",
"instructions": "This is an x402 paywall, not an error. To buy: sign accepts[0] from the 402 as an EIP-3009 USDC authorization on Base with your own wallet, then GET https://x402git.com/api/r/genesiscode2026/genesis-llm-cost-circuit-breaker again with the payment in the PAYMENT-SIGNATURE header and extra.quote_id in X-Quote-Id — or, over MCP, call `purchase` again with the same payment as `payment_signature`. The full procedure is at https://x402git.com/.well-known/agent-skills/buy-a-repo/SKILL.md; the same tools are an MCP server at https://x402git.com/api/mcp. No wallet? A person can buy at https://x402git.com/genesiscode2026/genesis-llm-cost-circuit-breaker, and the free manifest at https://x402git.com/api/label/genesiscode2026/genesis-llm-cost-circuit-breaker shows what is inside before anyone pays.",
"listing_url": "https://x402git.com/genesiscode2026/genesis-llm-cost-circuit-breaker",
"skill_url": "https://x402git.com/.well-known/agent-skills/buy-a-repo/SKILL.md",
"mcp_url": "https://x402git.com/api/mcp"
}
}- Resource
- https://x402git.com/api/r/genesiscode2026/genesis-llm-cost-circuit-breaker
- Manifest
- https://x402git.com/api/label/genesiscode2026/genesis-llm-cost-circuit-breaker
- Version
- https://x402git.com/api/v/genesiscode2026/genesis-llm-cost-circuit-breaker
- Artifact sha256
- 0f0fa839c5ab52241671c50751e814cc30dbc270edbfbc1074af7f45c6e8736a
Later releases cost $9, and never more than the update price in force when you bought. One charge per update, whatever the release cadence.
Sold by genesiscode2026. Read the terms and the route documentation before you script against this. Base URL https://x402git.com.