{"_id":"@breadcrumb-sdk/ai-sdk","_rev":"4-e3900271a0a3c0821f70920d545be4a2","name":"@breadcrumb-sdk/ai-sdk","dist-tags":{"latest":"0.0.5"},"versions":{"0.0.2":{"name":"@breadcrumb-sdk/ai-sdk","version":"0.0.2","_id":"@breadcrumb-sdk/ai-sdk@0.0.2","maintainers":[{"name":"joshuaknauber","email":"joshua.knauber@gmail.com"}],"dist":{"shasum":"4febb7fe3762f21d2a6b66744f187f2ced7f4652","tarball":"https://registry.npmjs.org/@breadcrumb-sdk/ai-sdk/-/ai-sdk-0.0.2.tgz","fileCount":9,"integrity":"sha512-Fs4IbLSzEwWVSyFbSjiZ9620wfBV0H23XvYj/WIat62Cg9K8EuJ8xdF4f7kqFUX5m9im56/X1+h5wFmKUHjX5g==","signatures":[{"sig":"MEUCIQC9S9YfvnJM7hI0PPq5Y4IFdBGN4zATRY594VwRKhfApAIgA+k2erFNKZWy/FCmy/LzQN1PoaEUu6DCwEXm2auCINE=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":8661},"type":"module","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"gitHead":"4ddf8cc4a4553e42312ff11e5fc996fe3958d372","scripts":{"dev":"tsdown --watch","test":"vitest run","build":"tsdown","typecheck":"tsc --noEmit"},"_npmUser":{"name":"joshuaknauber","email":"joshua.knauber@gmail.com"},"_npmVersion":"10.8.2","description":"Trace Vercel AI SDK calls with Breadcrumb. Pass `experimental_telemetry` to any `generateText`, `streamText`, or `generateObject` call and it shows up in your dashboard automatically.","directories":{},"_nodeVersion":"20.20.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsdown":"^0.9","vitest":"^3","typescript":"^5.7","@breadcrumb-sdk/core":"*"},"peerDependencies":{"@breadcrumb-sdk/core":"*"},"_npmOperationalInternal":{"tmp":"tmp/ai-sdk_0.0.2_1772825888567_0.8166492931614375","host":"s3://npm-registry-packages-npm-production"}},"0.0.3":{"name":"@breadcrumb-sdk/ai-sdk","version":"0.0.3","_id":"@breadcrumb-sdk/ai-sdk@0.0.3","maintainers":[{"name":"joshuaknauber","email":"joshua.knauber@gmail.com"}],"dist":{"shasum":"151c97babcc2fe27ad7843017fa1297e4e7d3cf2","tarball":"https://registry.npmjs.org/@breadcrumb-sdk/ai-sdk/-/ai-sdk-0.0.3.tgz","fileCount":10,"integrity":"sha512-KoZr2f98icl3zFKojdENf+HL9Mot31Lbp3s09m9Wlrki+MMb7tGGF+R8WsPvoDO264E6HMKl0tWLtKG5d18IuQ==","signatures":[{"sig":"MEQCIGCaIXOSsLVF6xkiTbWcF2pwKgX6ykYv7F/qAD28Pb1bAiBxZ74Z5WFVROYZb5J/OoxFnQmqTHZKa2ydBbUgYxWzUg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":43248},"type":"module","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"gitHead":"b1a42b0a5dc1ee2c51da68cd618c995ec26684a9","scripts":{"dev":"tsdown --watch","test":"vitest run","build":"tsdown","typecheck":"tsc --noEmit"},"_npmUser":{"name":"joshuaknauber","email":"joshua.knauber@gmail.com"},"_npmVersion":"10.8.2","description":"Trace Vercel AI SDK calls with Breadcrumb. Pass `experimental_telemetry` to any `generateText`, `streamText`, or `generateObject` call and it shows up in your dashboard automatically.","directories":{},"_nodeVersion":"20.20.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsdown":"^0.9","vitest":"^3","typescript":"^5.7","@breadcrumb-sdk/core":"*"},"peerDependencies":{"@breadcrumb-sdk/core":"*"},"_npmOperationalInternal":{"tmp":"tmp/ai-sdk_0.0.3_1773247850703_0.8330936992641131","host":"s3://npm-registry-packages-npm-production"}},"0.0.4":{"name":"@breadcrumb-sdk/ai-sdk","version":"0.0.4","_id":"@breadcrumb-sdk/ai-sdk@0.0.4","maintainers":[{"name":"joshuaknauber","email":"joshua.knauber@gmail.com"}],"dist":{"shasum":"04908b2688c9d18669cb6fd0dcd842b586bcba2c","tarball":"https://registry.npmjs.org/@breadcrumb-sdk/ai-sdk/-/ai-sdk-0.0.4.tgz","fileCount":10,"integrity":"sha512-DAsS9mpRt7E5edKDVWy9bNEbZkjGbez3y1nyKMvD4FTKfyQih3PTFAgyHHh/Q0X156wgr+ZNErPMr3bKx9W1dA==","signatures":[{"sig":"MEQCIAMgI0r6fmtQ4EkBuEwMqczIgobofoHfcmcWAQZWDRCAAiBdYCPV6rYdZZ7Eo1ybz7cCpK/W9VSVph9izMc/RoEdhw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":43481},"type":"module","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"gitHead":"84db62d459428eb413dbb26f70ef9487111aff53","scripts":{"dev":"tsdown --watch","test":"vitest run","build":"tsdown","typecheck":"tsc --noEmit"},"_npmUser":{"name":"joshuaknauber","email":"joshua.knauber@gmail.com"},"_npmVersion":"10.8.2","description":"Trace Vercel AI SDK calls with Breadcrumb. **[Documentation](https://breadcrumb.sh/docs)**","directories":{},"_nodeVersion":"20.20.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsdown":"^0.9","vitest":"^3","typescript":"^5.7","@breadcrumb-sdk/core":"*"},"peerDependencies":{"@breadcrumb-sdk/core":"*"},"_npmOperationalInternal":{"tmp":"tmp/ai-sdk_0.0.4_1773578050817_0.24603492763419155","host":"s3://npm-registry-packages-npm-production"}},"0.0.5":{"name":"@breadcrumb-sdk/ai-sdk","version":"0.0.5","type":"module","publishConfig":{"access":"public"},"exports":{".":{"import":"./dist/index.mjs","require":"./dist/index.cjs","types":"./dist/index.d.mts"}},"scripts":{"build":"tsdown","dev":"tsdown --watch","typecheck":"tsc --noEmit","test":"vitest run"},"peerDependencies":{"@breadcrumb-sdk/core":"*","@opentelemetry/api":"^1.9.0"},"devDependencies":{"@breadcrumb-sdk/core":"*","@opentelemetry/api":"^1.9.0","@opentelemetry/sdk-trace-node":"^1.30.1","tsdown":"^0.21.3","typescript":"^5.7","vitest":"^3"},"_id":"@breadcrumb-sdk/ai-sdk@0.0.5","gitHead":"5c1e533d0497ed297208b5d53992e6d119dcbd3a","description":"Trace Vercel AI SDK calls with Breadcrumb. **[Documentation](https://breadcrumb.sh/docs)**","_nodeVersion":"20.20.1","_npmVersion":"10.8.2","dist":{"integrity":"sha512-HSogggw19dOnRPUrEZRxmYhcDJVmjMjxYHHkMeBaI3btWE2LDatrsXwwYHQ7SO7nlPSPl++8PeYZKQv2gNG4eA==","shasum":"d88ed9a8582645cc19d0f6c4ace06757c4abf200","tarball":"https://registry.npmjs.org/@breadcrumb-sdk/ai-sdk/-/ai-sdk-0.0.5.tgz","fileCount":10,"unpackedSize":44513,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCZ2f9IFB/Cd+lfb0qdF28ghTxyGSusIKQPdxcUIIo48AIhAMudXE/EGxrMaBYYexACY88qQ28OTHlT8A3MbK3TnSgR"}]},"_npmUser":{"name":"joshuaknauber","email":"joshua.knauber@gmail.com"},"directories":{},"maintainers":[{"name":"joshuaknauber","email":"joshua.knauber@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/ai-sdk_0.0.5_1773782957072_0.581548563522708"},"_hasShrinkwrap":false}},"time":{"created":"2026-03-06T19:38:08.481Z","modified":"2026-03-17T21:29:17.619Z","0.0.2":"2026-03-06T19:38:08.736Z","0.0.3":"2026-03-11T16:50:50.851Z","0.0.4":"2026-03-15T12:34:10.965Z","0.0.5":"2026-03-17T21:29:17.220Z"},"description":"Trace Vercel AI SDK calls with Breadcrumb. **[Documentation](https://breadcrumb.sh/docs)**","maintainers":[{"name":"joshuaknauber","email":"joshua.knauber@gmail.com"}],"readme":"# @breadcrumb-sdk/ai-sdk\n\nTrace Vercel AI SDK calls with Breadcrumb. **[Documentation](https://breadcrumb.sh/docs)**\n\nPass `experimental_telemetry` to any `generateText`, `streamText`, or `generateObject` call and it shows up in your dashboard automatically.\n\n## Install\n\n```bash\nnpm install @breadcrumb-sdk/core @breadcrumb-sdk/ai-sdk\n```\n\n## Quick start\n\n```ts\nimport { init } from \"@breadcrumb-sdk/core\";\nimport { initAiSdk } from \"@breadcrumb-sdk/ai-sdk\";\nimport { generateText } from \"ai\";\nimport { anthropic } from \"@ai-sdk/anthropic\";\n\nconst bc = init({\n  apiKey: \"bc_...\",\n  baseUrl: \"https://your-breadcrumb-instance.com\",\n  environment: \"production\",\n});\nconst { telemetry } = initAiSdk(bc);\n\nconst { text } = await generateText({\n  model: anthropic(\"claude-opus-4-6\"),\n  prompt: \"What is TypeScript?\",\n  experimental_telemetry: telemetry(\"answer-question\"),\n});\n```\n\nEach call with `telemetry()` shows up as its own trace in the dashboard. No other setup needed.\n\nSet `environment` on `init()` if you want AI SDK traces tagged as `\"production\"`, `\"staging\"`, `\"development\"`, and so on for environment filtering.\n\n## Grouping calls into one trace\n\nIf you want multiple calls to appear under a single trace, wrap them in `bc.trace()`:\n\n```ts\nawait bc.trace(\"chat-request\", async () => {\n  await generateText({ ..., experimental_telemetry: telemetry(\"plan\") });\n  await generateText({ ..., experimental_telemetry: telemetry(\"respond\") });\n});\n```\n\nYou can also mix in manual steps — for example a retrieval step that isn't an LLM call:\n\n```ts\nawait bc.trace(\"rag-pipeline\", async () => {\n  const docs = await bc.span(\"retrieve\", async (span) => {\n    span.set({ metadata: { source: \"vector-db\", top_k: 5 } });\n    return await vectorSearch(query);\n  }, { type: \"retrieval\" });\n\n  await generateText({\n    model,\n    prompt: `Context: ${docs.join(\"\\n\")}\\n\\nQuestion: ${query}`,\n    experimental_telemetry: telemetry(\"generate\"),\n  });\n});\n```\n\n## API\n\n### `initAiSdk(bc)`\n\nTakes your `bc` instance and returns the `telemetry` helper. Call once after `init()`.\n\n```ts\nconst { telemetry } = initAiSdk(bc);\n```\n\n---\n\n### `telemetry(functionId, metadata?)`\n\nReturns the config to pass to `experimental_telemetry`.\n\n```ts\nexperimental_telemetry: telemetry(\"my-step\")\nexperimental_telemetry: telemetry(\"my-step\", { userId: \"u_123\", temperature: 0.7 })\n```\n\n| Parameter | Type | Description |\n|-----------|------|-------------|\n| `functionId` | `string` | Name shown in the trace UI |\n| `metadata` | `Record<string, string \\| number \\| boolean \\| ...[]>` | Extra data attached to the span |\n\n## Compatibility\n\nWorks with AI SDK 5 and AI SDK 6.\n\n## License\n\nAGPL-3.0 — see [LICENSE](./LICENSE) for details.\n","readmeFilename":"README.md"}