[{"data":1,"prerenderedAt":1695},["ShallowReactive",2],{"navigation_docs":3,"-logging-ai-sdk-telemetry":392,"-logging-ai-sdk-telemetry-surround":1690},[4,35,159,201,289,376],{"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},"Adapters","\u002Fadapters","6.adapters",[294,297,337,352],{"title":41,"path":295,"stem":296,"icon":44},"\u002Fadapters\u002Foverview","6.adapters\u002F01.overview",{"title":298,"path":299,"stem":300,"children":301,"page":34},"Cloud destinations","\u002Fadapters\u002Fcloud","6.adapters\u002F02.cloud",[302,307,312,317,322,327,332],{"title":303,"path":304,"stem":305,"icon":306},"Axiom","\u002Fadapters\u002Fcloud\u002Faxiom","6.adapters\u002F02.cloud\u002F01.axiom","i-custom-axiom",{"title":308,"path":309,"stem":310,"icon":311},"OTLP","\u002Fadapters\u002Fcloud\u002Fotlp","6.adapters\u002F02.cloud\u002F02.otlp","i-simple-icons-opentelemetry",{"title":313,"path":314,"stem":315,"icon":316},"PostHog","\u002Fadapters\u002Fcloud\u002Fposthog","6.adapters\u002F02.cloud\u002F03.posthog","i-simple-icons-posthog",{"title":318,"path":319,"stem":320,"icon":321},"Sentry","\u002Fadapters\u002Fcloud\u002Fsentry","6.adapters\u002F02.cloud\u002F04.sentry","i-simple-icons-sentry",{"title":323,"path":324,"stem":325,"icon":326},"Better Stack","\u002Fadapters\u002Fcloud\u002Fbetter-stack","6.adapters\u002F02.cloud\u002F05.better-stack","i-simple-icons-betterstack",{"title":328,"path":329,"stem":330,"icon":331},"Datadog","\u002Fadapters\u002Fcloud\u002Fdatadog","6.adapters\u002F02.cloud\u002F06.datadog","i-simple-icons-datadog",{"title":333,"path":334,"stem":335,"icon":336},"HyperDX","\u002Fadapters\u002Fcloud\u002Fhyperdx","6.adapters\u002F02.cloud\u002F07.hyperdx","i-custom-hyperdx",{"title":338,"path":339,"stem":340,"children":341,"page":34},"Self-hosted","\u002Fadapters\u002Fself-hosted","6.adapters\u002F03.self-hosted",[342,347],{"title":343,"path":344,"stem":345,"icon":346},"File System","\u002Fadapters\u002Fself-hosted\u002Ffs","6.adapters\u002F03.self-hosted\u002F01.fs","i-lucide-hard-drive",{"title":348,"path":349,"stem":350,"icon":351},"NuxtHub","\u002Fadapters\u002Fself-hosted\u002Fnuxthub","6.adapters\u002F03.self-hosted\u002F02.nuxthub","i-simple-icons-nuxt",{"title":353,"path":354,"stem":355,"children":356,"page":34},"Building blocks","\u002Fadapters\u002Fbuilding-blocks","6.adapters\u002F04.building-blocks",[357,362,367,371],{"title":358,"path":359,"stem":360,"icon":361},"Pipeline","\u002Fadapters\u002Fbuilding-blocks\u002Fpipeline","6.adapters\u002F04.building-blocks\u002F01.pipeline","i-lucide-workflow",{"title":363,"path":364,"stem":365,"icon":366},"HTTP","\u002Fadapters\u002Fbuilding-blocks\u002Fhttp","6.adapters\u002F04.building-blocks\u002F02.http","i-lucide-globe",{"title":368,"path":369,"stem":370,"icon":83},"Custom Adapters","\u002Fadapters\u002Fbuilding-blocks\u002Fcustom","6.adapters\u002F04.building-blocks\u002F03.custom",{"title":372,"path":373,"stem":374,"icon":375},"Toolkit","\u002Fadapters\u002Fbuilding-blocks\u002Ftoolkit","6.adapters\u002F04.building-blocks\u002F04.toolkit","i-lucide-blocks",{"title":377,"path":378,"stem":379,"children":380,"page":34},"Enrichers","\u002Fenrichers","7.enrichers",[381,384,388],{"title":41,"path":382,"stem":383,"icon":28},"\u002Fenrichers\u002Foverview","7.enrichers\u002F1.overview",{"title":385,"path":386,"stem":387,"icon":288},"Built-in","\u002Fenrichers\u002Fbuilt-in","7.enrichers\u002F2.built-in",{"title":389,"path":390,"stem":391,"icon":83},"Custom","\u002Fenrichers\u002Fcustom","7.enrichers\u002F3.custom",{"id":393,"title":394,"body":395,"description":1678,"extension":1679,"links":1680,"meta":1686,"navigation":1687,"path":96,"seo":1688,"stem":97,"__hash__":1689},"docs\u002F2.logging\u002F6.ai-sdk\u002F05.telemetry.md","Deeper Telemetry",{"type":396,"value":397,"toc":1672},"minimark",[398,414,419,430,760,763,1131,1135,1138,1258,1262,1331,1334,1338,1346,1523,1533,1647,1668],[399,400,401,405,406,409,410,413],"p",{},[402,403,404],"code",{},"createAILogger"," covers tokens, model info, and streaming metrics. For deeper observability — per-tool execution timing, success\u002Ffailure tracking, and total generation wall time — add ",[402,407,408],{},"createEvlogIntegration()"," on top. It implements the AI SDK's ",[402,411,412],{},"TelemetryIntegration"," interface and captures data middleware alone cannot see.",[415,416,418],"h2",{"id":417},"combined-with-middleware-recommended","Combined with middleware (recommended)",[399,420,421,422,425,426,429],{},"When passed an ",[402,423,424],{},"AILogger",", the integration shares its accumulator. Both paths write to the same ",[402,427,428],{},"ai.*"," field:",[431,432,438],"pre",{"className":433,"code":434,"filename":435,"language":436,"meta":437,"style":437},"language-typescript shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","import { generateText } from 'ai'\nimport { createAILogger, createEvlogIntegration } from 'evlog\u002Fai'\n\nexport default defineEventHandler(async (event) => {\n  const log = useLogger(event)\n  const ai = createAILogger(log)\n\n  const result = await generateText({\n    model: ai.wrap('anthropic\u002Fclaude-sonnet-4.6'),\n    tools: { getWeather, searchDB },\n    experimental_telemetry: {\n      isEnabled: true,\n      integrations: [createEvlogIntegration(ai)],\n    },\n  })\n\n  return { text: result.text }\n})\n","server\u002Fapi\u002Fagent.post.ts","typescript","",[402,439,440,473,500,507,543,566,585,590,610,642,663,673,687,710,716,724,729,752],{"__ignoreMap":437},[441,442,445,449,453,457,460,463,466,470],"span",{"class":443,"line":444},"line",1,[441,446,448],{"class":447},"s7zQu","import",[441,450,452],{"class":451},"sMK4o"," {",[441,454,456],{"class":455},"sTEyZ"," generateText",[441,458,459],{"class":451}," }",[441,461,462],{"class":447}," from",[441,464,465],{"class":451}," '",[441,467,469],{"class":468},"sfazB","ai",[441,471,472],{"class":451},"'\n",[441,474,476,478,480,483,486,489,491,493,495,498],{"class":443,"line":475},2,[441,477,448],{"class":447},[441,479,452],{"class":451},[441,481,482],{"class":455}," createAILogger",[441,484,485],{"class":451},",",[441,487,488],{"class":455}," createEvlogIntegration",[441,490,459],{"class":451},[441,492,462],{"class":447},[441,494,465],{"class":451},[441,496,497],{"class":468},"evlog\u002Fai",[441,499,472],{"class":451},[441,501,503],{"class":443,"line":502},3,[441,504,506],{"emptyLinePlaceholder":505},true,"\n",[441,508,510,513,516,520,523,527,530,534,537,540],{"class":443,"line":509},4,[441,511,512],{"class":447},"export",[441,514,515],{"class":447}," default",[441,517,519],{"class":518},"s2Zo4"," defineEventHandler",[441,521,522],{"class":455},"(",[441,524,526],{"class":525},"spNyl","async",[441,528,529],{"class":451}," (",[441,531,533],{"class":532},"sHdIc","event",[441,535,536],{"class":451},")",[441,538,539],{"class":525}," =>",[441,541,542],{"class":451}," {\n",[441,544,546,549,552,555,558,561,563],{"class":443,"line":545},5,[441,547,548],{"class":525},"  const",[441,550,551],{"class":455}," log",[441,553,554],{"class":451}," =",[441,556,557],{"class":518}," useLogger",[441,559,522],{"class":560},"swJcz",[441,562,533],{"class":455},[441,564,565],{"class":560},")\n",[441,567,569,571,574,576,578,580,583],{"class":443,"line":568},6,[441,570,548],{"class":525},[441,572,573],{"class":455}," ai",[441,575,554],{"class":451},[441,577,482],{"class":518},[441,579,522],{"class":560},[441,581,582],{"class":455},"log",[441,584,565],{"class":560},[441,586,588],{"class":443,"line":587},7,[441,589,506],{"emptyLinePlaceholder":505},[441,591,593,595,598,600,603,605,607],{"class":443,"line":592},8,[441,594,548],{"class":525},[441,596,597],{"class":455}," result",[441,599,554],{"class":451},[441,601,602],{"class":447}," await",[441,604,456],{"class":518},[441,606,522],{"class":560},[441,608,609],{"class":451},"{\n",[441,611,613,616,619,621,624,627,629,632,635,637,639],{"class":443,"line":612},9,[441,614,615],{"class":560},"    model",[441,617,618],{"class":451},":",[441,620,573],{"class":455},[441,622,623],{"class":451},".",[441,625,626],{"class":518},"wrap",[441,628,522],{"class":560},[441,630,631],{"class":451},"'",[441,633,634],{"class":468},"anthropic\u002Fclaude-sonnet-4.6",[441,636,631],{"class":451},[441,638,536],{"class":560},[441,640,641],{"class":451},",\n",[441,643,645,648,650,652,655,657,660],{"class":443,"line":644},10,[441,646,647],{"class":560},"    tools",[441,649,618],{"class":451},[441,651,452],{"class":451},[441,653,654],{"class":455}," getWeather",[441,656,485],{"class":451},[441,658,659],{"class":455}," searchDB",[441,661,662],{"class":451}," },\n",[441,664,666,669,671],{"class":443,"line":665},11,[441,667,668],{"class":560},"    experimental_telemetry",[441,670,618],{"class":451},[441,672,542],{"class":451},[441,674,676,679,681,685],{"class":443,"line":675},12,[441,677,678],{"class":560},"      isEnabled",[441,680,618],{"class":451},[441,682,684],{"class":683},"sfNiH"," true",[441,686,641],{"class":451},[441,688,690,693,695,698,701,703,705,708],{"class":443,"line":689},13,[441,691,692],{"class":560},"      integrations",[441,694,618],{"class":451},[441,696,697],{"class":560}," [",[441,699,700],{"class":518},"createEvlogIntegration",[441,702,522],{"class":560},[441,704,469],{"class":455},[441,706,707],{"class":560},")]",[441,709,641],{"class":451},[441,711,713],{"class":443,"line":712},14,[441,714,715],{"class":451},"    },\n",[441,717,719,722],{"class":443,"line":718},15,[441,720,721],{"class":451},"  }",[441,723,565],{"class":560},[441,725,727],{"class":443,"line":726},16,[441,728,506],{"emptyLinePlaceholder":505},[441,730,732,735,737,740,742,744,746,749],{"class":443,"line":731},17,[441,733,734],{"class":447},"  return",[441,736,452],{"class":451},[441,738,739],{"class":560}," text",[441,741,618],{"class":451},[441,743,597],{"class":455},[441,745,623],{"class":451},[441,747,748],{"class":455},"text",[441,750,751],{"class":451}," }\n",[441,753,755,758],{"class":443,"line":754},18,[441,756,757],{"class":451},"}",[441,759,565],{"class":455},[399,761,762],{},"Your wide event now includes per-tool timing:",[431,764,769],{"className":765,"code":766,"filename":767,"language":768,"meta":437,"style":437},"language-json shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","{\n  \"ai\": {\n    \"calls\": 2,\n    \"steps\": 2,\n    \"model\": \"claude-sonnet-4.6\",\n    \"provider\": \"anthropic\",\n    \"inputTokens\": 3500,\n    \"outputTokens\": 800,\n    \"totalTokens\": 4300,\n    \"toolCalls\": [\"getWeather\", \"searchDB\"],\n    \"tools\": [\n      { \"name\": \"getWeather\", \"durationMs\": 150, \"success\": true },\n      { \"name\": \"searchDB\", \"durationMs\": 45, \"success\": true }\n    ],\n    \"totalDurationMs\": 2340,\n    \"msToFirstChunk\": 180,\n    \"msToFinish\": 2100,\n    \"tokensPerSecond\": 380\n  }\n}\n","Wide Event","json",[402,770,771,775,789,808,823,844,864,880,896,912,944,958,1007,1052,1057,1073,1089,1105,1119,1125],{"__ignoreMap":437},[441,772,773],{"class":443,"line":444},[441,774,609],{"class":451},[441,776,777,780,782,785,787],{"class":443,"line":475},[441,778,779],{"class":451},"  \"",[441,781,469],{"class":525},[441,783,784],{"class":451},"\"",[441,786,618],{"class":451},[441,788,542],{"class":451},[441,790,791,794,798,800,802,806],{"class":443,"line":502},[441,792,793],{"class":451},"    \"",[441,795,797],{"class":796},"sBMFI","calls",[441,799,784],{"class":451},[441,801,618],{"class":451},[441,803,805],{"class":804},"sbssI"," 2",[441,807,641],{"class":451},[441,809,810,812,815,817,819,821],{"class":443,"line":509},[441,811,793],{"class":451},[441,813,814],{"class":796},"steps",[441,816,784],{"class":451},[441,818,618],{"class":451},[441,820,805],{"class":804},[441,822,641],{"class":451},[441,824,825,827,830,832,834,837,840,842],{"class":443,"line":545},[441,826,793],{"class":451},[441,828,829],{"class":796},"model",[441,831,784],{"class":451},[441,833,618],{"class":451},[441,835,836],{"class":451}," \"",[441,838,839],{"class":468},"claude-sonnet-4.6",[441,841,784],{"class":451},[441,843,641],{"class":451},[441,845,846,848,851,853,855,857,860,862],{"class":443,"line":568},[441,847,793],{"class":451},[441,849,850],{"class":796},"provider",[441,852,784],{"class":451},[441,854,618],{"class":451},[441,856,836],{"class":451},[441,858,859],{"class":468},"anthropic",[441,861,784],{"class":451},[441,863,641],{"class":451},[441,865,866,868,871,873,875,878],{"class":443,"line":587},[441,867,793],{"class":451},[441,869,870],{"class":796},"inputTokens",[441,872,784],{"class":451},[441,874,618],{"class":451},[441,876,877],{"class":804}," 3500",[441,879,641],{"class":451},[441,881,882,884,887,889,891,894],{"class":443,"line":592},[441,883,793],{"class":451},[441,885,886],{"class":796},"outputTokens",[441,888,784],{"class":451},[441,890,618],{"class":451},[441,892,893],{"class":804}," 800",[441,895,641],{"class":451},[441,897,898,900,903,905,907,910],{"class":443,"line":612},[441,899,793],{"class":451},[441,901,902],{"class":796},"totalTokens",[441,904,784],{"class":451},[441,906,618],{"class":451},[441,908,909],{"class":804}," 4300",[441,911,641],{"class":451},[441,913,914,916,919,921,923,925,927,930,932,934,936,939,941],{"class":443,"line":644},[441,915,793],{"class":451},[441,917,918],{"class":796},"toolCalls",[441,920,784],{"class":451},[441,922,618],{"class":451},[441,924,697],{"class":451},[441,926,784],{"class":451},[441,928,929],{"class":468},"getWeather",[441,931,784],{"class":451},[441,933,485],{"class":451},[441,935,836],{"class":451},[441,937,938],{"class":468},"searchDB",[441,940,784],{"class":451},[441,942,943],{"class":451},"],\n",[441,945,946,948,951,953,955],{"class":443,"line":665},[441,947,793],{"class":451},[441,949,950],{"class":796},"tools",[441,952,784],{"class":451},[441,954,618],{"class":451},[441,956,957],{"class":451}," [\n",[441,959,960,963,965,968,970,972,974,976,978,980,982,985,987,989,992,994,996,999,1001,1003,1005],{"class":443,"line":675},[441,961,962],{"class":451},"      {",[441,964,836],{"class":451},[441,966,967],{"class":804},"name",[441,969,784],{"class":451},[441,971,618],{"class":451},[441,973,836],{"class":451},[441,975,929],{"class":468},[441,977,784],{"class":451},[441,979,485],{"class":451},[441,981,836],{"class":451},[441,983,984],{"class":804},"durationMs",[441,986,784],{"class":451},[441,988,618],{"class":451},[441,990,991],{"class":804}," 150",[441,993,485],{"class":451},[441,995,836],{"class":451},[441,997,998],{"class":804},"success",[441,1000,784],{"class":451},[441,1002,618],{"class":451},[441,1004,684],{"class":451},[441,1006,662],{"class":451},[441,1008,1009,1011,1013,1015,1017,1019,1021,1023,1025,1027,1029,1031,1033,1035,1038,1040,1042,1044,1046,1048,1050],{"class":443,"line":689},[441,1010,962],{"class":451},[441,1012,836],{"class":451},[441,1014,967],{"class":804},[441,1016,784],{"class":451},[441,1018,618],{"class":451},[441,1020,836],{"class":451},[441,1022,938],{"class":468},[441,1024,784],{"class":451},[441,1026,485],{"class":451},[441,1028,836],{"class":451},[441,1030,984],{"class":804},[441,1032,784],{"class":451},[441,1034,618],{"class":451},[441,1036,1037],{"class":804}," 45",[441,1039,485],{"class":451},[441,1041,836],{"class":451},[441,1043,998],{"class":804},[441,1045,784],{"class":451},[441,1047,618],{"class":451},[441,1049,684],{"class":451},[441,1051,751],{"class":451},[441,1053,1054],{"class":443,"line":712},[441,1055,1056],{"class":451},"    ],\n",[441,1058,1059,1061,1064,1066,1068,1071],{"class":443,"line":718},[441,1060,793],{"class":451},[441,1062,1063],{"class":796},"totalDurationMs",[441,1065,784],{"class":451},[441,1067,618],{"class":451},[441,1069,1070],{"class":804}," 2340",[441,1072,641],{"class":451},[441,1074,1075,1077,1080,1082,1084,1087],{"class":443,"line":726},[441,1076,793],{"class":451},[441,1078,1079],{"class":796},"msToFirstChunk",[441,1081,784],{"class":451},[441,1083,618],{"class":451},[441,1085,1086],{"class":804}," 180",[441,1088,641],{"class":451},[441,1090,1091,1093,1096,1098,1100,1103],{"class":443,"line":731},[441,1092,793],{"class":451},[441,1094,1095],{"class":796},"msToFinish",[441,1097,784],{"class":451},[441,1099,618],{"class":451},[441,1101,1102],{"class":804}," 2100",[441,1104,641],{"class":451},[441,1106,1107,1109,1112,1114,1116],{"class":443,"line":754},[441,1108,793],{"class":451},[441,1110,1111],{"class":796},"tokensPerSecond",[441,1113,784],{"class":451},[441,1115,618],{"class":451},[441,1117,1118],{"class":804}," 380\n",[441,1120,1122],{"class":443,"line":1121},19,[441,1123,1124],{"class":451},"  }\n",[441,1126,1128],{"class":443,"line":1127},20,[441,1129,1130],{"class":451},"}\n",[415,1132,1134],{"id":1133},"standalone-without-middleware","Standalone (without middleware)",[399,1136,1137],{},"If your model is already wrapped (e.g. by another middleware), pass the request logger directly:",[431,1139,1142],{"className":433,"code":1140,"filename":1141,"language":436,"meta":437,"style":437},"import { createEvlogIntegration } from 'evlog\u002Fai'\n\nconst integration = createEvlogIntegration(log)\n\nconst result = await generateText({\n  model: somePreWrappedModel,\n  experimental_telemetry: {\n    isEnabled: true,\n    integrations: [integration],\n  },\n})\n","server\u002Fapi\u002Fchat.post.ts",[402,1143,1144,1162,1166,1182,1186,1203,1215,1224,1235,1247,1252],{"__ignoreMap":437},[441,1145,1146,1148,1150,1152,1154,1156,1158,1160],{"class":443,"line":444},[441,1147,448],{"class":447},[441,1149,452],{"class":451},[441,1151,488],{"class":455},[441,1153,459],{"class":451},[441,1155,462],{"class":447},[441,1157,465],{"class":451},[441,1159,497],{"class":468},[441,1161,472],{"class":451},[441,1163,1164],{"class":443,"line":475},[441,1165,506],{"emptyLinePlaceholder":505},[441,1167,1168,1171,1174,1177,1179],{"class":443,"line":502},[441,1169,1170],{"class":525},"const",[441,1172,1173],{"class":455}," integration ",[441,1175,1176],{"class":451},"=",[441,1178,488],{"class":518},[441,1180,1181],{"class":455},"(log)\n",[441,1183,1184],{"class":443,"line":509},[441,1185,506],{"emptyLinePlaceholder":505},[441,1187,1188,1190,1193,1195,1197,1199,1201],{"class":443,"line":545},[441,1189,1170],{"class":525},[441,1191,1192],{"class":455}," result ",[441,1194,1176],{"class":451},[441,1196,602],{"class":447},[441,1198,456],{"class":518},[441,1200,522],{"class":455},[441,1202,609],{"class":451},[441,1204,1205,1208,1210,1213],{"class":443,"line":568},[441,1206,1207],{"class":560},"  model",[441,1209,618],{"class":451},[441,1211,1212],{"class":455}," somePreWrappedModel",[441,1214,641],{"class":451},[441,1216,1217,1220,1222],{"class":443,"line":587},[441,1218,1219],{"class":560},"  experimental_telemetry",[441,1221,618],{"class":451},[441,1223,542],{"class":451},[441,1225,1226,1229,1231,1233],{"class":443,"line":592},[441,1227,1228],{"class":560},"    isEnabled",[441,1230,618],{"class":451},[441,1232,684],{"class":683},[441,1234,641],{"class":451},[441,1236,1237,1240,1242,1245],{"class":443,"line":612},[441,1238,1239],{"class":560},"    integrations",[441,1241,618],{"class":451},[441,1243,1244],{"class":455}," [integration]",[441,1246,641],{"class":451},[441,1248,1249],{"class":443,"line":644},[441,1250,1251],{"class":451},"  },\n",[441,1253,1254,1256],{"class":443,"line":665},[441,1255,757],{"class":451},[441,1257,565],{"class":455},[415,1259,1261],{"id":1260},"what-the-integration-captures","What the integration captures",[1263,1264,1265,1281],"table",{},[1266,1267,1268],"thead",{},[1269,1270,1271,1275,1278],"tr",{},[1272,1273,1274],"th",{},"Data",[1272,1276,1277],{},"Source",[1272,1279,1280],{},"Description",[1282,1283,1284,1312],"tbody",{},[1269,1285,1286,1292,1297],{},[1287,1288,1289],"td",{},[402,1290,1291],{},"ai.tools[]",[1287,1293,1294],{},[402,1295,1296],{},"onToolCallFinish",[1287,1298,1299,1300,1302,1303,1302,1305,1307,1308,1311],{},"Per-tool ",[402,1301,967],{},", ",[402,1304,984],{},[402,1306,998],{},", and ",[402,1309,1310],{},"error"," (if failed)",[1269,1313,1314,1319,1328],{},[1287,1315,1316],{},[402,1317,1318],{},"ai.totalDurationMs",[1287,1320,1321,1324,1325],{},[402,1322,1323],{},"onStart"," → ",[402,1326,1327],{},"onFinish",[1287,1329,1330],{},"Total wall time from generation start to completion",[399,1332,1333],{},"The middleware captures tokens, model info, and streaming metrics. The integration captures tool execution timing. Together, they give you complete AI observability.",[415,1335,1337],{"id":1336},"composability","Composability",[399,1339,1340,1343,1344,618],{},[402,1341,1342],{},"ai.wrap()"," works with models that are already wrapped by other tools. If you use supermemory, guardrails middleware, or any other model wrapper, pass the wrapped model to ",[402,1345,1342],{},[431,1347,1349],{"className":433,"code":1348,"filename":1141,"language":436,"meta":437,"style":437},"import { createAILogger } from 'evlog\u002Fai'\nimport { withSupermemory } from '@supermemory\u002Ftools\u002Fai-sdk'\nimport { createGateway } from 'ai'\n\nconst gateway = createGateway({ ... })\nconst ai = createAILogger(log)\nconst base = gateway('anthropic\u002Fclaude-sonnet-4.6')\nconst model = ai.wrap(withSupermemory(base, 'your-org-id', { mode: 'full' }))\n",[402,1350,1351,1369,1389,1408,1412,1435,1448,1470],{"__ignoreMap":437},[441,1352,1353,1355,1357,1359,1361,1363,1365,1367],{"class":443,"line":444},[441,1354,448],{"class":447},[441,1356,452],{"class":451},[441,1358,482],{"class":455},[441,1360,459],{"class":451},[441,1362,462],{"class":447},[441,1364,465],{"class":451},[441,1366,497],{"class":468},[441,1368,472],{"class":451},[441,1370,1371,1373,1375,1378,1380,1382,1384,1387],{"class":443,"line":475},[441,1372,448],{"class":447},[441,1374,452],{"class":451},[441,1376,1377],{"class":455}," withSupermemory",[441,1379,459],{"class":451},[441,1381,462],{"class":447},[441,1383,465],{"class":451},[441,1385,1386],{"class":468},"@supermemory\u002Ftools\u002Fai-sdk",[441,1388,472],{"class":451},[441,1390,1391,1393,1395,1398,1400,1402,1404,1406],{"class":443,"line":502},[441,1392,448],{"class":447},[441,1394,452],{"class":451},[441,1396,1397],{"class":455}," createGateway",[441,1399,459],{"class":451},[441,1401,462],{"class":447},[441,1403,465],{"class":451},[441,1405,469],{"class":468},[441,1407,472],{"class":451},[441,1409,1410],{"class":443,"line":509},[441,1411,506],{"emptyLinePlaceholder":505},[441,1413,1414,1416,1419,1421,1423,1425,1428,1431,1433],{"class":443,"line":545},[441,1415,1170],{"class":525},[441,1417,1418],{"class":455}," gateway ",[441,1420,1176],{"class":451},[441,1422,1397],{"class":518},[441,1424,522],{"class":455},[441,1426,1427],{"class":451},"{",[441,1429,1430],{"class":451}," ...",[441,1432,459],{"class":451},[441,1434,565],{"class":455},[441,1436,1437,1439,1442,1444,1446],{"class":443,"line":568},[441,1438,1170],{"class":525},[441,1440,1441],{"class":455}," ai ",[441,1443,1176],{"class":451},[441,1445,482],{"class":518},[441,1447,1181],{"class":455},[441,1449,1450,1452,1455,1457,1460,1462,1464,1466,1468],{"class":443,"line":587},[441,1451,1170],{"class":525},[441,1453,1454],{"class":455}," base ",[441,1456,1176],{"class":451},[441,1458,1459],{"class":518}," gateway",[441,1461,522],{"class":455},[441,1463,631],{"class":451},[441,1465,634],{"class":468},[441,1467,631],{"class":451},[441,1469,565],{"class":455},[441,1471,1472,1474,1477,1479,1481,1483,1485,1487,1490,1493,1495,1497,1500,1502,1504,1506,1509,1511,1513,1516,1518,1520],{"class":443,"line":592},[441,1473,1170],{"class":525},[441,1475,1476],{"class":455}," model ",[441,1478,1176],{"class":451},[441,1480,573],{"class":455},[441,1482,623],{"class":451},[441,1484,626],{"class":518},[441,1486,522],{"class":455},[441,1488,1489],{"class":518},"withSupermemory",[441,1491,1492],{"class":455},"(base",[441,1494,485],{"class":451},[441,1496,465],{"class":451},[441,1498,1499],{"class":468},"your-org-id",[441,1501,631],{"class":451},[441,1503,485],{"class":451},[441,1505,452],{"class":451},[441,1507,1508],{"class":560}," mode",[441,1510,618],{"class":451},[441,1512,465],{"class":451},[441,1514,1515],{"class":468},"full",[441,1517,631],{"class":451},[441,1519,459],{"class":451},[441,1521,1522],{"class":455},"))\n",[399,1524,1525,1526,1529,1530,618],{},"For explicit middleware composition, use ",[402,1527,1528],{},"createAIMiddleware"," to get the raw middleware and compose it yourself via ",[402,1531,1532],{},"wrapLanguageModel",[431,1534,1536],{"className":433,"code":1535,"filename":1141,"language":436,"meta":437,"style":437},"import { createAIMiddleware } from 'evlog\u002Fai'\nimport { wrapLanguageModel } from 'ai'\n\nconst model = wrapLanguageModel({\n  model: base,\n  middleware: [createAIMiddleware(log, { toolInputs: true }), otherMiddleware],\n})\n",[402,1537,1538,1557,1576,1580,1594,1605,1641],{"__ignoreMap":437},[441,1539,1540,1542,1544,1547,1549,1551,1553,1555],{"class":443,"line":444},[441,1541,448],{"class":447},[441,1543,452],{"class":451},[441,1545,1546],{"class":455}," createAIMiddleware",[441,1548,459],{"class":451},[441,1550,462],{"class":447},[441,1552,465],{"class":451},[441,1554,497],{"class":468},[441,1556,472],{"class":451},[441,1558,1559,1561,1563,1566,1568,1570,1572,1574],{"class":443,"line":475},[441,1560,448],{"class":447},[441,1562,452],{"class":451},[441,1564,1565],{"class":455}," wrapLanguageModel",[441,1567,459],{"class":451},[441,1569,462],{"class":447},[441,1571,465],{"class":451},[441,1573,469],{"class":468},[441,1575,472],{"class":451},[441,1577,1578],{"class":443,"line":502},[441,1579,506],{"emptyLinePlaceholder":505},[441,1581,1582,1584,1586,1588,1590,1592],{"class":443,"line":509},[441,1583,1170],{"class":525},[441,1585,1476],{"class":455},[441,1587,1176],{"class":451},[441,1589,1565],{"class":518},[441,1591,522],{"class":455},[441,1593,609],{"class":451},[441,1595,1596,1598,1600,1603],{"class":443,"line":545},[441,1597,1207],{"class":560},[441,1599,618],{"class":451},[441,1601,1602],{"class":455}," base",[441,1604,641],{"class":451},[441,1606,1607,1610,1612,1614,1616,1619,1621,1623,1626,1628,1630,1632,1634,1636,1639],{"class":443,"line":568},[441,1608,1609],{"class":560},"  middleware",[441,1611,618],{"class":451},[441,1613,697],{"class":455},[441,1615,1528],{"class":518},[441,1617,1618],{"class":455},"(log",[441,1620,485],{"class":451},[441,1622,452],{"class":451},[441,1624,1625],{"class":560}," toolInputs",[441,1627,618],{"class":451},[441,1629,684],{"class":683},[441,1631,459],{"class":451},[441,1633,536],{"class":455},[441,1635,485],{"class":451},[441,1637,1638],{"class":455}," otherMiddleware]",[441,1640,641],{"class":451},[441,1642,1643,1645],{"class":443,"line":587},[441,1644,757],{"class":451},[441,1646,565],{"class":455},[399,1648,1649,1651,1652,1654,1655,1657,1658,1661,1662,1664,1665,1667],{},[402,1650,1528],{}," returns the same middleware that ",[402,1653,404],{}," uses internally. The difference: ",[402,1656,1528],{}," does not include ",[402,1659,1660],{},"captureEmbed"," (embedding models don't use middleware). Use ",[402,1663,404],{}," for the full API, ",[402,1666,1528],{}," when you need explicit middleware ordering.",[1669,1670,1671],"style",{},"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 .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}html pre.shiki code .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}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 .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 .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}html pre.shiki code .sbssI, html code.shiki .sbssI{--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C}",{"title":437,"searchDepth":475,"depth":475,"links":1673},[1674,1675,1676,1677],{"id":417,"depth":475,"text":418},{"id":1133,"depth":475,"text":1134},{"id":1260,"depth":475,"text":1261},{"id":1336,"depth":475,"text":1337},"Add tool execution timing and total wall time with createEvlogIntegration. Compose with other middleware like supermemory or guardrails.","md",[1681,1684],{"label":41,"icon":44,"to":77,"color":1682,"variant":1683},"neutral","subtle",{"label":1685,"icon":83,"to":81,"color":1682,"variant":1683},"Usage Patterns",{},{"title":95,"icon":98},{"title":394,"description":1678},"WhbBRzREyxKmgO14d6e8TZxaYaYlecS7spxQ6m5kUtw",[1691,1693],{"title":90,"path":91,"stem":92,"description":1692,"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.",{"title":41,"path":106,"stem":107,"description":1694,"icon":44,"children":-1},"Automatically identify users on every request. Every wide event includes who made the request — userId, user profile, and session metadata — with zero manual work.",1778106400832]