Skip to content

Commit e0cf5f8

Browse files
HugoRCDopen-agents-bot[bot]
andcommitted
docs: add cost estimation and tool timing features to AI SDK
Co-Authored-By: open-agents-bot[bot] <260704009+open-agents-bot[bot]@users.noreply.github.com>
1 parent 0d31647 commit e0cf5f8

4 files changed

Lines changed: 29 additions & 6 deletions

File tree

.vercel/project.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"orgId": "team_X7ikPPn4YpZ4APwufE36i53l",
3+
"projectId": "prj_GO3fYDyQKzkoreOaBBgTIBRZVvt0",
4+
"projectName": "evlog-docs"
5+
}

apps/docs/app/components/features/FeatureAiSdk.vue

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ const pills = [
1717
{ label: 'Token tracking', icon: 'i-lucide-coins' },
1818
{ label: 'Tool calls', icon: 'i-lucide-wrench' },
1919
{ label: 'Streaming metrics', icon: 'i-lucide-gauge' },
20+
{ label: 'Cost estimation', icon: 'i-lucide-dollar-sign' },
21+
{ label: 'Tool timing', icon: 'i-lucide-timer' },
2022
]
2123
2224
const benefits = [
@@ -28,12 +30,17 @@ const benefits = [
2830
{
2931
icon: 'i-lucide-box',
3032
title: 'Works with everything',
31-
text: 'generateText, streamText, ToolLoopAgent, generateObject.',
33+
text: 'generateText, streamText, ToolLoopAgent, embed, multi-step agents.',
3234
},
3335
{
3436
icon: 'i-lucide-bar-chart-3',
3537
title: 'Cost and performance',
36-
text: 'Token usage, cache hits, time to first chunk, tokens per second.',
38+
text: 'Token usage, cache hits, cost estimation, time to first chunk, tokens per second.',
39+
},
40+
{
41+
icon: 'i-lucide-timer',
42+
title: 'Telemetry integration',
43+
text: 'Per-tool execution timing, success/failure tracking, and total generation wall time.',
3744
},
3845
]
3946
@@ -175,11 +182,17 @@ function setView(view: 'without' | 'with') {
175182

176183
<div class="px-5 pt-4 pb-3 font-mono text-xs sm:text-sm leading-relaxed overflow-x-auto border-b border-muted/50">
177184
<!-- eslint-disable vue/multiline-html-element-content-newline -->
178-
<pre><code><span class="text-violet-400">const</span> ai = <span class="text-amber-400">createAILogger</span>(log)
185+
<pre><code><span class="text-violet-400">const</span> ai = <span class="text-amber-400">createAILogger</span>(log, {
186+
<span class="text-sky-400">cost</span>: { <span class="text-emerald-400">'claude-sonnet-4.6'</span>: { <span class="text-sky-400">input</span>: <span class="text-pink-400">3</span>, <span class="text-sky-400">output</span>: <span class="text-pink-400">15</span> } },
187+
})
179188

180189
<span class="text-violet-400">const</span> result = <span class="text-amber-400">streamText</span>({
181190
<span class="text-sky-400">model</span>: ai.<span class="text-amber-400">wrap</span>(<span class="text-emerald-400">'anthropic/claude-sonnet-4.6'</span>),
182191
messages,
192+
<span class="text-sky-400">experimental_telemetry</span>: {
193+
<span class="text-sky-400">isEnabled</span>: <span class="text-violet-400">true</span>,
194+
<span class="text-sky-400">integrations</span>: [<span class="text-amber-400">createEvlogIntegration</span>(ai)],
195+
},
183196
})</code></pre>
184197
<!-- eslint-enable -->
185198
</div>
@@ -248,8 +261,12 @@ function setView(view: 'without' | 'with') {
248261
<span class="text-amber-400"> ["searchWeb", "queryDB"]</span>
249262
</div>
250263
<div>
251-
<span class="text-sky-400">ai.steps</span><span class="text-dimmed">:</span>
252-
<span class="text-pink-400"> 3</span>
264+
<span class="text-sky-400">ai.tools</span><span class="text-dimmed">:</span>
265+
<span class="text-amber-400"> [{name: "searchWeb", durationMs: 150, ...}]</span>
266+
</div>
267+
<div>
268+
<span class="text-sky-400">ai.estimatedCost</span><span class="text-dimmed">:</span>
269+
<span class="text-emerald-400"> 0.022</span>
253270
</div>
254271
<div>
255272
<span class="text-sky-400">ai.msToFirstChunk</span><span class="text-dimmed">:</span>

apps/docs/content/0.landing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ Wide events and structured errors for TypeScript. One log per request, full cont
101101
Make AI calls :br observable
102102

103103
#description
104-
Your AI endpoints are black boxes. You don't know how many tokens each request burns, which tools the model called, or how fast the stream was. Wrap your model with one line and every call is captured into the wide event. Cost tracking, tool visibility, streaming performance, cache hits, reasoning tokens.
104+
Your AI endpoints are black boxes. You don't know how many tokens each request burns, which tools the model called, or how fast the stream was. Wrap your model with one line and every call is captured into the wide event. Cost estimation, tool execution timing, streaming performance, cache hits, reasoning tokens, and multi-step agent breakdowns.
105105
:::
106106

107107
:::features-feature-performance

bun.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)