Skip to content

refactor(responses): remove compact model suffix handling - #6770

Merged
seefs001 merged 1 commit into
QuantumNous:mainfrom
seefs001:refactor/remove-openai-compact
Aug 11, 2026
Merged

refactor(responses): remove compact model suffix handling#6770
seefs001 merged 1 commit into
QuantumNous:mainfrom
seefs001:refactor/remove-openai-compact

Conversation

@seefs001

@seefs001 seefs001 commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator

⚠️ 提交说明 / PR Notice

Important

  • 请提供人工撰写的简洁摘要,避免直接粘贴未经整理的 AI 输出。

📝 变更描述 / Description

(简述:做了什么?为什么这样改能生效?请基于你对代码逻辑的理解来写,避免粘贴未经整理的内容)

移除之前由于很多供应商不支持/v1/responses/compact而为模型列表加入的特殊模型名兼容逻辑。
本PR合并后,/v1/responses/compact将直接转发给 openai/azure/newapi/sub2api/codex 上游,计费按照请求模型计费,与/v1/responses一致,之前的 openai-compact模型后缀模型成为无效模型名,不会在内部进行处理。

🚀 变更类型 / Type of change

  • 🐛 Bug 修复 (Bug fix) - 请关联对应 Issue,避免将设计取舍、理解偏差或预期不一致直接归类为 bug
  • ✨ 新功能 (New feature) - 重大特性建议先通过 Issue 沟通
  • ⚡ 性能优化 / 重构 (Refactor)
  • 📝 文档更新 (Documentation)

🔗 关联任务 / Related Issue

  • Closes # (如有)

✅ 提交前检查项 / Checklist

  • 人工确认: 我已亲自整理并撰写此描述,没有直接粘贴未经处理的 AI 输出。
  • 非重复提交: 我已搜索现有的 IssuesPRs,确认不是重复提交。
  • Bug fix 说明: 若此 PR 标记为 Bug fix,我已提交或关联对应 Issue,且不会将设计取舍、预期不一致或理解偏差直接归类为 bug。
  • 变更理解: 我已理解这些更改的工作原理及可能影响。
  • 范围聚焦: 本 PR 未包含任何与当前任务无关的代码改动。
  • 本地验证: 已在本地运行并通过测试或手动验证,维护者可以据此复核结果。
  • 安全合规: 代码中无敏感凭据,且符合项目代码规范。

📸 运行证明 / Proof of Work

(请在此粘贴截图、关键日志或测试报告,以证明变更生效)

Summary by CodeRabbit

  • New Features

    • Improved compact Responses compatibility by considering both channel and API type.
    • Added support for compact Responses validation across additional channel configurations.
  • Changes

    • Stopped automatically modifying model names for compact Responses requests.
    • Model listings now show the models provided by the upstream service, including automatic review models.
    • Model mapping and pricing now use standard model names and fallback behavior.

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

The PR makes Responses Compact support channel-aware and removes automatic compact model suffix generation. Endpoint handling, Codex model discovery, model mapping, and ratio lookups now use standard model names.

Changes

Responses Compact behavior

Layer / File(s) Summary
Channel-aware compact support
common/api_type.go, controller/channel-test.go, controller/channel_test_internal_test.go, relay/responses_handler.go
SupportsResponsesCompact now receives channel and API types. Validation and tests use both values.
Compact endpoint request flow
controller/channel-test.go, middleware/distributor.go
Endpoint detection and distribution no longer select /v1/responses/compact or append compact model suffixes.
Model discovery and mapping
relay/channel/codex/constants.go, service/codex_channel_models.go, relay/helper/model_mapped.go, setting/ratio_setting/model_ratio.go
Codex models and mapped models retain upstream names. Compact variants and wildcard ratio or price fallbacks are removed.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Suggested reviewers: calcium-ion

Poem

