{"_id":"@bursora/sdk","_rev":"3-cc1f0fd532525b1ebfcd2d2a25bfb206","name":"@bursora/sdk","dist-tags":{"latest":"0.2.0"},"versions":{"0.1.0":{"name":"@bursora/sdk","version":"0.1.0","keywords":["llm","openai","anthropic","cost","budget","ai-agent","vercel-ai-sdk"],"author":{"name":"Vildan Bina","email":"vildanbina@gmail.com"},"license":"Apache-2.0","_id":"@bursora/sdk@0.1.0","maintainers":[{"name":"vildanbina","email":"vildanbina@gmail.com"}],"homepage":"https://bursora.com","bugs":{"url":"https://github.com/bursora/sdk/issues"},"dist":{"shasum":"a0be806cbc2892a81c110a2a831ec68516807d4e","tarball":"https://registry.npmjs.org/@bursora/sdk/-/sdk-0.1.0.tgz","fileCount":9,"integrity":"sha512-OkYCJcnhNlNiuM/sypdWnFhOOg/jGxpaO4ulonrldwT73lWYLWGNjve98wUiTbo8Gl3DW3vTo96XzVFiVBMhpg==","signatures":[{"sig":"MEYCIQCbQIRdpMb5Nt1HiIjWlqVPQVle6E3mMLS5U3owYPlpHwIhANSL6METjn9iytdCwVRBKw0A0eLbyGm2qhSPvHeXP8bD","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":377854},"main":"./dist/index.cjs","types":"./dist/index.d.ts","module":"./dist/index.mjs","engines":{"bun":">=1.0","node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.cjs"}},"gitHead":"77881dfa18d3e694d9869f876064dca46e576149","scripts":{"dev":"tsup --watch","lint":"eslint .","test":"bun test","build":"tsup","check":"bun run typecheck && bun run lint && bun run format:check && bun test","format":"prettier --write .","prepare":"husky","lint:fix":"eslint . --fix","typecheck":"tsc --noEmit","format:check":"prettier --check .","prepublishOnly":"bun run build"},"_npmUser":{"name":"vildanbina","email":"vildanbina@gmail.com"},"repository":{"url":"git+https://github.com/bursora/sdk.git","type":"git"},"_npmVersion":"10.8.2","description":"Bursora SDK — wrap your AI provider clients to enforce per-agent budgets.","directories":{},"_nodeVersion":"20.20.2","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.5.1","husky":"^9.1.7","eslint":"^10.3.0","prettier":"^3.8.3","@eslint/js":"^10.0.1","@types/bun":"^1.3.13","typescript":"^6.0.3","@types/node":"^25.6.2","lint-staged":"^16.4.0","typescript-eslint":"^8.58.1","prettier-plugin-organize-imports":"^4.1.0"},"peerDependencies":{"ai":">=5"},"peerDependenciesMeta":{"ai":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.1.0_1780171284347_0.5187214992167553","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@bursora/sdk","version":"0.1.1","keywords":["llm","openai","anthropic","cost","budget","ai-agent","vercel-ai-sdk"],"author":{"name":"Vildan Bina","email":"vildanbina@gmail.com"},"license":"Apache-2.0","_id":"@bursora/sdk@0.1.1","maintainers":[{"name":"vildanbina","email":"vildanbina@gmail.com"}],"homepage":"https://bursora.com","bugs":{"url":"https://github.com/bursora/sdk/issues"},"dist":{"shasum":"d13a9eb00b52b33f0db9b26fdf05d1456ba4fefd","tarball":"https://registry.npmjs.org/@bursora/sdk/-/sdk-0.1.1.tgz","fileCount":9,"integrity":"sha512-3yt/Korqg75RC7TScDr8gKgaC400scWRSt3ACC+50ZZN6jPj7fut2+mAZGE9MxYZlombb4WJKTrYmPILozQrTQ==","signatures":[{"sig":"MEUCIQCl5lyqE9hiji10Yf0brUd1vZjN6oJtKHeuQCoshIlo5AIgF0HqV69Apck4C3ZgzsCHd/bAeSbDIaGnMrfl4vERSOI=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@bursora%2fsdk@0.1.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":377858},"main":"./dist/index.cjs","types":"./dist/index.d.ts","module":"./dist/index.mjs","engines":{"bun":">=1.0","node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.cjs"}},"gitHead":"fea0a85c89b9f926986472d6c7194bbabb7dce82","scripts":{"dev":"tsup --watch","lint":"eslint .","test":"bun test","build":"tsup","check":"bun run typecheck && bun run lint && bun run format:check && bun test","format":"prettier --write .","prepare":"husky","lint:fix":"eslint . --fix","typecheck":"tsc --noEmit","format:check":"prettier --check .","prepublishOnly":"bun run build"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:b2bf128b-8b00-43b3-a3de-16f035012f94"}},"repository":{"url":"git+https://github.com/bursora/sdk.git","type":"git"},"_npmVersion":"11.13.0","description":"Bursora SDK — wrap your AI provider clients to enforce per-agent budgets.","directories":{},"_nodeVersion":"24.16.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.5.1","husky":"^9.1.7","eslint":"^10.3.0","prettier":"^3.8.3","@eslint/js":"^10.0.1","@types/bun":"^1.3.13","typescript":"^6.0.3","@types/node":"^25.6.2","lint-staged":"^16.4.0","typescript-eslint":"^8.58.1","prettier-plugin-organize-imports":"^4.1.0"},"peerDependencies":{"ai":">=5"},"peerDependenciesMeta":{"ai":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.1.1_1780171818140_0.07109672541217527","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@bursora/sdk","version":"0.2.0","description":"Bursora SDK: wrap your AI provider client to enforce per-customer and per-agent budgets, no proxy.","license":"MIT","author":{"name":"Vildan Bina","email":"vildanbina@gmail.com"},"homepage":"https://bursora.com","repository":{"type":"git","url":"git+https://github.com/bursora/sdk.git"},"keywords":["llm","openai","anthropic","cost","budget","ai-agent","vercel-ai-sdk"],"main":"./dist/index.cjs","module":"./dist/index.mjs","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.cjs"}},"publishConfig":{"access":"public"},"scripts":{"build":"tsup","dev":"tsup --watch","prepare":"husky","test":"bun test","lint":"eslint .","lint:fix":"eslint . --fix","typecheck":"tsc --noEmit","format":"prettier --write .","format:check":"prettier --check .","check":"bun run typecheck && bun run lint && bun run format:check && bun test","prepublishOnly":"bun run build"},"engines":{"node":">=18","bun":">=1.0"},"peerDependencies":{"ai":">=5"},"peerDependenciesMeta":{"ai":{"optional":true}},"devDependencies":{"@ai-sdk/anthropic":"^3.0.81","@ai-sdk/openai":"^3.0.68","@anthropic-ai/sdk":"^0.102.0","@eslint/js":"^10.0.1","@google/genai":"^2.8.0","@types/bun":"^1.3.14","@types/node":"^25.9.2","ai":"^6.0.197","eslint":"^10.4.1","husky":"^9.1.7","lint-staged":"^17.0.7","msw":"2.14.6","openai":"^6.42.0","prettier":"^3.8.3","prettier-plugin-organize-imports":"^4.3.0","tsup":"^8.5.1","typescript":"^6.0.3","typescript-eslint":"^8.60.1"},"gitHead":"104a6bf4a1a0c6e1f6d91e4e0bc1b3b622b03d0f","_id":"@bursora/sdk@0.2.0","bugs":{"url":"https://github.com/bursora/sdk/issues"},"_nodeVersion":"24.16.0","_npmVersion":"11.13.0","dist":{"integrity":"sha512-77W2P6BxvuwG1ToNOJ53NTmO/xYiEG9v6eUrkHFR15LOWYGB3zbU/STrsRfo4VYFD+JARYPjWDjc3vHwbLoYUQ==","shasum":"4ffba7ce3828a2e01ac42d2e7d562dae6a112d32","tarball":"https://registry.npmjs.org/@bursora/sdk/-/sdk-0.2.0.tgz","fileCount":9,"unpackedSize":602556,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@bursora%2fsdk@0.2.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIA74LU4DwLaWLSwrnFIoWmfI74ja3b0EM4+8thTlg90/AiBKd9fbMCIg4MINDw9beyi/c04xF3WmnblS8t6zG13Nog=="}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:b2bf128b-8b00-43b3-a3de-16f035012f94"}},"directories":{},"maintainers":[{"name":"vildanbina","email":"vildanbina@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/sdk_0.2.0_1780839459659_0.9784074105144436"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-30T20:01:24.153Z","modified":"2026-06-07T13:37:40.066Z","0.1.0":"2026-05-30T20:01:24.484Z","0.1.1":"2026-05-30T20:10:18.280Z","0.2.0":"2026-06-07T13:37:39.813Z"},"bugs":{"url":"https://github.com/bursora/sdk/issues"},"author":{"name":"Vildan Bina","email":"vildanbina@gmail.com"},"license":"MIT","homepage":"https://bursora.com","keywords":["llm","openai","anthropic","cost","budget","ai-agent","vercel-ai-sdk"],"repository":{"type":"git","url":"git+https://github.com/bursora/sdk.git"},"description":"Bursora SDK: wrap your AI provider client to enforce per-customer and per-agent budgets, no proxy.","maintainers":[{"name":"vildanbina","email":"vildanbina@gmail.com"}],"readme":"# @bursora/sdk\n\n[![npm](https://img.shields.io/npm/v/@bursora/sdk?style=flat-square&color=2563eb)](https://www.npmjs.com/package/@bursora/sdk)\n[![bundle size](https://img.shields.io/bundlephobia/minzip/@bursora/sdk?style=flat-square&label=minzip)](https://bundlephobia.com/package/@bursora/sdk)\n[![types](https://img.shields.io/npm/types/@bursora/sdk?style=flat-square)](https://bursora.com/docs/sdk/install)\n[![license](https://img.shields.io/npm/l/@bursora/sdk?style=flat-square)](./LICENSE)\n\n> Catch the runaway AI bill before it happens. One line around your provider client.\n\nAI calls bill by token. A stuck loop, a runaway agent, or one abusive customer can burn hundreds of dollars before anyone looks at a graph. Most tools show you the damage after it lands. Bursora checks the budget _before_ the call goes out and blocks it if it would blow a limit. Traffic light, not speed camera.\n\nThis package is the wrap. No proxy, no gateway; your app still talks straight to OpenAI, Anthropic, or Google. Bursora just gets a yes/no first, then the real token cost after.\n\n## Install\n\n```bash\nnpm i @bursora/sdk\n```\n\nBring your own provider client (`openai`, `@anthropic-ai/sdk`, `@google/genai`, ...). The SDK detects them by shape, so it never bundles them.\n\n## 30 seconds\n\n```ts\nimport OpenAI from \"openai\";\nimport { BudgetExceededError, withTags, wrap } from \"@bursora/sdk\";\n\nconst openai = wrap(new OpenAI(), {\n    apiKey: process.env.BURSORA_API_KEY!,\n    endpoint: process.env.BURSORA_ENDPOINT!,\n});\n\nawait withTags({ tenant_id: \"acme\", agent_id: \"support-bot\" }, async () => {\n    try {\n        await openai.chat.completions.create({\n            model: \"gpt-4o-mini\",\n            messages: [{ role: \"user\", content: \"hi\" }],\n        });\n    } catch (e) {\n        if (e instanceof BudgetExceededError) {\n            // over budget: downgrade the model, queue it, show a fallback\n        } else throw e;\n    }\n});\n```\n\nTag each call with who it's for (customer, agent, workflow). That's how spend gets grouped in the dashboard and how budgets know what to scope to.\n\n## What you get\n\n- **Block before spend.** Over a hard limit? `BudgetExceededError` throws before the provider is ever called. No charge.\n- **Soft limits.** Notify and throttle modes let the call through and report after.\n- **Fail open.** Can't reach Bursora? Your call still goes out. We don't become your outage.\n- **Streaming-safe.** Chunks pass through untouched; usage is read off the final one.\n- Decisions cache for 60 seconds; usage flushes after each call.\n\n## More providers\n\nOpenAI, Anthropic, and Google Gemini all wrap exactly like the example above; detection is by client shape. Bedrock has its own `wrapBedrock`. And on the Vercel AI SDK (`ai`) you use `bursoraMiddleware` with `wrapLanguageModel` instead of `wrap`, since `generateText` never constructs a client for `wrap` to see.\n\nPick yours and copy the snippet:\n\n- **[OpenAI](https://bursora.com/docs/sdk/providers/openai)** · **[Anthropic](https://bursora.com/docs/sdk/providers/anthropic)** · **[Google](https://bursora.com/docs/sdk/providers/google)**\n- **[Amazon Bedrock](https://bursora.com/docs/sdk/providers/bedrock)**\n- **[DeepSeek, Groq, xAI, Mistral and other OpenAI-compatible](https://bursora.com/docs/sdk/providers/openai-compatible)**\n- **[Vercel AI SDK](https://bursora.com/docs/sdk/ai-sdk)**\n\nTags, batch metering, sharing one core across clients, budget snapshots, error handling: it's all in the docs. Start at **[bursora.com/docs/sdk/install](https://bursora.com/docs/sdk/install)**.\n\n## API key\n\nSign in at [bursora.com](https://bursora.com), create a workspace, grab your `BURSORA_API_KEY`.\n\n## License\n\nMIT. © 2026 Vildan Bina.\n","readmeFilename":"README.md"}