Collecting Anthropic Server Logs with an Undocumented API
David Manouchehri -
If you read our previous post on collecting Vertex AI logs, a great question would be: is Claude 3.5 Sonnet on Vertex AI more or less reliable than Anthropic's API in our production stack?
Unfortunately, Anthropic does not (yet) expose a documented API for us to use. But we can use an undocumented one in the meantime!
First, you'll need to collect and save the logs. You can download the logs (...individually) by visiting the URL below. This is the part that sucks.
You'll need to replace YOUR_ANTHROPIC_ORGANIZATION_ID_HERE with your organization ID from Anthropic, which you can find here.
Next, increment page_index a few times to save however many recent logs you'd like to analyze. While it would be nice to script this up, Anthropic has some anti-bot WAF in front of this endpoint, and I found it frustrating to deal with.
Once we have all the files saved in a folder called logs/, let's create a script to combine them all together, along with deduplication!
Awesome, we now have a file called combined_logs.json we can analyze! If we want to look at all the requests that had an error for Claude 3.5 Sonnet, we can run the command below.
Neat! This log isn't an entirely fair comparison to Vertex AI, since we were using the new Batches API right as the beta began, so errors here should be expected. In our look at the past ~5,000 log entries, we surprisingly have no other errors!
If we want to do something like sort by latency, that's totally doable too.
Or, to make a better comparison, let's sort requests for small prompts.
We see our slowest request at the bottom of the list.