[{"data":1,"prerenderedAt":1181},["ShallowReactive",2],{"navigation_docs":3,"-logging-ai-sdk-options":427,"-logging-ai-sdk-options-surround":1176},[4,35,159,201,289,324,411],{"title":5,"path":6,"stem":7,"children":8,"page":34},"Getting Started","\u002Fgetting-started","1.getting-started",[9,14,19,24,29],{"title":10,"path":11,"stem":12,"icon":13},"Introduction","\u002Fgetting-started\u002Fintroduction","1.getting-started\u002F1.introduction","i-lucide-info",{"title":15,"path":16,"stem":17,"icon":18},"Installation","\u002Fgetting-started\u002Finstallation","1.getting-started\u002F2.installation","i-lucide-download",{"title":20,"path":21,"stem":22,"icon":23},"Quick Start","\u002Fgetting-started\u002Fquick-start","1.getting-started\u002F3.quick-start","i-lucide-zap",{"title":25,"path":26,"stem":27,"icon":28},"Agent Skills","\u002Fgetting-started\u002Fagent-skills","1.getting-started\u002F4.agent-skills","i-lucide-sparkles",{"title":30,"path":31,"stem":32,"icon":33},"vs Other Loggers","\u002Fgetting-started\u002Fvs-other-loggers","1.getting-started\u002F5.vs-other-loggers","i-lucide-scale",false,{"title":36,"path":37,"stem":38,"children":39,"page":34},"Logging","\u002Flogging","2.logging",[40,45,50,55,60,65,70,99,127],{"title":41,"path":42,"stem":43,"icon":44},"Overview","\u002Flogging\u002Foverview","2.logging\u002F0.overview","i-lucide-list",{"title":46,"path":47,"stem":48,"icon":49},"Simple Logging","\u002Flogging\u002Fsimple-logging","2.logging\u002F1.simple-logging","i-lucide-terminal",{"title":51,"path":52,"stem":53,"icon":54},"Wide Events","\u002Flogging\u002Fwide-events","2.logging\u002F2.wide-events","i-lucide-layers",{"title":56,"path":57,"stem":58,"icon":59},"Structured Errors","\u002Flogging\u002Fstructured-errors","2.logging\u002F3.structured-errors","i-lucide-shield-alert",{"title":61,"path":62,"stem":63,"icon":64},"Catalogs","\u002Flogging\u002Fcatalogs","2.logging\u002F4.catalogs","i-lucide-book-open",{"title":66,"path":67,"stem":68,"icon":69},"Client Logging","\u002Flogging\u002Fclient-logging","2.logging\u002F5.client-logging","i-lucide-monitor",{"title":71,"icon":72,"path":73,"stem":74,"children":75,"page":34},"AI SDK","i-simple-icons-vercel","\u002Flogging\u002Fai-sdk","2.logging\u002F6.ai-sdk",[76,79,84,89,94],{"title":41,"path":77,"stem":78,"icon":44},"\u002Flogging\u002Fai-sdk\u002Foverview","2.logging\u002F6.ai-sdk\u002F01.overview",{"title":80,"path":81,"stem":82,"icon":83},"Usage","\u002Flogging\u002Fai-sdk\u002Fusage","2.logging\u002F6.ai-sdk\u002F02.usage","i-lucide-code",{"title":85,"path":86,"stem":87,"icon":88},"Options","\u002Flogging\u002Fai-sdk\u002Foptions","2.logging\u002F6.ai-sdk\u002F03.options","i-lucide-sliders",{"title":90,"path":91,"stem":92,"icon":93},"Metadata","\u002Flogging\u002Fai-sdk\u002Fmetadata","2.logging\u002F6.ai-sdk\u002F04.metadata","i-lucide-database",{"title":95,"path":96,"stem":97,"icon":98},"Telemetry","\u002Flogging\u002Fai-sdk\u002Ftelemetry","2.logging\u002F6.ai-sdk\u002F05.telemetry","i-lucide-activity",{"title":100,"icon":101,"path":102,"stem":103,"children":104,"page":34},"Better Auth","i-simple-icons-betterauth","\u002Flogging\u002Fbetter-auth","2.logging\u002F7.better-auth",[105,108,113,118,122],{"title":41,"path":106,"stem":107,"icon":44},"\u002Flogging\u002Fbetter-auth\u002Foverview","2.logging\u002F7.better-auth\u002F01.overview",{"title":109,"path":110,"stem":111,"icon":112},"Identify User","\u002Flogging\u002Fbetter-auth\u002Fidentify-user","2.logging\u002F7.better-auth\u002F02.identify-user","i-lucide-user-check",{"title":114,"path":115,"stem":116,"icon":117},"Middleware","\u002Flogging\u002Fbetter-auth\u002Fmiddleware","2.logging\u002F7.better-auth\u002F03.middleware","i-lucide-shield",{"title":119,"path":120,"stem":121,"icon":69},"Client Sync","\u002Flogging\u002Fbetter-auth\u002Fclient-sync","2.logging\u002F7.better-auth\u002F04.client-sync",{"title":123,"path":124,"stem":125,"icon":126},"Performance","\u002Flogging\u002Fbetter-auth\u002Fperformance","2.logging\u002F7.better-auth\u002F05.performance","i-lucide-gauge",{"title":128,"icon":129,"path":130,"stem":131,"children":132,"page":34},"Audit Logs","i-lucide-shield-check","\u002Flogging\u002Faudit","2.logging\u002F8.audit",[133,136,141,146,151,155],{"title":41,"path":134,"stem":135,"icon":44},"\u002Flogging\u002Faudit\u002Foverview","2.logging\u002F8.audit\u002F01.overview",{"title":137,"path":138,"stem":139,"icon":140},"Schema","\u002Flogging\u002Faudit\u002Fschema","2.logging\u002F8.audit\u002F02.schema","i-lucide-file-text",{"title":142,"path":143,"stem":144,"icon":145},"Recording","\u002Flogging\u002Faudit\u002Frecording","2.logging\u002F8.audit\u002F03.recording","i-lucide-pen-line",{"title":147,"path":148,"stem":149,"icon":150},"Drains","\u002Flogging\u002Faudit\u002Fpipeline","2.logging\u002F8.audit\u002F04.pipeline","i-lucide-link",{"title":152,"path":153,"stem":154,"icon":129},"Compliance","\u002Flogging\u002Faudit\u002Fcompliance","2.logging\u002F8.audit\u002F05.compliance",{"title":156,"path":157,"stem":158,"icon":64},"Recipes","\u002Flogging\u002Faudit\u002Frecipes","2.logging\u002F8.audit\u002F06.recipes",{"title":160,"path":161,"stem":162,"children":163,"page":34},"Core Concepts","\u002Fcore-concepts","3.core-concepts",[164,169,174,179,184,188,191,196],{"title":165,"path":166,"stem":167,"icon":168},"Lifecycle","\u002Fcore-concepts\u002Flifecycle","3.core-concepts\u002F0.lifecycle","i-lucide-arrow-right-left",{"title":170,"path":171,"stem":172,"icon":173},"Configuration","\u002Fcore-concepts\u002Fconfiguration","3.core-concepts\u002F1.configuration","i-lucide-settings",{"title":175,"path":176,"stem":177,"icon":178},"Sampling","\u002Fcore-concepts\u002Fsampling","3.core-concepts\u002F2.sampling","i-lucide-filter",{"title":180,"path":181,"stem":182,"icon":183},"Typed Fields","\u002Fcore-concepts\u002Ftyped-fields","3.core-concepts\u002F3.typed-fields","i-simple-icons-typescript",{"title":185,"path":186,"stem":187,"icon":129},"Best Practices","\u002Fcore-concepts\u002Fbest-practices","3.core-concepts\u002F4.best-practices",{"title":123,"path":189,"stem":190,"icon":126},"\u002Fcore-concepts\u002Fperformance","3.core-concepts\u002F5.performance",{"title":192,"path":193,"stem":194,"icon":195},"Vite Plugin","\u002Fcore-concepts\u002Fvite-plugin","3.core-concepts\u002F6.vite-plugin","i-custom-vite",{"title":197,"path":198,"stem":199,"icon":200},"Auto-Redaction","\u002Fcore-concepts\u002Fredaction","3.core-concepts\u002F7.redaction","i-lucide-eye-off",{"title":202,"path":203,"stem":204,"children":205,"page":34},"Frameworks","\u002Fframeworks","4.frameworks",[206,210,215,220,225,230,235,240,245,250,255,260,265,270,274,279,284],{"title":41,"path":207,"stem":208,"icon":209},"\u002Fframeworks\u002Foverview","4.frameworks\u002F00.overview","i-lucide-layout-grid",{"title":211,"path":212,"stem":213,"icon":214},"Nuxt","\u002Fframeworks\u002Fnuxt","4.frameworks\u002F01.nuxt","i-simple-icons-nuxtdotjs",{"title":216,"path":217,"stem":218,"icon":219},"Next.js","\u002Fframeworks\u002Fnextjs","4.frameworks\u002F02.nextjs","i-simple-icons-nextdotjs",{"title":221,"path":222,"stem":223,"icon":224},"SvelteKit","\u002Fframeworks\u002Fsveltekit","4.frameworks\u002F03.sveltekit","i-simple-icons-svelte",{"title":226,"path":227,"stem":228,"icon":229},"Nitro","\u002Fframeworks\u002Fnitro","4.frameworks\u002F04.nitro","i-custom-nitro",{"title":231,"path":232,"stem":233,"icon":234},"TanStack Start","\u002Fframeworks\u002Ftanstack-start","4.frameworks\u002F05.tanstack-start","i-custom-tanstack",{"title":236,"path":237,"stem":238,"icon":239},"NestJS","\u002Fframeworks\u002Fnestjs","4.frameworks\u002F06.nestjs","i-simple-icons-nestjs",{"title":241,"path":242,"stem":243,"icon":244},"Express","\u002Fframeworks\u002Fexpress","4.frameworks\u002F07.express","i-simple-icons-express",{"title":246,"path":247,"stem":248,"icon":249},"Hono","\u002Fframeworks\u002Fhono","4.frameworks\u002F08.hono","i-simple-icons-hono",{"title":251,"path":252,"stem":253,"icon":254},"Fastify","\u002Fframeworks\u002Ffastify","4.frameworks\u002F09.fastify","i-simple-icons-fastify",{"title":256,"path":257,"stem":258,"icon":259},"Elysia","\u002Fframeworks\u002Felysia","4.frameworks\u002F10.elysia","i-custom-elysia",{"title":261,"path":262,"stem":263,"icon":264},"React Router","\u002Fframeworks\u002Freact-router","4.frameworks\u002F11.react-router","i-custom-reactrouter",{"title":266,"path":267,"stem":268,"icon":269},"Cloudflare Workers","\u002Fframeworks\u002Fcloudflare-workers","4.frameworks\u002F12.cloudflare-workers","i-simple-icons-cloudflare",{"title":271,"path":272,"stem":273,"icon":183},"Standalone","\u002Fframeworks\u002Fstandalone","4.frameworks\u002F13.standalone",{"title":275,"path":276,"stem":277,"icon":278},"Astro","\u002Fframeworks\u002Fastro","4.frameworks\u002F14.astro","i-simple-icons-astro",{"title":280,"path":281,"stem":282,"icon":283},"AWS Lambda","\u002Fframeworks\u002Faws-lambda","4.frameworks\u002F16.aws-lambda","i-custom-lambda",{"title":285,"path":286,"stem":287,"icon":288},"Custom Integration","\u002Fframeworks\u002Fcustom-integration","4.frameworks\u002F17.custom-integration","i-lucide-puzzle",{"title":290,"path":291,"stem":292,"children":293,"page":34},"Build on top","\u002Fbuild-on-top","5.build-on-top",[294,297,302,307,311,315,320],{"title":41,"path":295,"stem":296,"icon":54},"\u002Fbuild-on-top\u002Foverview","5.build-on-top\u002F0.overview",{"title":298,"path":299,"stem":300,"icon":301},"Stream","\u002Fbuild-on-top\u002Fstream","5.build-on-top\u002F1.stream","i-lucide-radio-tower",{"title":303,"path":304,"stem":305,"icon":306},"FS reader","\u002Fbuild-on-top\u002Ffs-reader","5.build-on-top\u002F2.fs-reader","i-lucide-folder-search",{"title":156,"path":308,"stem":309,"icon":310},"\u002Fbuild-on-top\u002Fconsumer-recipes","5.build-on-top\u002F3.consumer-recipes","i-lucide-chef-hat",{"title":312,"path":313,"stem":314,"icon":288},"Pipeline extension","\u002Fbuild-on-top\u002Fpipeline-extension","5.build-on-top\u002F4.pipeline-extension",{"title":316,"path":317,"stem":318,"icon":319},"Sinks","\u002Fbuild-on-top\u002Fsinks","5.build-on-top\u002F5.sinks","i-lucide-share-2",{"title":321,"path":322,"stem":323,"icon":288},"Framework integration","\u002Fbuild-on-top\u002Fframework-integration","5.build-on-top\u002F6.framework-integration",{"title":325,"path":326,"stem":327,"children":328,"page":34},"Adapters","\u002Fadapters","6.adapters",[329,332,372,387],{"title":41,"path":330,"stem":331,"icon":44},"\u002Fadapters\u002Foverview","6.adapters\u002F01.overview",{"title":333,"path":334,"stem":335,"children":336,"page":34},"Cloud destinations","\u002Fadapters\u002Fcloud","6.adapters\u002F02.cloud",[337,342,347,352,357,362,367],{"title":338,"path":339,"stem":340,"icon":341},"Axiom","\u002Fadapters\u002Fcloud\u002Faxiom","6.adapters\u002F02.cloud\u002F01.axiom","i-custom-axiom",{"title":343,"path":344,"stem":345,"icon":346},"OTLP","\u002Fadapters\u002Fcloud\u002Fotlp","6.adapters\u002F02.cloud\u002F02.otlp","i-simple-icons-opentelemetry",{"title":348,"path":349,"stem":350,"icon":351},"PostHog","\u002Fadapters\u002Fcloud\u002Fposthog","6.adapters\u002F02.cloud\u002F03.posthog","i-simple-icons-posthog",{"title":353,"path":354,"stem":355,"icon":356},"Sentry","\u002Fadapters\u002Fcloud\u002Fsentry","6.adapters\u002F02.cloud\u002F04.sentry","i-simple-icons-sentry",{"title":358,"path":359,"stem":360,"icon":361},"Better Stack","\u002Fadapters\u002Fcloud\u002Fbetter-stack","6.adapters\u002F02.cloud\u002F05.better-stack","i-simple-icons-betterstack",{"title":363,"path":364,"stem":365,"icon":366},"Datadog","\u002Fadapters\u002Fcloud\u002Fdatadog","6.adapters\u002F02.cloud\u002F06.datadog","i-simple-icons-datadog",{"title":368,"path":369,"stem":370,"icon":371},"HyperDX","\u002Fadapters\u002Fcloud\u002Fhyperdx","6.adapters\u002F02.cloud\u002F07.hyperdx","i-custom-hyperdx",{"title":373,"path":374,"stem":375,"children":376,"page":34},"Self-hosted","\u002Fadapters\u002Fself-hosted","6.adapters\u002F03.self-hosted",[377,382],{"title":378,"path":379,"stem":380,"icon":381},"File System","\u002Fadapters\u002Fself-hosted\u002Ffs","6.adapters\u002F03.self-hosted\u002F01.fs","i-lucide-hard-drive",{"title":383,"path":384,"stem":385,"icon":386},"NuxtHub","\u002Fadapters\u002Fself-hosted\u002Fnuxthub","6.adapters\u002F03.self-hosted\u002F02.nuxthub","i-simple-icons-nuxt",{"title":388,"path":389,"stem":390,"children":391,"page":34},"Building blocks","\u002Fadapters\u002Fbuilding-blocks","6.adapters\u002F04.building-blocks",[392,397,402,406],{"title":393,"path":394,"stem":395,"icon":396},"Pipeline","\u002Fadapters\u002Fbuilding-blocks\u002Fpipeline","6.adapters\u002F04.building-blocks\u002F01.pipeline","i-lucide-workflow",{"title":398,"path":399,"stem":400,"icon":401},"HTTP","\u002Fadapters\u002Fbuilding-blocks\u002Fhttp","6.adapters\u002F04.building-blocks\u002F02.http","i-lucide-globe",{"title":403,"path":404,"stem":405,"icon":83},"Custom Adapters","\u002Fadapters\u002Fbuilding-blocks\u002Fcustom","6.adapters\u002F04.building-blocks\u002F03.custom",{"title":407,"path":408,"stem":409,"icon":410},"Toolkit","\u002Fadapters\u002Fbuilding-blocks\u002Ftoolkit","6.adapters\u002F04.building-blocks\u002F04.toolkit","i-lucide-blocks",{"title":412,"path":413,"stem":414,"children":415,"page":34},"Enrichers","\u002Fenrichers","7.enrichers",[416,419,423],{"title":41,"path":417,"stem":418,"icon":28},"\u002Fenrichers\u002Foverview","7.enrichers\u002F1.overview",{"title":420,"path":421,"stem":422,"icon":288},"Built-in","\u002Fenrichers\u002Fbuilt-in","7.enrichers\u002F2.built-in",{"title":424,"path":425,"stem":426,"icon":83},"Custom","\u002Fenrichers\u002Fcustom","7.enrichers\u002F3.custom",{"id":428,"title":85,"body":429,"description":1164,"extension":1165,"links":1166,"meta":1172,"navigation":1173,"path":86,"seo":1174,"stem":87,"__hash__":1175},"docs\u002F2.logging\u002F6.ai-sdk\u002F03.options.md",{"type":430,"value":431,"toc":1155},"minimark",[432,440,510,515,529,541,546,602,606,648,652,803,853,866,870,880,986,996,1003,1007,1010,1144,1151],[433,434,435,439],"p",{},[436,437,438],"code",{},"createAILogger(log, options?)"," accepts a single options bag. Every option is opt-in — defaults stay safe and quiet.",[441,442,443,462],"table",{},[444,445,446],"thead",{},[447,448,449,453,456,459],"tr",{},[450,451,452],"th",{},"Option",[450,454,455],{},"Type",[450,457,458],{},"Default",[450,460,461],{},"Description",[463,464,465,486],"tbody",{},[447,466,467,473,478,483],{},[468,469,470],"td",{},[436,471,472],{},"toolInputs",[468,474,475],{},[436,476,477],{},"boolean | ToolInputsOptions",[468,479,480],{},[436,481,482],{},"false",[468,484,485],{},"Capture tool call inputs alongside their names (off by default to avoid leaking sensitive data).",[447,487,488,493,498,503],{},[468,489,490],{},[436,491,492],{},"cost",[468,494,495],{},[436,496,497],{},"Record\u003Cstring, ModelCost>",[468,499,500],{},[436,501,502],{},"undefined",[468,504,505,506,509],{},"Pricing map. Keys are model IDs, values are ",[436,507,508],{},"{ input, output }"," in dollars per 1M tokens.",[511,512,514],"h2",{"id":513},"tool-inputs","Tool Inputs",[433,516,517,518,521,522,525,526,528],{},"By default, ",[436,519,520],{},"ai.toolCalls"," is a ",[436,523,524],{},"string[]"," of tool names. Enable ",[436,527,472],{}," to capture inputs too — useful for debugging agent behaviour or auditing what data the model reached for.",[530,531,532,533,536,537,540],"warning",{},"Tool inputs can be large and may contain sensitive data (SQL, API keys, customer PII). Use ",[436,534,535],{},"maxLength"," and ",[436,538,539],{},"transform"," rather than enabling raw capture in production.",[542,543,545],"h3",{"id":544},"capture-everything","Capture everything",[547,548,553],"pre",{"className":549,"code":550,"language":551,"meta":552,"style":552},"language-typescript shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","const ai = createAILogger(log, { toolInputs: true })\n","typescript","",[436,554,555],{"__ignoreMap":552},[556,557,560,564,568,572,576,579,582,585,589,592,596,599],"span",{"class":558,"line":559},"line",1,[556,561,563],{"class":562},"spNyl","const",[556,565,567],{"class":566},"sTEyZ"," ai ",[556,569,571],{"class":570},"sMK4o","=",[556,573,575],{"class":574},"s2Zo4"," createAILogger",[556,577,578],{"class":566},"(log",[556,580,581],{"class":570},",",[556,583,584],{"class":570}," {",[556,586,588],{"class":587},"swJcz"," toolInputs",[556,590,591],{"class":570},":",[556,593,595],{"class":594},"sfNiH"," true",[556,597,598],{"class":570}," }",[556,600,601],{"class":566},")\n",[542,603,605],{"id":604},"truncate-long-inputs","Truncate long inputs",[547,607,609],{"className":549,"code":608,"language":551,"meta":552,"style":552},"const ai = createAILogger(log, { toolInputs: { maxLength: 200 } })\n",[436,610,611],{"__ignoreMap":552},[556,612,613,615,617,619,621,623,625,627,629,631,633,636,638,642,644,646],{"class":558,"line":559},[556,614,563],{"class":562},[556,616,567],{"class":566},[556,618,571],{"class":570},[556,620,575],{"class":574},[556,622,578],{"class":566},[556,624,581],{"class":570},[556,626,584],{"class":570},[556,628,588],{"class":587},[556,630,591],{"class":570},[556,632,584],{"class":570},[556,634,635],{"class":587}," maxLength",[556,637,591],{"class":570},[556,639,641],{"class":640},"sbssI"," 200",[556,643,598],{"class":570},[556,645,598],{"class":570},[556,647,601],{"class":566},[542,649,651],{"id":650},"redact-sensitive-fields","Redact sensitive fields",[547,653,655],{"className":549,"code":654,"language":551,"meta":552,"style":552},"const ai = createAILogger(log, {\n  toolInputs: {\n    maxLength: 500,\n    transform: (input, toolName) => {\n      if (toolName === 'queryDB') return { sql: '***' }\n      return input\n    },\n  },\n})\n",[436,656,657,674,684,698,726,774,783,789,795],{"__ignoreMap":552},[556,658,659,661,663,665,667,669,671],{"class":558,"line":559},[556,660,563],{"class":562},[556,662,567],{"class":566},[556,664,571],{"class":570},[556,666,575],{"class":574},[556,668,578],{"class":566},[556,670,581],{"class":570},[556,672,673],{"class":570}," {\n",[556,675,677,680,682],{"class":558,"line":676},2,[556,678,679],{"class":587},"  toolInputs",[556,681,591],{"class":570},[556,683,673],{"class":570},[556,685,687,690,692,695],{"class":558,"line":686},3,[556,688,689],{"class":587},"    maxLength",[556,691,591],{"class":570},[556,693,694],{"class":640}," 500",[556,696,697],{"class":570},",\n",[556,699,701,704,706,709,713,715,718,721,724],{"class":558,"line":700},4,[556,702,703],{"class":574},"    transform",[556,705,591],{"class":570},[556,707,708],{"class":570}," (",[556,710,712],{"class":711},"sHdIc","input",[556,714,581],{"class":570},[556,716,717],{"class":711}," toolName",[556,719,720],{"class":570},")",[556,722,723],{"class":562}," =>",[556,725,673],{"class":570},[556,727,729,733,735,738,741,744,748,751,754,757,759,762,764,766,769,771],{"class":558,"line":728},5,[556,730,732],{"class":731},"s7zQu","      if",[556,734,708],{"class":587},[556,736,737],{"class":566},"toolName",[556,739,740],{"class":570}," ===",[556,742,743],{"class":570}," '",[556,745,747],{"class":746},"sfazB","queryDB",[556,749,750],{"class":570},"'",[556,752,753],{"class":587},") ",[556,755,756],{"class":731},"return",[556,758,584],{"class":570},[556,760,761],{"class":587}," sql",[556,763,591],{"class":570},[556,765,743],{"class":570},[556,767,768],{"class":746},"***",[556,770,750],{"class":570},[556,772,773],{"class":570}," }\n",[556,775,777,780],{"class":558,"line":776},6,[556,778,779],{"class":731},"      return",[556,781,782],{"class":566}," input\n",[556,784,786],{"class":558,"line":785},7,[556,787,788],{"class":570},"    },\n",[556,790,792],{"class":558,"line":791},8,[556,793,794],{"class":570},"  },\n",[556,796,798,801],{"class":558,"line":797},9,[556,799,800],{"class":570},"}",[556,802,601],{"class":566},[441,804,805,816],{},[444,806,807],{},[447,808,809,812,814],{},[450,810,811],{},"Sub-option",[450,813,455],{},[450,815,461],{},[463,817,818,836],{},[447,819,820,824,829],{},[468,821,822],{},[436,823,535],{},[468,825,826],{},[436,827,828],{},"number",[468,830,831,832,835],{},"Truncate stringified inputs exceeding this character length (appends ",[436,833,834],{},"…",").",[447,837,838,842,847],{},[468,839,840],{},[436,841,539],{},[468,843,844],{},[436,845,846],{},"(input, toolName) => unknown",[468,848,849,850,852],{},"Custom transform applied before ",[436,851,535],{},". Use to redact fields or reshape data.",[433,854,855,856,858,859,861,862,865],{},"When ",[436,857,472],{}," is enabled, ",[436,860,520],{}," becomes an ",[436,863,864],{},"Array\u003C{ name, input }>"," instead of a plain string array.",[511,867,869],{"id":868},"cost-estimation","Cost Estimation",[433,871,872,873,875,876,879],{},"Pass a ",[436,874,492],{}," map to compute estimated dollar cost per call. The middleware multiplies token usage by the per-million rates and sets ",[436,877,878],{},"ai.estimatedCost"," on the wide event.",[547,881,883],{"className":549,"code":882,"language":551,"meta":552,"style":552},"const ai = createAILogger(log, {\n  cost: {\n    'claude-sonnet-4.6': { input: 3, output: 15 },\n    'gpt-4o': { input: 2.5, output: 10 },\n  },\n})\n",[436,884,885,901,910,945,976,980],{"__ignoreMap":552},[556,886,887,889,891,893,895,897,899],{"class":558,"line":559},[556,888,563],{"class":562},[556,890,567],{"class":566},[556,892,571],{"class":570},[556,894,575],{"class":574},[556,896,578],{"class":566},[556,898,581],{"class":570},[556,900,673],{"class":570},[556,902,903,906,908],{"class":558,"line":676},[556,904,905],{"class":587},"  cost",[556,907,591],{"class":570},[556,909,673],{"class":570},[556,911,912,915,918,920,922,924,927,929,932,934,937,939,942],{"class":558,"line":686},[556,913,914],{"class":570},"    '",[556,916,917],{"class":587},"claude-sonnet-4.6",[556,919,750],{"class":570},[556,921,591],{"class":570},[556,923,584],{"class":570},[556,925,926],{"class":587}," input",[556,928,591],{"class":570},[556,930,931],{"class":640}," 3",[556,933,581],{"class":570},[556,935,936],{"class":587}," output",[556,938,591],{"class":570},[556,940,941],{"class":640}," 15",[556,943,944],{"class":570}," },\n",[556,946,947,949,952,954,956,958,960,962,965,967,969,971,974],{"class":558,"line":700},[556,948,914],{"class":570},[556,950,951],{"class":587},"gpt-4o",[556,953,750],{"class":570},[556,955,591],{"class":570},[556,957,584],{"class":570},[556,959,926],{"class":587},[556,961,591],{"class":570},[556,963,964],{"class":640}," 2.5",[556,966,581],{"class":570},[556,968,936],{"class":587},[556,970,591],{"class":570},[556,972,973],{"class":640}," 10",[556,975,944],{"class":570},[556,977,978],{"class":558,"line":728},[556,979,794],{"class":570},[556,981,982,984],{"class":558,"line":776},[556,983,800],{"class":570},[556,985,601],{"class":566},[433,987,988,989,995],{},"Read the result from your handler with ",[990,991,992],"a",{"href":91},[436,993,994],{},"ai.getEstimatedCost()"," — useful for billing dashboards or warning users before expensive calls.",[997,998,999,1000,1002],"tip",{},"Keep your ",[436,1001,492],{}," map in one file alongside model selection so renaming a model in production also updates pricing. Avoid hardcoding per-route maps.",[511,1004,1006],{"id":1005},"error-handling","Error Handling",[433,1008,1009],{},"If a model call fails, the middleware captures the error into the wide event before re-throwing:",[547,1011,1016],{"className":1012,"code":1013,"filename":1014,"language":1015,"meta":552,"style":552},"language-json shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","{\n  \"ai\": {\n    \"calls\": 1,\n    \"model\": \"claude-sonnet-4.6\",\n    \"provider\": \"anthropic\",\n    \"finishReason\": \"error\",\n    \"error\": \"API rate limit exceeded\"\n  }\n}\n","Wide Event","json",[436,1017,1018,1023,1038,1056,1076,1096,1116,1134,1139],{"__ignoreMap":552},[556,1019,1020],{"class":558,"line":559},[556,1021,1022],{"class":570},"{\n",[556,1024,1025,1028,1031,1034,1036],{"class":558,"line":676},[556,1026,1027],{"class":570},"  \"",[556,1029,1030],{"class":562},"ai",[556,1032,1033],{"class":570},"\"",[556,1035,591],{"class":570},[556,1037,673],{"class":570},[556,1039,1040,1043,1047,1049,1051,1054],{"class":558,"line":686},[556,1041,1042],{"class":570},"    \"",[556,1044,1046],{"class":1045},"sBMFI","calls",[556,1048,1033],{"class":570},[556,1050,591],{"class":570},[556,1052,1053],{"class":640}," 1",[556,1055,697],{"class":570},[556,1057,1058,1060,1063,1065,1067,1070,1072,1074],{"class":558,"line":700},[556,1059,1042],{"class":570},[556,1061,1062],{"class":1045},"model",[556,1064,1033],{"class":570},[556,1066,591],{"class":570},[556,1068,1069],{"class":570}," \"",[556,1071,917],{"class":746},[556,1073,1033],{"class":570},[556,1075,697],{"class":570},[556,1077,1078,1080,1083,1085,1087,1089,1092,1094],{"class":558,"line":728},[556,1079,1042],{"class":570},[556,1081,1082],{"class":1045},"provider",[556,1084,1033],{"class":570},[556,1086,591],{"class":570},[556,1088,1069],{"class":570},[556,1090,1091],{"class":746},"anthropic",[556,1093,1033],{"class":570},[556,1095,697],{"class":570},[556,1097,1098,1100,1103,1105,1107,1109,1112,1114],{"class":558,"line":776},[556,1099,1042],{"class":570},[556,1101,1102],{"class":1045},"finishReason",[556,1104,1033],{"class":570},[556,1106,591],{"class":570},[556,1108,1069],{"class":570},[556,1110,1111],{"class":746},"error",[556,1113,1033],{"class":570},[556,1115,697],{"class":570},[556,1117,1118,1120,1122,1124,1126,1128,1131],{"class":558,"line":785},[556,1119,1042],{"class":570},[556,1121,1111],{"class":1045},[556,1123,1033],{"class":570},[556,1125,591],{"class":570},[556,1127,1069],{"class":570},[556,1129,1130],{"class":746},"API rate limit exceeded",[556,1132,1133],{"class":570},"\"\n",[556,1135,1136],{"class":558,"line":791},[556,1137,1138],{"class":570},"  }\n",[556,1140,1141],{"class":558,"line":797},[556,1142,1143],{"class":570},"}\n",[433,1145,1146,1147,1150],{},"Stream errors (e.g. content filter) are also captured from the stream's error chunks. Your error-handling code (",[436,1148,1149],{},"try\u002Fcatch",", route-level error handlers) keeps working as usual — the middleware only observes.",[1152,1153,1154],"style",{},"html pre.shiki code .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}html pre.shiki code .swJcz, html code.shiki .swJcz{--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178}html pre.shiki code .sfNiH, html code.shiki .sfNiH{--shiki-light:#FF5370;--shiki-default:#FF9CAC;--shiki-dark:#FF9CAC}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .sbssI, html code.shiki .sbssI{--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C}html pre.shiki code .sHdIc, html code.shiki .sHdIc{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#EEFFFF;--shiki-default-font-style:italic;--shiki-dark:#BABED8;--shiki-dark-font-style:italic}html pre.shiki code .s7zQu, html code.shiki .s7zQu{--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#89DDFF;--shiki-dark-font-style:italic}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html pre.shiki code .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}",{"title":552,"searchDepth":676,"depth":676,"links":1156},[1157,1162,1163],{"id":513,"depth":676,"text":514,"children":1158},[1159,1160,1161],{"id":544,"depth":686,"text":545},{"id":604,"depth":686,"text":605},{"id":650,"depth":686,"text":651},{"id":868,"depth":676,"text":869},{"id":1005,"depth":676,"text":1006},"Configure tool input capture (with redaction and truncation), enable cost estimation per model, and handle errors during AI calls.","md",[1167,1170],{"label":41,"icon":44,"to":77,"color":1168,"variant":1169},"neutral","subtle",{"label":1171,"icon":83,"to":81,"color":1168,"variant":1169},"Usage Patterns",{},{"title":85,"icon":88},{"title":85,"description":1164},"wNWYlAoixuzpqUkoMmAWzxK3lYeBu_IxjZhS0DnZOSs",[1177,1179],{"title":80,"path":81,"stem":82,"description":1178,"icon":83,"children":-1},"streamText, generateText, multi-step agents, RAG, and multiple models — every common AI SDK pattern wired into evlog.",{"title":90,"path":91,"stem":92,"description":1180,"icon":93,"children":-1},"Read AI metadata from your handler — persist it, surface it to end-users, bill against it, or stream incremental progress to the client.",1778346897409]