I’m a rabbit with a model-name chart,
Compact suffixes now depart.
Channels guide the support call,
Upstream names stay plain and tall.
Tests hop through each API lane.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: removing compact model suffix handling from Responses processing.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@common/api_type.go`:
- Line 91: Update SupportsResponsesCompact in common/api_type.go (line 91) to
return true only for explicitly supported channelType/apiType pairs, using both
parameters in the gate. Add mismatched channel/API cases expecting false in
controller/channel_test_internal_test.go (lines 105-111), while retaining the
existing valid positive cases.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f733d5f3-0407-498b-b02b-6d0e28133918

📥 Commits

Reviewing files that changed from the base of the PR and between 9c97e78 and 186add1.

📒 Files selected for processing (10)
  • common/api_type.go
  • controller/channel-test.go
  • controller/channel_test_internal_test.go
  • middleware/distributor.go
  • relay/channel/codex/constants.go
  • relay/helper/model_mapped.go
  • relay/responses_handler.go
  • service/codex_channel_models.go
  • setting/ratio_setting/compact_suffix.go
  • setting/ratio_setting/model_ratio.go
💤 Files with no reviewable changes (3)
  • middleware/distributor.go
  • setting/ratio_setting/model_ratio.go
  • setting/ratio_setting/compact_suffix.go

Comment thread common/api_type.go
}

func IsResponsesCompactAPIType(apiType int) bool {
func SupportsResponsesCompact(channelType, apiType int) bool {

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.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Enforce the channel/API pair in SupportsResponsesCompact.

channelType is unused. Any supported apiType returns true, including unsupported channel/API combinations. This makes the channel-aware compact gate ineffective.

  • common/api_type.go#L91-L91: return true only for each supported channel/API pair.
  • controller/channel_test_internal_test.go#L105-L111: add mismatched channel/API cases that expect false. The current positive cases also pass with API-type-only logic.
📍 Affects 2 files
  • common/api_type.go#L91-L91 (this comment)
  • controller/channel_test_internal_test.go#L105-L111
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@common/api_type.go` at line 91, Update SupportsResponsesCompact in
common/api_type.go (line 91) to return true only for explicitly supported
channelType/apiType pairs, using both parameters in the gate. Add mismatched
channel/API cases expecting false in controller/channel_test_internal_test.go
(lines 105-111), while retaining the existing valid positive cases.

@seefs001
seefs001 merged commit bb234ff into QuantumNous:main Aug 11, 2026
3 of 4 checks passed
Rain-kl added a commit to Rain-kl/new-api that referenced this pull request Aug 11, 2026
Merge upstream main (13 commits incl. QuantumNous#6770 compact-suffix removal,
codex model discovery, billingexpr updates) into feat.

Conflict resolutions:
- i18n: union of both sides' keys across all 7 locale files (pure additions)
- relay/channel/{deepseek,openai,xai}: keep ReasoningEffortFromChannel guards,
  adopt main's nil-safe SetReasoningEffort
- relay/claude_handler.go: keep feat prepareClaudeRequest + main effort recording
- relay/helper/price.go: drop CompactModelSuffix dead references (QuantumNous#6770)
- web models-table / channel-selector-dialog / upstream-ratio-sync-table:
  keep feat rewrites, adopt main search debounce
- drop feat price_test.go compact-suffix subtest (feature removed in QuantumNous#6770)
ItzPlana added a commit to ShittimChests/cyterx-api that referenced this pull request Aug 12, 2026
…pact suffix refs

Merge origin/main into feat/error-message-override. Resolved conflicts in
5 files by keeping both feature additions (error override settings and the
channel failover / model alias settings) side by side:
- model/option.go (ErrorOverrideEnabled + ChannelFailoverEnabled cases)
- system-behavior-section.tsx (both FormField blocks)
- operations/index.tsx, section-registry.tsx, types.ts (both fields)

While validating the merge, found that main's refactor bb234ff (QuantumNous#6770)
removed ratio_setting.CompactModelSuffix / WithCompactModelSuffix but the
failover/alias code merged in #8 still referenced them:
- setting/model_setting/model_alias.go: ResolveModelAlias stripped and
  re-added the compact suffix around alias resolution. Now resolves the
  requested name verbatim, matching QuantumNous#6770's removal of compact-suffix
  special-casing. Updated the compact test case to assert verbatim
  aliasing of a compact-suffixed name instead.
- middleware/distributor.go: dropped the strings.TrimSuffix(resolvedModel,
  ratio_setting.CompactModelSuffix) call so the rewritten request body
  model matches the resolved alias exactly.

Also fixed two pre-existing build/vet breakages from the #8 merge that
surfaced once compact-suffix references compiled:
- controller/relay.go: shouldRetryTaskRelay gained a failoverEnabled
  bool parameter on the call site (line 637) but the definition was not
  updated; added the parameter to the signature and removed the stale
  reference to the unqualified failoverEnabled identifier.
- model/channel_cache_failover_test.go: imported AdvancedCustomConfig
  from the root dto package, but it lives in relaykit/dto; switched the
  import alias accordingly.

Verified: go build ./... + go vet ./... pass, relaykit builds standalone
(GOWORK=off), and ./setting/operation_setting, ./service, ./model,
./setting/model_setting, relaykit/types tests all pass.
0401lucky pushed a commit to 0401lucky/new-api that referenced this pull request Aug 16, 2026
junjundesk pushed a commit to junjundesk/new-api that referenced this pull request Aug 17, 2026
330079598 pushed a commit to 330079598/new-api that referenced this pull request Aug 19, 2026
biubiubiu125 pushed a commit to biubiubiu125/newapi that referenced this pull request Aug 29, 2026
biubiubiu125 pushed a commit to biubiubiu125/newapi that referenced this pull request Aug 29, 2026
salem-2007 added a commit to salem-2007/new-api that referenced this pull request Sep 10, 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.

1 participant