From 1e2819272d75c9cbd8c1d221ba5ab0a5f2869f6e Mon Sep 17 00:00:00 2001 From: Andrey Nering Date: Fri, 17 Apr 2026 13:54:48 -0300 Subject: [PATCH] fix(copilot): allow a few more models (#252) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #251. 💘 Generated with Crush Assisted-by: GLM-5.1 via Crush --- cmd/copilot/main.go | 21 ++++++++++-- internal/providers/configs/copilot.json | 44 ++++++++++++++++++++++--- 2 files changed, 59 insertions(+), 6 deletions(-) diff --git a/cmd/copilot/main.go b/cmd/copilot/main.go index 35d3cebcf8d3ea1bad11cbcc266f7d34d37830f9..91b6657628a6192d8427f65ade5e2391ae00c24e 100644 --- a/cmd/copilot/main.go +++ b/cmd/copilot/main.go @@ -90,9 +90,26 @@ func run() error { return err } - // NOTE(@andreynering): Exclude versioned models and keep only the main version of each. + // Exclude versioned/duplicate models and keep only the main version of each. + aliasedVersions := make(map[string]bool, len(copilotModels)) + for _, m := range copilotModels { + if m.ID != m.Version { + aliasedVersions[m.Version] = true + } + } + + copilotModels = slices.DeleteFunc(copilotModels, func(m Model) bool { + return aliasedVersions[m.ID] || versionedModelRegexp.MatchString(m.ID) || strings.Contains(m.ID, "embedding") || strings.HasPrefix(m.ID, "accounts/msft/routers") || strings.HasPrefix(m.ID, "oswe-vscode") || m.ID == "gpt-4-o-preview" + }) + + // Deduplicate by ID (API can return duplicates) + seen := make(map[string]bool, len(copilotModels)) copilotModels = slices.DeleteFunc(copilotModels, func(m Model) bool { - return m.ID != m.Version || versionedModelRegexp.MatchString(m.ID) || strings.Contains(m.ID, "embedding") || strings.HasPrefix(m.ID, "accounts/msft/routers") + if seen[m.ID] { + return true + } + seen[m.ID] = true + return false }) catwalkModels := modelsToCatwalk(copilotModels) diff --git a/internal/providers/configs/copilot.json b/internal/providers/configs/copilot.json index 15c7b335ad494f3be08e12d3b46f6c0ab9a8c24b..d03d4f40a64c9b81f3cf8f395957a477865f5381 100644 --- a/internal/providers/configs/copilot.json +++ b/internal/providers/configs/copilot.json @@ -139,7 +139,7 @@ "supports_attachments": true }, { - "id": "gpt-3.5-turbo-0613", + "id": "gpt-3.5-turbo", "name": "GPT 3.5 Turbo", "cost_per_1m_in": 0, "cost_per_1m_out": 0, @@ -150,6 +150,18 @@ "can_reason": false, "supports_attachments": false }, + { + "id": "gpt-4", + "name": "GPT 4", + "cost_per_1m_in": 0, + "cost_per_1m_out": 0, + "cost_per_1m_in_cached": 0, + "cost_per_1m_out_cached": 0, + "context_window": 32768, + "default_max_tokens": 4096, + "can_reason": false, + "supports_attachments": false + }, { "id": "gpt-4-0125-preview", "name": "GPT 4 Turbo", @@ -163,13 +175,37 @@ "supports_attachments": false }, { - "id": "gpt-4-0613", - "name": "GPT 4", + "id": "gpt-4.1", + "name": "GPT-4.1", "cost_per_1m_in": 0, "cost_per_1m_out": 0, "cost_per_1m_in_cached": 0, "cost_per_1m_out_cached": 0, - "context_window": 32768, + "context_window": 128000, + "default_max_tokens": 16384, + "can_reason": false, + "supports_attachments": true + }, + { + "id": "gpt-4o", + "name": "GPT-4o", + "cost_per_1m_in": 0, + "cost_per_1m_out": 0, + "cost_per_1m_in_cached": 0, + "cost_per_1m_out_cached": 0, + "context_window": 128000, + "default_max_tokens": 4096, + "can_reason": false, + "supports_attachments": true + }, + { + "id": "gpt-4o-mini", + "name": "GPT-4o mini", + "cost_per_1m_in": 0, + "cost_per_1m_out": 0, + "cost_per_1m_in_cached": 0, + "cost_per_1m_out_cached": 0, + "context_window": 128000, "default_max_tokens": 4096, "can_reason": false, "supports_attachments": false