Download internal/registry/model_definitions.go from shimen/ShinAPI: direct link, hf CLI and curl.
- Browser
- Download file 2.55 kB
-
https://huggingface.co/spaces/shimen/ShinAPI/resolve/main/internal/registry/model_definitions.go
- Command line
-
hf download hf://spaces/shimen/ShinAPI/internal/registry/model_definitions.go
-
curl -L -o model_definitions.go https://huggingface.co/spaces/shimen/ShinAPI/resolve/main/internal/registry/model_definitions.go
2.55 kB
| // Package registry provides model definitions and lookup helpers for various AI providers. | |
| // Static model metadata is stored in model_definitions_static_data.go. | |
| package registry | |
| import ( | |
| "sort" | |
| "strings" | |
| ) | |
| // GetStaticModelDefinitionsByChannel returns static model definitions for a given channel/provider. | |
| // It returns nil when the channel is unknown. | |
| // | |
| // Supported channels: | |
| // - claude | |
| // - gemini | |
| // - vertex | |
| // - gemini-cli | |
| // - aistudio | |
| // - codex | |
| // - qwen | |
| // - iflow | |
| // - antigravity (returns static overrides only) | |
| func GetStaticModelDefinitionsByChannel(channel string) []*ModelInfo { | |
| key := strings.ToLower(strings.TrimSpace(channel)) | |
| switch key { | |
| case "claude": | |
| return GetClaudeModels() | |
| case "gemini": | |
| return GetGeminiModels() | |
| case "vertex": | |
| return GetGeminiVertexModels() | |
| case "gemini-cli": | |
| return GetGeminiCLIModels() | |
| case "aistudio": | |
| return GetAIStudioModels() | |
| case "codex": | |
| return GetOpenAIModels() | |
| case "qwen": | |
| return GetQwenModels() | |
| case "iflow": | |
| return GetIFlowModels() | |
| case "antigravity": | |
| cfg := GetAntigravityModelConfig() | |
| if len(cfg) == 0 { | |
| return nil | |
| } | |
| models := make([]*ModelInfo, 0, len(cfg)) | |
| for modelID, entry := range cfg { | |
| if modelID == "" || entry == nil { | |
| continue | |
| } | |
| models = append(models, &ModelInfo{ | |
| ID: modelID, | |
| Object: "model", | |
| OwnedBy: "antigravity", | |
| Type: "antigravity", | |
| Thinking: entry.Thinking, | |
| MaxCompletionTokens: entry.MaxCompletionTokens, | |
| }) | |
| } | |
| sort.Slice(models, func(i, j int) bool { | |
| return strings.ToLower(models[i].ID) < strings.ToLower(models[j].ID) | |
| }) | |
| return models | |
| default: | |
| return nil | |
| } | |
| } | |
| // LookupStaticModelInfo searches all static model definitions for a model by ID. | |
| // Returns nil if no matching model is found. | |
| func LookupStaticModelInfo(modelID string) *ModelInfo { | |
| if modelID == "" { | |
| return nil | |
| } | |
| allModels := [][]*ModelInfo{ | |
| GetClaudeModels(), | |
| GetGeminiModels(), | |
| GetGeminiVertexModels(), | |
| GetGeminiCLIModels(), | |
| GetAIStudioModels(), | |
| GetOpenAIModels(), | |
| GetQwenModels(), | |
| GetIFlowModels(), | |
| } | |
| for _, models := range allModels { | |
| for _, m := range models { | |
| if m != nil && m.ID == modelID { | |
| return m | |
| } | |
| } | |
| } | |
| // Check Antigravity static config | |
| if cfg := GetAntigravityModelConfig()[modelID]; cfg != nil { | |
| return &ModelInfo{ | |
| ID: modelID, | |
| Thinking: cfg.Thinking, | |
| MaxCompletionTokens: cfg.MaxCompletionTokens, | |
| } | |
| } | |
| return nil | |
| } | |