Repository navigation
feat(api): group Completions usage and costs by completion window - #4376
markstuart-oai wants to merge 1 commit into
Conversation
Castiron-Internal-PR: openai/openai-python-internal#476 Castiron-Source-SHA: be7c319cb97f92940566230a7a09b2062cfe3d4c Castiron-Public-Base-SHA: ba6e577
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
jbeckwith-oai
left a comment
There was a problem hiding this comment.
Approved after comprehensive static review and an independent second review. The complete public-head file tree matches the reviewed internal counterpart, including file modes. Checked completion-window grouping, response models, null/omission semantics, compatibility, and pagination/wire regression coverage; no actionable findings.
SDK CI and the OkTest test job passed, but OkTest reporting failed with "missing or ambiguous prepared check; rerun all jobs". The overall OkTest check is therefore still failed.
No candidate code or tests were executed locally.
Summary
Use
group_by=["completion_window"]withusage.completions()orusage.costs()to group results by background completion window. Readrow.completion_windowto get"2h","8h","unlabeled", orNone.Compatibility
[*columns]or widen the annotation. Add"completion_window"to exhaustive checks.completion_windowas a named field. Code that indexesrow.model_extra["completion_window"]can raiseKeyError. Userow.completion_windowinstead. To distinguish an omitted field from an explicit null, check"completion_window" in row.model_fields_set.row.model_dump(exclude_unset=True)includes the field when present.