feat(gateway): add verbosity param for gpt-5.6 models - #2978
Conversation
Support OpenAI's verbosity parameter (low/medium/high) end to end: - accept top-level verbosity in /v1/chat/completions and text.verbosity in /v1/responses - validate against a new verbosity capability flag on provider mappings (400 for unsupported models) - forward as text.verbosity on the Responses API and top-level verbosity on Chat Completions; strip it when auto routing or retry fallback lands on a mapping without support - enable the flag on the gpt-5.6-sol/terra/luna OpenAI mappings Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (11)
WalkthroughThe gateway accepts an optional ChangesVerbosity support
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant Client
participant ResponsesAPI
participant ChatCompletions
participant CapabilityValidator
participant RequestPreparer
participant OpenAI
Client->>ResponsesAPI: send text.verbosity
ResponsesAPI->>ChatCompletions: set chatRequest.verbosity
ChatCompletions->>CapabilityValidator: validate model capability
CapabilityValidator-->>ChatCompletions: accept or HTTP 400
ChatCompletions->>RequestPreparer: prepare verbosity request
RequestPreparer->>OpenAI: send supported verbosity payload
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Adds support for OpenAI's new
verbosityparameter (low/medium/high) for the GPT-5.6 model family (gpt-5.6-sol,gpt-5.6-terra,gpt-5.6-luna), controlling how detailed model responses are.Changes
verbosityon/v1/chat/completionsandtext.verbosityon/v1/responses(mirroring OpenAI's shapes for each API).verbosity?: booleanflag on provider mappings;validateModelCapabilitiesreturns a 400 whenverbosityis sent to a model without support (skipped forauto/custom, matchingreasoning_effortbehavior).prepareRequestBody): sent astext.verbosityon the Responses API (merged withtext.formatwhenresponse_formatis also set) and as top-levelverbosityon Chat Completions. Stripped when auto routing or retry fallback lands on a mapping without support, so an unknown param is never forwarded upstream.verbosity: true+"verbosity"insupportedParameterson all three gpt-5.6 OpenAI mappings.Testing
response_format, stripping for unsupported models, and capability validation (139 tests pass across the two touched spec files; fullpnpm test:unithas one pre-existing, unrelated google-vertex routing failure that also fails on a clean tree).TEST_MODELS="openai/gpt-5.6-luna" pnpm test:e2e— 85 passed.verbosity: "low"vs"high"on the same prompt produced 299 vs 20,069 chars of output, confirming upstream honors the forwarded value.gpt-4o+verbosity→ clean 400 with actionable message./v1/responseswithtext.verbosity→ works.pnpm formatand fullpnpm buildpass.🤖 Generated with Claude Code
Summary by CodeRabbit