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
All methods accept
externalUserId as an optional parameter to link the event to your application user.