Use the runtime trace builder when you want visibility beyond what the proxy can infer from provider traffic alone.Documentation Index
Fetch the complete documentation index at: https://whyops.com/docs/llms.txt
Use this file to discover all available pages before exploring further.
Quickstart
Start with installation, agent initialization, and your first proxied OpenAI or Anthropic call.
Proxy Helpers
Review the proxy key flow before adding runtime events on top of proxied traffic.
Advanced Patterns
Move there after this page for hybrid flows, self-hosting, and common mistakes.
Minimal trace
Use the exact sametraceId here that you pass in X-Trace-ID on proxied OpenAI or Anthropic calls when you want tool events and model events to stay on the same thread.
- Prompt + response
- Thinking block
Linking events to users
UseexternalUserId to associate events with your application’s user IDs:
externalUserId is stored on every event and trace, allowing you to filter and analyze traces by your own user identifiers.
Tool spans
- Request + response pair
- Tool result returned to model
toolCallRequest() returns a spanId. Reuse that same value in toolCallResponse() so the UI can treat the execution as a single tool span.Prompt caching usage
cacheReadTokens for tokens served from cache and cacheCreationTokens for tokens written into cache when your runtime exposes those values.
Event map
| Method | Purpose | Key options |
|---|---|---|
userMessage() | Log assembled chat input | metadata.systemPrompt, metadata.tools, spanId, stepId, externalUserId |
llmResponse() | Log model output or tool calls | toolCalls, finishReason, usage, latencyMs |
llmThinking() | Log exposed thinking blocks | signature |
embeddingRequest() | Log embedding inputs | spanId, stepId |
embeddingResponse() | Log embedding result summary | totalTokens, latencyMs |
toolCallRequest() | Start a tool call span | requestedAt, latencyMs; returns spanId |
toolCallResponse() | Close the tool call span | respondedAt, latencyMs |
toolResult() | Record tool output returned to the model | spanId, stepId |
error() | Record runtime or provider failures | status, stack |
externalUserId as an optional parameter to link the event to your application user.