71 lines
1.8 KiB
Go
71 lines
1.8 KiB
Go
// Package presets holds the built-in upstream provider templates.
|
|
package presets
|
|
|
|
import "gitea.rutua.cn/kate522/CrossRelay/internal/config"
|
|
|
|
// Preset is a ready-made provider template. Model names reflect each
|
|
// vendor's catalog as of 2026-10 and can be edited per provider.
|
|
type Preset struct {
|
|
Key string `json:"key"`
|
|
BaseURL string `json:"base_url"`
|
|
Models config.Models `json:"models"`
|
|
}
|
|
|
|
// All lists the built-in presets.
|
|
var All = []Preset{
|
|
{
|
|
Key: "deepseek",
|
|
BaseURL: "https://api.deepseek.com/v1",
|
|
Models: config.Models{
|
|
Default: "deepseek-chat",
|
|
Sonnet: "deepseek-chat",
|
|
Haiku: "deepseek-chat",
|
|
Opus: "deepseek-chat",
|
|
Extra: codexModelExtras("deepseek-chat"),
|
|
},
|
|
},
|
|
{
|
|
Key: "moonshot",
|
|
BaseURL: "https://api.moonshot.cn/v1",
|
|
Models: config.Models{
|
|
Default: "kimi-k2-0905-preview",
|
|
Sonnet: "kimi-k2-0905-preview",
|
|
Haiku: "kimi-k2-0905-preview",
|
|
Opus: "kimi-k2-0905-preview",
|
|
Extra: codexModelExtras("kimi-k2-0905-preview"),
|
|
},
|
|
},
|
|
{
|
|
Key: "zhipu",
|
|
BaseURL: "https://open.bigmodel.cn/api/paas/v4",
|
|
Models: config.Models{
|
|
Default: "glm-4.6",
|
|
Sonnet: "glm-4.6",
|
|
Haiku: "glm-4.6",
|
|
Opus: "glm-4.6",
|
|
Extra: codexModelExtras("glm-4.6"),
|
|
},
|
|
},
|
|
}
|
|
|
|
// codexModelExtras maps the model names Codex CLI asks for onto one
|
|
// upstream model, so activating a preset for Codex works without manual
|
|
// mapping.
|
|
func codexModelExtras(upstream string) map[string]string {
|
|
return map[string]string{
|
|
"gpt-5-codex": upstream,
|
|
"gpt-5": upstream,
|
|
"codex-mini-latest": upstream,
|
|
}
|
|
}
|
|
|
|
// ByKey looks up a preset by its key.
|
|
func ByKey(key string) (Preset, bool) {
|
|
for _, p := range All {
|
|
if p.Key == key {
|
|
return p, true
|
|
}
|
|
}
|
|
return Preset{}, false
|
|
}
|