Skip to content

feat(api): update usage APIs and documentation - #566

Merged
apcha-oai merged 1 commit into
mainfrom
castiron/promotions/pr-70
Sep 2, 2026
Merged

feat(api): update usage APIs and documentation#566
apcha-oai merged 1 commit into
mainfrom
castiron/promotions/pr-70

Conversation

@apcha-oai

@apcha-oai apcha-oai commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Updates organization usage filtering, Responses and Chat Completions usage types, and API documentation.

Changes

  • Add optional line_items filtering to organization cost usage requests, allowing results to be limited to exact cost line-item names
  • Remove the unlaunched compute_units field from Responses and Chat Completions usage types
  • Refresh model examples, documentation links, and reasoning-model guidance across affected API documentation

Castiron-Internal-PR: openai/openai-ruby-internal#70
Castiron-Source-SHA: ace532f27a83980dd9e69e364615e40eb3f3157c
Castiron-Public-Base-SHA: 2359a02
@apcha-oai
apcha-oai marked this pull request as ready for review September 1, 2026 21:47
@apcha-oai
apcha-oai requested a review from a team as a code owner September 1, 2026 21:47
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 1, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-01T21:49:43.430536Z 3390805 Draft marked ready
🔒 Security Review Completed 2026-09-01T21:51:12.098586Z 3390805 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Castiron custom code

✅ No new custom-code files detected.

47 mixed files remain; 0 existing customizations changed; 11 generated baselines changed.

Compared 2359a02dd22f3390805348c2. Generated baselines verified.

File Result Current custom patch
lib/openai/models/chat/completion_create_params.rb Generated baseline changed +21 / −5
lib/openai/models/responses/response.rb Generated baseline changed +20 / −0
lib/openai/models/responses/response_create_params.rb Generated baseline changed +9 / −1
lib/openai/resources/chat/completions.rb Generated baseline changed +42 / −0
lib/openai/resources/responses.rb Generated baseline changed +164 / −3
rbi/openai/models/chat/completion_create_params.rbi Generated baseline changed +79 / −41
rbi/openai/models/responses/response.rbi Generated baseline changed +5 / −0
rbi/openai/models/responses/response_create_params.rbi Generated baseline changed +10 / −1
rbi/openai/resources/chat/completions.rbi Generated baseline changed +26 / −17
rbi/openai/resources/responses.rbi Generated baseline changed +274 / −16
sig/openai/models/responses/response.rbs Generated baseline changed +2 / −0
36 existing customizations unchanged
  • lib/openai.rb
  • lib/openai/client.rb
  • lib/openai/models/chat/chat_completion_message.rb
  • lib/openai/models/chat/chat_completion_message_function_tool_call.rb
  • lib/openai/models/response_format_json_schema.rb
  • lib/openai/models/responses/function_tool.rb
  • lib/openai/models/responses/response_format_text_config.rb
  • lib/openai/models/responses/response_format_text_json_schema_config.rb
  • lib/openai/models/responses/response_function_tool_call.rb
  • lib/openai/models/responses/response_function_web_search.rb
  • lib/openai/models/responses/response_output_text.rb
  • lib/openai/models/responses/tool.rb
  • lib/openai/resources/beta/threads.rb
  • lib/openai/resources/files.rb
  • lib/openai/resources/vector_stores/file_batches.rb
  • lib/openai/resources/vector_stores/files.rb
  • lib/openai/resources/webhooks.rb
  • rbi/openai/client.rbi
  • rbi/openai/models/chat/chat_completion_message.rbi
  • rbi/openai/models/chat/chat_completion_message_function_tool_call.rbi
  • rbi/openai/models/response_format_json_schema.rbi
  • rbi/openai/models/responses/response_function_tool_call.rbi
  • rbi/openai/models/responses/response_function_web_search.rbi
  • rbi/openai/models/responses/response_output_text.rbi
  • rbi/openai/resources/files.rbi
  • rbi/openai/resources/vector_stores/file_batches.rbi
  • rbi/openai/resources/vector_stores/files.rbi
  • scripts/castiron/README.md
  • scripts/castiron/custom_code_report.py
  • scripts/castiron/test_custom_code_report.py
  • sig/openai/client.rbs
  • sig/openai/models/responses/response_function_web_search.rbs
  • sig/openai/resources/files.rbs
  • sig/openai/resources/responses.rbs
  • sig/openai/resources/vector_stores/file_batches.rbs
  • sig/openai/resources/vector_stores/files.rbs

A changed generated baseline means this report cannot reliably identify which handwritten lines changed.

Inspect the custom-code diff

Download the exact patch produced by this run (requires repository access):

gh run download 33572010913 --repo openai/openai-ruby \
  --name castiron-custom-code-33572010913-1 --dir /tmp/castiron-custom-code-33572010913-1
git apply --stat /tmp/castiron-custom-code-33572010913-1/custom-code.patch
cat /tmp/castiron-custom-code-33572010913-1/custom-code.patch

Or reproduce it from an SDK checkout containing the vendored reporter:

git fetch --no-tags origin 2359a02dd22fbf599250aaa97e755863562abf53 3390805348c2a68a3f1c821e3edf375b73a682f7
python3 scripts/castiron/custom_code_report.py report \
  --base 2359a02dd22fbf599250aaa97e755863562abf53 \
  --head 3390805348c2a68a3f1c821e3edf375b73a682f7 --fetch --require-head-hash --public \
  --out /tmp/castiron-custom-code-3390805348c2
