Skip to content

Commit 52a34cd

Browse files
add gpt-5.4-mini, gpt-5.4-nano to copilot response models
1 parent 1b6483a commit 52a34cd

5 files changed

Lines changed: 78 additions & 427 deletions

File tree

pkg/model/provider/defaults.go

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ func isOpenAICompatibleProvider(providerType string) bool {
4343
return exists && alias.APIType == "openai"
4444
}
4545

46+
// IsGithubCopilotProvider returns true if the provider type is "github-copilot".
47+
func isGithubCopilotProvider(providerType string) bool {
48+
return providerType == "github-copilot"
49+
}
50+
4651
// ---------------------------------------------------------------------------
4752
// Provider defaults
4853
// ---------------------------------------------------------------------------
@@ -180,6 +185,9 @@ func cloneModelConfig(cfg *latest.ModelConfig) *latest.ModelConfig {
180185
//
181186
// NOTE: max_tokens is NOT set here; see teamloader and runtime/model_switcher.
182187
func applyModelDefaults(cfg *latest.ModelConfig) {
188+
// Set appropriate github copilot api_type.
189+
applyGithubCopilotAPIType(cfg)
190+
183191
// Explicitly disabled → normalise to nil so providers never see it.
184192
if cfg.ThinkingBudget.IsDisabled() {
185193
cfg.ThinkingBudget = nil
@@ -225,6 +233,18 @@ func ensureInterleavedThinking(cfg *latest.ModelConfig, providerType string) {
225233
}
226234
}
227235

236+
func applyGithubCopilotAPIType(cfg *latest.ModelConfig) {
237+
if isGithubCopilotProvider(cfg.Provider) && isCopilotResponsesModel(cfg.Model) {
238+
if cfg.ProviderOpts == nil {
239+
cfg.ProviderOpts = make(map[string]any)
240+
}
241+
// If it's not set, or was set to openai_chatcompletions by the generic fallback, override it.
242+
if apiType, ok := cfg.ProviderOpts["api_type"].(string); !ok || apiType == "" || apiType == "openai_chatcompletions" {
243+
cfg.ProviderOpts["api_type"] = "openai_responses"
244+
}
245+
}
246+
}
247+
228248
// ---------------------------------------------------------------------------
229249
// Model-name predicates
230250
// ---------------------------------------------------------------------------
@@ -281,3 +301,14 @@ func isGeminiProModel(model string) bool {
281301
func isGeminiFlashModel(model string) bool {
282302
return strings.HasPrefix(gemini3Family(model), "flash")
283303
}
304+
305+
// isCopilotResponsesModel returns true if the model is a GitHub Copilot model that requires the openai_responses API type.
306+
func isCopilotResponsesModel(model string) bool {
307+
codex := map[string]bool{
308+
"gpt-5.3-codex": true,
309+
"gpt-5.2-codex": true,
310+
"gpt-5.4-mini": true,
311+
"gpt-5.4-nano": true,
312+
}
313+
return codex[model]
314+
}

pkg/model/provider/model_defaults_test.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,3 +289,13 @@ func TestApplyProviderDefaults_DoesNotModifyOriginal(t *testing.T) {
289289
// Original custom key must still be there.
290290
assert.Equal(t, "original_value", original.ProviderOpts["custom_key"])
291291
}
292+
293+
func TestIsCopilotResponsesModel(t *testing.T) {
294+
t.Parallel()
295+
296+
assert.True(t, isCopilotResponsesModel("gpt-5.3-codex"))
297+
assert.True(t, isCopilotResponsesModel("gpt-5.2-codex"))
298+
assert.False(t, isCopilotResponsesModel("gpt-4o"))
299+
assert.False(t, isCopilotResponsesModel("claude-sonnet-4-5"))
300+
assert.False(t, isCopilotResponsesModel(""))
301+
}

0 commit comments

Comments
 (0)