Skip to content

feat(apicompat): configure minimum output token floor - #8094

Merged
Wei-Shaw merged 1 commit into
Wei-Shaw:mainfrom
wucm667:feat/issue-8092-configurable-min-output
Oct 15, 2026
Merged

Wei-Shaw merged 1 commit into
Wei-Shaw:mainfrom
wucm667:feat/issue-8092-configurable-min-output

Conversation

@wucm667

@wucm667 wucm667 commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

背景

Chat Completions 或 Anthropic 请求转换为 Responses 时,输出 token 下限固定为 128,无法满足短回复、健康检查和成本控制场景。

改动

  • 新增 gateway.min_output_tokens 配置项,默认值为 128,最低允许值为 16。
  • 将配置应用到 Chat → Responses、Anthropic → Responses、Anthropic → Chat 及兼容入口转换路径。
  • 保留 max_completion_tokens 优先于 max_tokens 的既有规则。
  • 增加默认值、配置值、优先级和非法配置回归测试,并补充示例配置。

测试

已验证:

  • go test ./internal/pkg/apicompat ./internal/config ./internal/service -count=1
  • go test ./internal/pkg/apicompat ./internal/config
  • go test ./internal/service -run '^$'
  • go vet ./...
  • git diff --check

完整单元检查在当前环境超时;已验证受影响包及服务完整测试通过。静态检查受 Go 工具链导出数据环境问题阻塞。

Fixes #8092

@Wei-Shaw
Wei-Shaw merged commit 58b5e85 into Wei-Shaw:main Oct 15, 2026
9 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 15, 2026
@wucm667
wucm667 deleted the feat/issue-8092-configurable-min-output branch October 16, 2026 02:49
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Chat → Responses 转换的最小输出 token 上限支持配置

2 participants