cat /tmp/castiron-custom-code-3390805348c2/custom-code.patch

This is the current full custom patch for mixed files, not an attribution of only the handwritten lines changed by this PR.

Full report and patch

@openai-sdks

openai-sdks Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

OkTest Summary

237/237 SDK tests passed in 10.081s for Ruby SDK PR #566.

Test results — 42 files
Test Result Time
tests/chat-completions-complex-body.test.ts ✅ Passed 184ms
tests/chat-completions-create.test.ts ✅ Passed 236ms
tests/chat-completions-stream.test.ts ✅ Passed 139ms
tests/files-content-binary.test.ts ✅ Passed 351ms
tests/files-create-multipart.test.ts ✅ Passed 199ms
tests/files-list-pagination.test.ts ✅ Passed 192ms
tests/initialize-config.test.ts ✅ Passed 184ms
tests/instance-isolation.test.ts ✅ Passed 259ms
tests/models-list.test.ts ✅ Passed 177ms
tests/responses-background-lifecycle.test.ts ✅ Passed 231ms
tests/responses-body-method-errors.test.ts ✅ Passed 413ms
tests/responses-cancel-timeout.test.ts ✅ Passed 257ms
tests/responses-cancel.test.ts ✅ Passed 277ms
tests/responses-compact-retries.test.ts ✅ Passed 240ms
tests/responses-compact.test.ts ✅ Passed 268ms
tests/responses-create-advanced-stream.test.ts ✅ Passed 148ms
tests/responses-create-advanced.test.ts ✅ Passed 226ms
tests/responses-create-disconnect.test.ts ✅ Passed 1.007s
tests/responses-create-errors.test.ts ✅ Passed 261ms
tests/responses-create-malformed-api-responses.test.ts ✅ Passed 198ms
tests/responses-create-retries.test.ts ✅ Passed 296ms
tests/responses-create-stream-failures.test.ts ✅ Passed 182ms
tests/responses-create-stream-timeout.test.ts ✅ Passed 218ms
tests/responses-create-stream-wire.test.ts ✅ Passed 2.344s
tests/responses-create-stream.test.ts ✅ Passed 103ms
tests/responses-create-terminal-states.test.ts ✅ Passed 312ms
tests/responses-create-timeout.test.ts ✅ Passed 256ms
tests/responses-create.test.ts ✅ Passed 311ms
tests/responses-delete.test.ts ✅ Passed 305ms
tests/responses-input-items-errors.test.ts ✅ Passed 199ms
tests/responses-input-items-list.test.ts ✅ Passed 189ms
tests/responses-input-items-options.test.ts ✅ Passed 257ms
tests/responses-input-tokens-count-timeout.test.ts ✅ Passed 286ms
tests/responses-input-tokens-count.test.ts ✅ Passed 286ms
tests/responses-malformed-inputs.test.ts ✅ Passed 2.059s
tests/responses-not-found-errors.test.ts ✅ Passed 344ms
tests/responses-parse.test.ts ✅ Passed 217ms
tests/responses-retrieve-retries.test.ts ✅ Passed 282ms
tests/responses-retrieve.test.ts ✅ Passed 236ms
tests/responses-stored-method-errors.test.ts ✅ Passed 770ms
tests/retry-behavior.test.ts ✅ Passed 2.971s
tests/sdk-error-shape.test.ts ✅ Passed 373ms

View OkTest run #33562991613

SDK merge (7e0edfda11a4) · head (3390805348c2) · base (2359a02dd22f) · OkTest (2b1bdfd25e98)

@jbeckwith-oai jbeckwith-oai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blocking scope issue: the stated outcome is limited to removing the unlaunched compute_units usage fields, but this exact diff also promotes unrelated schema and public-surface changes—for example, a new organization-cost line_items filter, a new max_messages incomplete-reason value, and broad model/example/documentation updates. Those changes are not narrowly necessary for the field removal and make the patch carry behavior/API surface that the PR does not describe. Please regenerate from a baseline/config containing only the compute_units removal, or split and explicitly document/approve the broader promotion. I understand the compatibility/breaking-change checks triggered by the intentional field removal; that expected break is not this finding.

@apcha-oai apcha-oai changed the title fix(api): remove compute units from usage types feat(api): update usage APIs and documentation Sep 1, 2026

@jbeckwith-oai jbeckwith-oai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for broadening the description. One public-surface change is still missing from the stated scope: this diff adds max_messages to the Responses/Beta Responses incomplete-reason enum/type in addition to the usage and documentation changes. That is a generated public API change, not merely a documentation refresh. Please explicitly include it in the description (or remove it) so the reviewed scope matches the exact diff.

@HAYDEN-OAI HAYDEN-OAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the complete diff at 3390805348c2, including the intentional removal of the unlaunched compute_units field, optional organization-cost line_items filtering, stable/beta max_messages reason support, and schema/documentation updates. Checked Ruby/RBI/RBS parity, unknown response-field retention, filter omission/query encoding, admin authentication, and stable/beta reason handling.

No substantive issues found. Static source review only.

@apcha-oai
apcha-oai enabled auto-merge September 2, 2026 01:15
@apcha-oai
apcha-oai disabled auto-merge September 2, 2026 01:15
@apcha-oai
apcha-oai merged commit caac1f0 into main Sep 2, 2026
23 checks passed
@apcha-oai
apcha-oai deleted the castiron/promotions/pr-70 branch September 2, 2026 01:15
@openai-sdks openai-sdks Bot mentioned this pull request Sep 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants