With our SDKs, tracking Anthropic calls is super simple.
Copy
import Anthropic from "@anthropic-ai/sdk"import { monitorAnthropic } from "lunary/anthropic"// Simply call monitor() on the Anthropic class to automatically track requestsconst anthropic = monitorAnthropic(new Anthropic())
3
Tag requests and identify users
You can now tag requests and identify users.
Copy
const result = await anthropic.messages.create({ model: "claude-3-5-sonnet-20240620", temperature: 0.9, tags: ["chat", "support"], // Optional: tags userId: "user_123", // Optional: user ID userProps: { name: "John Doe" }, // Optional: user properties system: "You are an helpful assistant", messages: [ { role: "user", content: "Hello friend" }, ],})