mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-10-03 22:32:44 +08:00
- Filter `max` and `ultra` reasoning effort levels for Codex client versions prior to `0.144.0`. - Extract and forward the `client_version` query parameter across model catalog response handlers. - Add dotted version parsing and comparison utilities to verify extended reasoning level compatibility. Closes: #5262
33 lines
1.4 KiB
Go
33 lines
1.4 KiB
Go
package openai
|
|
|
|
import (
|
|
codexmodels "github.com/router-for-me/CLIProxyAPI/v7/internal/client/codex/models"
|
|
"github.com/router-for-me/CLIProxyAPI/v7/internal/registry"
|
|
)
|
|
|
|
func (h *OpenAIAPIHandler) codexClientModelsResponse(clientVersion ...string) map[string]any {
|
|
version := ""
|
|
if len(clientVersion) > 0 {
|
|
version = clientVersion[0]
|
|
}
|
|
optimizeMultiAgentV2 := h != nil && h.Cfg != nil && h.Cfg.CodexOptimizeMultiAgentV2
|
|
return codexmodels.BuildResponseForClient(h.Models(), registry.GetGlobalRegistry().GetModelProviders, optimizeMultiAgentV2, version)
|
|
}
|
|
|
|
// CodexClientModelsResponse builds a Codex client model response.
|
|
func CodexClientModelsResponse(models []map[string]any) map[string]any {
|
|
return codexmodels.BuildResponse(models, nil, false)
|
|
}
|
|
|
|
// CodexClientModelsResponseWithMultiAgentV2 builds a Codex client model response
|
|
// and advertises multi-agent v2 for synthesized models when enabled.
|
|
func CodexClientModelsResponseWithMultiAgentV2(models []map[string]any, enabled bool) map[string]any {
|
|
return codexmodels.BuildResponse(models, nil, enabled)
|
|
}
|
|
|
|
// CodexClientModelsResponseForClient builds a Codex client model response
|
|
// tailored for a specific client version.
|
|
func CodexClientModelsResponseForClient(models []map[string]any, clientVersion string, enabled bool) map[string]any {
|
|
return codexmodels.BuildResponseForClient(models, nil, enabled, clientVersion)
|
|
}
|