---
title: "AI"
description: "Trace AI workloads across Better Agent, Vercel AI SDK, OpenAI, Anthropic, OpenRouter-compatible clients, and low-level fetch transport calls."
canonical_url: "https://www.blyp.dev/docs/ai"
markdown_url: "https://www.blyp.dev/docs/ai.md"
last_updated: "2018-10-20"
x_farming_labs_generated_preamble: true
---

# AI
URL: /docs/ai
LLM index: /llms.txt
Description: Trace AI workloads across Better Agent, Vercel AI SDK, OpenAI, Anthropic, OpenRouter-compatible clients, and low-level fetch transport calls.

# AI

Blyp can emit structured `ai_trace` records for AI workloads without forcing you into one SDK.

Supported entrypoints:

- `@blyp/core/ai/better-agent` for Better Agent app-level plugins and manual run trackers
- `@blyp/core/ai/vercel` for Vercel AI SDK middleware and model wrappers
- `@blyp/core/ai/openai` for direct OpenAI SDK instrumentation
- `@blyp/core/ai/anthropic` for direct Anthropic SDK instrumentation
- `@blyp/core/ai/fetch` for low-level transport tracing around `fetch`

## What gets emitted

Each traced AI call produces one normalized `ai_trace` record with:

- `provider`
- `model`
- `operation`
- token usage when the provider returns it
- `finishReason`
- timing data
- `msToFirstChunk` for streamed responses
- best-effort tool-call records and trace events

The goal is to make AI calls queryable with the same Blyp primitives used for request logs, structured logs, connectors, and database records.

## Request-scoped correlation

When an active request-scoped logger exists, AI traces inherit it automatically. That means the same request can carry:

- the server request log
- AI trace records
- structured logs
- connector-forwarded logs
- database-persisted rows

See [Request Tracing](/docs/working-with-blyp/request-tracing) for the `x-blyp-trace-id` lifecycle and how browser logs join the same trace.

## Covered SDK paths

| Entry | Covered calls |
| --- | --- |
| `@blyp/core/ai/better-agent` | Better Agent run-level tracing through app plugins or manual tracker wiring |
| `@blyp/core/ai/vercel` | Vercel AI SDK `generateText()` and `streamText()` |
| `@blyp/core/ai/openai` | OpenAI `responses.create()` and `chat.completions.create()` |
| `@blyp/core/ai/anthropic` | Anthropic `messages.create()` |
| `@blyp/core/ai/fetch` | generic transport tracing for status, latency, request IDs, and optional JSON body inspection |

OpenRouter is supported through the OpenAI-compatible path by pointing the OpenAI client at the OpenRouter base URL.

## Read next

- [AI Tracing](/docs/ai/tracing)
- [Better Agent](/docs/ai/better-agent)
- [Vercel AI SDK](/docs/ai/vercel-ai-sdk)
- [OpenAI SDK](/docs/ai/openai-sdk)
- [Anthropic SDK](/docs/ai/anthropic-sdk)
- [AI Privacy & Capture](/docs/ai/privacy-and-capture)
- [Request Tracing](/docs/working-with-blyp/request-tracing)

## Sitemap

See the full [sitemap](/sitemap.md) for all pages.
Docs-scoped sitemap: [/docs/sitemap.md](/docs/sitemap.md).
Well-known sitemap: [/.well-known/sitemap.md](/.well-known/sitemap.md).
