feat(provider): add service_tier processing-tier control for openai endpoints - #2530
Merged
Merged
Conversation
topcheer
commented
Sep 18, 2026
topcheer
left a comment
Owner
Author
There was a problem hiding this comment.
复审通过 ✅(四重点核销)
① 显式 6 值 case 表+未知忽略(typo 不翻转昂贵档,三 setter 家族形态一致)。② 与 #2528 无耦合——tier 重试 req 级内层/callPolicy 外层正交;与 effort 重试串联(双 drop 最多 3 次请求上界合理)。③ Fallback 链式广播同 verbosity 形态。④ CloneWithModel 值继承(端点属性语义)。retryWithoutServiceTier Param 精确→消息兜底两态。
CI 绿。可合并。
Owner
Author
|
复审已过(见 review:①显式 6 值 case 防翻转+未知忽略(typo 无声面=effort/verbosity 家族既有取舍一致)②与 #2528 正交——tier 重试 req 级内层/callPolicy 外层,rebase 时接口注册顺序无耦合(不同 setter 名)③fast 拒收走 retryWithoutServiceTier 统一降级(Param/消息两态判别覆盖老网关)④fallback 广播+Clone 值继承 ⑤scale 透传由 OpenAI 域判定(未知 tier 服务端拒→降级路径兜底))。与 main 冲突——#2529 等先合并动了 openai.go 相邻区。分支 sa81-service-tier 有归属者本地 worktree 在途——请归属者 rebase main 解冲突,解后 CI 绿即合并。不代解。 |
…ndpoints sa-81: support the OpenAI service_tier parameter (auto/default/flex/ priority/fast/scale) on openai and openai-responses protocols. - config: new `service_tier` endpoint field, trimmed into ResolvedEndpoint - provider: ServiceTierProvider interface; wired in registry for openai/openai-responses (allowlisted setters reject unknown values so a typo cannot silently flip an expensive production tier) - openai.go: tier rides Chat Completions + stream requests; transparent one-shot degrade-retry when a relay rejects the parameter - openai_responses.go: tier rides Responses requests with the same graceful degrade as text.verbosity - fallback: tier forwarded across fallback chains - docs: new Service Tier section in docs/guide/providers.md - tests: config resolution, wire injection, omission, degrade retry, clone-carries-tier, error classification (10 new tests) Co-Authored-By: ggcode <noreply@ggcode.dev>
topcheer
force-pushed
the
sa81-service-tier
branch
from
September 18, 2026 05:39
9af345a to
bf1cf96
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
service_tier(sa-81) support onopenaiandopenai-responsesprotocols — the OpenAI processing-tier parameter that trades cost against latency (flex= cheaper/slower,priority/fast= Fast mode, the 2026-07 rename of Priority processing). Follows the exact plumbing pattern of the existingtext_verbosity/reasoning_effortcontrols.Changes
service_tierendpoint field (service_tier:yaml key), trimmed intoResolvedEndpointalongside the other hintsServiceTierProviderinterface; registry wires it foropenai,openai-responses, and the/responsesURL-sniff pathauto | default | flex | priority | fast | scaleretryWithoutReasoningEffort)text.verbosityforEachdocs/guide/providers.mdAnthropic/Gemini/Copilot endpoints are unaffected (no interface implemented → field ignored, documented).
Tests
10 new tests, all passing:
applyServiceTier, clone-carries-tier, error classificationservice_tierin request body), omission when unset, degrade-retry against a gateway returning 400Unknown parameter: 'service_tier'Verification:
gofmtclean,go vet -tags goolmclean,go build -tags goolm ./...OK, fullinternal/provider+internal/configregression suites green, pre-commit/pre-push hooks passed.Co-Authored-By: ggcode noreply@ggcode.dev