feat(channel): support Codex upstream model discovery (#6184)

* fix(i18n): clarify Go regex and field passthrough copy

* feat(channel): support Codex upstream model discovery

* Revert "fix(i18n): clarify Go regex and field passthrough copy"

This reverts commit d63d7975db3e34ff44e189112d3c15ad8c24ad88.
This commit is contained in:
Seefs
2026-07-18 13:04:16 +08:00
committed by GitHub
parent 1086038f5f
commit 57746fc972
8 changed files with 359 additions and 102 deletions
+16 -15
View File
@@ -1,26 +1,27 @@
package codex
import (
"slices"
"github.com/QuantumNous/new-api/setting/ratio_setting"
"github.com/samber/lo"
)
var baseModelList = []string{
"gpt-5", "gpt-5-codex", "gpt-5-codex-mini",
"gpt-5.1", "gpt-5.1-codex", "gpt-5.1-codex-max", "gpt-5.1-codex-mini",
"gpt-5.2", "gpt-5.2-codex", "gpt-5.3-codex", "gpt-5.3-codex-spark",
"gpt-5.4", "gpt-5.6-sol", "gpt-5.6-terra", "gpt-5.6-luna",
"gpt-5.6-sol",
"gpt-5.6-terra",
"gpt-5.6-luna",
"gpt-5.5",
"gpt-5.4",
"gpt-5.4-mini",
"gpt-5.3-codex-spark",
"codex-auto-review",
}
var ModelList = withCompactModelSuffix(baseModelList)
var ModelList = slices.DeleteFunc(
ratio_setting.WithCompactModelVariants(baseModelList),
func(modelName string) bool {
return modelName == ratio_setting.WithCompactModelSuffix("codex-auto-review")
},
)
const ChannelName = "codex"
func withCompactModelSuffix(models []string) []string {
out := make([]string, 0, len(models)*2)
out = append(out, models...)
out = append(out, lo.Map(models, func(model string, _ int) string {
return ratio_setting.WithCompactModelSuffix(model)
})...)
return lo.Uniq(out)
}