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.
Manual events mode
Use the exact sametrace_id 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.
- Sync
- Async
Linking events to users
Useexternal_user_id to associate events with your application user IDs:
external_user_id is stored on every event and trace, allowing you to filter and analyze traces by your own user identifiers.
Prompt caching usage
cacheReadTokens and cacheCreationTokens when your runtime exposes cache-aware usage so the trace cost breakdown stays accurate.
Method map
| Sync method | Async method | Purpose |
|---|---|---|
user_message_sync() | user_message() | Log assembled user or system-facing messages |
llm_response_sync() | llm_response() | Log model output, finish reason, usage, and latency |
llm_thinking_sync() | llm_thinking() | Log explicit reasoning blocks |
embedding_request_sync() | embedding_request() | Log embedding inputs |
embedding_response_sync() | embedding_response() | Log embedding result summary |
tool_call_request_sync() | tool_call_request() | Start a tool call span and return span_id |
tool_call_response_sync() | tool_call_response() | Close the tool call span |
tool_result_sync() | tool_result() | Record tool output returned to the model |
error_sync() | error() | Record runtime or provider failures |