Recorder
OpenAI API
Wrap each call. usage_from reads both Chat Completions and Responses usage, including reasoning and cached tokens.
- Copy
harness_recorder.pyinto your project. - Wrap the shared function that calls the model.
Wrap a call
with run.agent("classify", prompt_ref="prompts/classifier@3", model="openai/gpt-6-luna") as step:
resp = client.responses.create(model="gpt-6-luna", input=ticket_text)
step.model_call(**usage_from(resp))Where the log lands
Wherever your service logs go, or a folder.
How it reaches the harness
You download the logs with your own access.
When streaming, ask for usage in the final chunk (OpenAI only sends it when requested) and record it then.