SIGN IN SIGN UP

fix(api): prioritize routing fields in parse helpers (#4016)

## Summary

Ensure structured-output request helpers place `model`, `stream`, and
`service_tier` before potentially large `input` or `messages` fields.

## Changes

- Apply routing-field priority to sync and async `Responses.parse`
requests.
- Apply the same priority to sync and async `chat.completions.parse`
requests.
- Preserve signatures, values, remaining field order, and omitted-field
behavior.

## Test plan

- `uv run --frozen --all-extras pytest
tests/test_request_body_routing_order.py -q`
- `uv run --frozen --all-extras ruff check
src/openai/resources/responses/responses.py
src/openai/resources/chat/completions/completions.py
tests/test_request_body_routing_order.py`
- `uv run --frozen --all-extras ruff format --check
src/openai/resources/responses/responses.py
src/openai/resources/chat/completions/completions.py
tests/test_request_body_routing_order.py`
- `git diff --check`
J
Justin Beckwith committed
ba53a1021b203750653bbbff938b8cd373f990f2
Parent: ffcc4c4
Committed by GitHub <noreply@github.com> on 10/2/2026, 4:48:31 AM