Hi, I wrote a blog post with a reusable Python snippet that logs every OpenAI API request and response in JSON, including API errors.
You might find it interesting ![]()
tl;dr: I like the OpenAI dashboard Logs, but API errors are missing. Sometimes Iād really like to have the request along with the error. I show here how to wire httpx event_hooks into OpenAI to log every request and response in JSON format.