AnthropicLLMTracingAdapter
Tracing adapter for Anthropic Claude API.
Parses Anthropic Messages API requests and responses to extract telemetry data including model parameters, messages, tool definitions, tool calls, usage statistics, and media content. Supports both text and multimodal inputs (images, documents).
Example Usage
val client = instrument(HttpClient(), AnthropicLLMTracingAdapter())
client.post("https://api.anthropic.com/v1/messages") {
header("x-api-key", apiKey)
header("anthropic-version", "2023-06-01")
setBody("""
{
"max_tokens": 1024,
"messages": [{"content": "Hello!", "role": "user"}],
"model": "claude-3-7-sonnet-latest"
}
""")
}
// Automatically traces request/response with tool calls and media contentContent copied to clipboard