{"_id":"@aivyuh/finops","_rev":"2-c75ca569854222a55aee11e390cc486d","name":"@aivyuh/finops","dist-tags":{"latest":"0.2.0"},"versions":{"0.1.0":{"name":"@aivyuh/finops","version":"0.1.0","keywords":["ai","finops","cost-monitoring","telemetry","anthropic","openai","llm","observability"],"author":{"name":"IOanyT Innovations","email":"hello@aivyuh.com"},"license":"MIT","_id":"@aivyuh/finops@0.1.0","maintainers":[{"name":"atin-agarwal","email":"atin@aivyuh.com"}],"homepage":"https://github.com/aivyuh/finops-sdk#readme","bugs":{"url":"https://github.com/aivyuh/finops-sdk/issues"},"dist":{"shasum":"ab6c49d660134186390b7e477365d458a10756bf","tarball":"https://registry.npmjs.org/@aivyuh/finops/-/finops-0.1.0.tgz","fileCount":20,"integrity":"sha512-CZEJTku49hIkJudiIWt++kVE75UEv4plmJck4KQJQxYD1knIVwLHVPbK/+6fOu7FahuAemv8pR21MoMmq5EmnQ==","signatures":[{"sig":"MEUCIQCpFnEsX5ISGeibJzQHmGW+avp602BRF3bcFqWbKifnIwIgUIuUGiubIfVBi1MlSfYw9IkW+ScdpNpYfHxtxsbRtvA=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":41331},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"570ad4f39bc7ba2f1f31bb153b4e5e6f3559c732","scripts":{"build":"tsc","prepublishOnly":"npm run build"},"_npmUser":{"name":"atin-agarwal","email":"atin@aivyuh.com"},"repository":{"url":"git+https://github.com/aivyuh/finops-sdk.git","type":"git"},"_npmVersion":"11.9.0","description":"V7 AI FinOps SDK — transparent cost telemetry for Anthropic and OpenAI clients","directories":{},"_nodeVersion":"24.14.0","_hasShrinkwrap":false,"devDependencies":{"openai":"^4.90.0","typescript":"^5.7.0","@anthropic-ai/sdk":"^0.52.0"},"peerDependencies":{"openai":">=1.50.0","@anthropic-ai/sdk":">=0.40.0"},"peerDependenciesMeta":{"openai":{"optional":true},"@anthropic-ai/sdk":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/finops_0.1.0_1775120774381_0.1938188123568818","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@aivyuh/finops","version":"0.2.0","description":"V7 AI FinOps SDK — transparent cost telemetry for Anthropic and OpenAI clients","type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"build":"tsc","prepublishOnly":"npm run build"},"keywords":["ai","finops","cost-monitoring","telemetry","anthropic","openai","llm","observability"],"author":{"name":"IOanyT Innovations","email":"hello@aivyuh.com"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/aivyuh/finops-sdk.git"},"peerDependencies":{"@anthropic-ai/sdk":">=0.40.0","openai":">=1.50.0"},"peerDependenciesMeta":{"@anthropic-ai/sdk":{"optional":true},"openai":{"optional":true}},"devDependencies":{"@anthropic-ai/sdk":"^0.52.0","openai":"^4.90.0","typescript":"^5.7.0"},"engines":{"node":">=18"},"gitHead":"1aba77abed9536ab090dc4a8ba70649713672d05","_id":"@aivyuh/finops@0.2.0","bugs":{"url":"https://github.com/aivyuh/finops-sdk/issues"},"homepage":"https://github.com/aivyuh/finops-sdk#readme","_nodeVersion":"24.14.0","_npmVersion":"11.9.0","dist":{"integrity":"sha512-zWpA7AL/ZxCWw12GHF6lpPHy6BF3Kxoc2jDDOIY+OOjNlPgH0gM9Gq0lNS1GA+HpPtnfU7hmZrfZqU9AyDgRLg==","shasum":"ad294abf1cbbf39fc44d859bf4ced930ff911671","tarball":"https://registry.npmjs.org/@aivyuh/finops/-/finops-0.2.0.tgz","fileCount":20,"unpackedSize":42498,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCH47iUSF4RrrYRdXx0UyWw6mQCo7aYSgUmg1budt+ztgIgMY2UcNXqD9d4J33Rejdxd+qZVWSdidAVlJARjjsXu8s="}]},"_npmUser":{"name":"atin-agarwal","email":"atin@aivyuh.com"},"directories":{},"maintainers":[{"name":"atin-agarwal","email":"atin@aivyuh.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/finops_0.2.0_1776347832177_0.5959645033763254"},"_hasShrinkwrap":false}},"time":{"created":"2026-04-02T09:06:14.294Z","modified":"2026-04-16T13:57:12.422Z","0.1.0":"2026-04-02T09:06:14.554Z","0.2.0":"2026-04-16T13:57:12.318Z"},"bugs":{"url":"https://github.com/aivyuh/finops-sdk/issues"},"author":{"name":"IOanyT Innovations","email":"hello@aivyuh.com"},"license":"MIT","homepage":"https://github.com/aivyuh/finops-sdk#readme","keywords":["ai","finops","cost-monitoring","telemetry","anthropic","openai","llm","observability"],"repository":{"type":"git","url":"git+https://github.com/aivyuh/finops-sdk.git"},"description":"V7 AI FinOps SDK — transparent cost telemetry for Anthropic and OpenAI clients","maintainers":[{"name":"atin-agarwal","email":"atin@aivyuh.com"}],"readme":"# @aivyuh/finops\n\nTransparent cost telemetry for Anthropic and OpenAI Node.js clients. Part of the [V7 AI FinOps](https://finops-api.aivyuh.com) platform.\n\nWrap your existing AI SDK client in one line — `@aivyuh/finops` captures model, tokens, cost, and latency metadata and sends it to the V7 backend. **It never reads or stores prompt or response content.**\n\n## Install\n\n```bash\nnpm install @aivyuh/finops\n```\n\n## Quickstart\n\n### Anthropic\n\n```typescript\nimport Anthropic from \"@anthropic-ai/sdk\";\nimport { wrapClient } from \"@aivyuh/finops\";\n\nconst client = wrapClient(new Anthropic(), {\n  telemetryEndpoint: \"https://finops-api.aivyuh.com/telemetry\",\n  customerId: \"cust-123\",\n  apiKey: process.env.AIVYUH_FINOPS_KEY, // per-customer key, sent as X-API-Key\n  project: \"my-app\",\n  tags: { feature: \"chat\", team: \"product\" },\n});\n\n// Use the client exactly as before — all types and overloads are preserved\nconst message = await client.messages.create({\n  model: \"claude-sonnet-4-6-20260320\",\n  max_tokens: 1024,\n  messages: [{ role: \"user\", content: \"Hello, Claude!\" }],\n});\n```\n\n### OpenAI\n\n```typescript\nimport OpenAI from \"openai\";\nimport { wrapClient } from \"@aivyuh/finops\";\n\nconst client = wrapClient(new OpenAI(), {\n  telemetryEndpoint: \"https://finops-api.aivyuh.com/telemetry\",\n  customerId: \"cust-123\",\n  project: \"my-app\",\n  tags: { feature: \"search\", team: \"platform\" },\n});\n\n// Use the client exactly as before\nconst completion = await client.chat.completions.create({\n  model: \"gpt-4o\",\n  messages: [{ role: \"user\", content: \"Hello, GPT!\" }],\n});\n```\n\n## Configuration\n\n| Option | Type | Required | Description |\n|--------|------|----------|-------------|\n| `telemetryEndpoint` | `string` | Yes | V7 telemetry ingest URL (`https://finops-api.aivyuh.com/telemetry`) |\n| `customerId` | `string` | Yes | Your customer ID for cost attribution |\n| `apiKey` | `string` | Yes* | Per-customer API key, sent as `X-API-Key` header. *Required by the production V7 ingest endpoint.* |\n| `project` | `string` | No | Project name for grouping costs |\n| `tags` | `Record<string, string>` | No | Custom key-value tags attached to every request |\n| `disableTelemetry` | `boolean` | No | Set `true` to disable (useful in tests) |\n\n## Production API Endpoint\n\n```\nhttps://finops-api.aivyuh.com/telemetry\n```\n\nPOST telemetry payloads are accepted with a `202 Accepted` response. The endpoint is fire-and-forget — if unreachable, your application is unaffected.\n\n## How It Works\n\n1. `wrapClient()` detects whether you passed an Anthropic or OpenAI client (duck-typing).\n2. It monkey-patches `messages.create()` (Anthropic) or `chat.completions.create()` (OpenAI).\n3. After each successful call, it extracts usage metadata (model, tokens, latency) and estimates cost.\n4. A non-blocking `fetch()` sends the telemetry payload to V7 — errors are silently swallowed.\n5. Your original response is returned untouched.\n\n## Advanced: Individual Wrappers\n\nIf you only use one provider, import the specific wrapper to avoid unused type imports:\n\n```typescript\nimport { wrapAnthropic } from \"@aivyuh/finops\";\nimport { wrapOpenAI } from \"@aivyuh/finops\";\n```\n\n## Requirements\n\n- Node.js >= 18 (uses native `fetch`)\n- `@anthropic-ai/sdk` >= 0.40.0 and/or `openai` >= 1.50.0 as peer dependencies\n\n## License\n\nMIT\n","readmeFilename":"README.md"}