10 Commits

Author SHA1 Message Date
green3sf 629f9b56a5 fix(core): detach aggregated request usage entries (#4519) 2026-08-19 22:55:32 +09:00
Kazuhiro Sera 05d6850da5 feat: add scripted model test utilities (#4362) 2026-08-13 11:20:33 +09:00
Kazuhiro Sera 0c60a196af feat(models): preserve raw usage payloads (#4279) 2026-08-07 19:24:39 +09:00
Kazuhiro Sera 8724b1b9ba fix: support cache-write usage across OpenAI Python versions (#3773) 2026-07-10 07:14:43 +09:00
Aditya Singh ec5523d620 fix: preserve existing request_usage_entries on Usage.add (#3213) 2026-05-09 02:07:20 +09:00
Kazuhiro Sera 78a683ca80 Add regression tests as prep for HITL changes (#2267) 2026-01-07 18:18:49 +09:00
Adrian Cole 509ddda778 fix(usage): Normalize None token detail objects on Usage initialization (#2141) 2025-12-03 13:28:50 +09:00
Adrian Cole 15ad038ffb fix(usage): Normalize None token details on Usage initialization (#2034) 2025-11-05 11:12:54 +09:00
Hassan Abu Alhaj 3b9368db56 feat: #1994 Add a list of per-request usage data to Usage (#1995)
Co-authored-by: Kazuhiro Sera <seratch@openai.com>
2025-10-31 12:21:23 +09:00
WJPBProjects 466b44df18 Dev/add usage details to Usage class (#726)
PR to enhance the `Usage` object and related logic, to support more
granular token accounting, matching the details available in the [OpenAI
Responses API](https://platform.openai.com/docs/api-reference/responses)
. Specifically, it:

- Adds `input_tokens_details` and `output_tokens_details` fields to the
`Usage` dataclass, storing detailed token breakdowns (e.g.,
`cached_tokens`, `reasoning_tokens`).
- Flows this change through
- Updates and extends tests to match
- Adds a test for the Usage.add method

### Motivation
- Aligns the SDK’s usage with the latest OpenAI responses API Usage
object
- Supports downstream use cases that require fine-grained token usage
data (e.g., billing, analytics, optimization) requested by startups

---------

Co-authored-by: Wulfie Bain <wulfie@openai.com>
2025-05-20 18:23:56 +01:00