create and parse on both chat.completions and responses. parse is the structured-output helper, and it posts on its own rather than going through create, so it needs wrapping in its own right.
Install
Capture Responses API calls
Capture Chat Completions calls
OpenAI and async AsyncOpenAI clients work. Each completed call logs its input, text output, model name, latency, and any token counts OpenAI returns to the support-bot task.
It cannot break your app
The capture path is fail-open by contract. If the Apprentice backend is slow, down, or unreachable, your OpenAI call still returns unchanged. The only loss is that one trace. OpenAI errors still reach your code unchanged. Captured traces arrive as raw rows: live, unverified. Verify them to gold, or upload curated rows as silver, before you rely on them for optimization.Streaming passes through uncaptured
Calls withstream=True return an iterator that Apprentice must not consume. They pass through uncaptured and unchanged. The OpenAI SDK’s responses.stream(...) and chat.completions.stream(...) helpers are left untouched and uncaptured for the same reason.
Redact before anything leaves your process
If your inputs contain sensitive data, pass aredact function. It runs in your process, before the trace is sent: