Skip to content

fix(copilot): extend mini model exclusion to cover gpt-5.x-mini variants#15818

Open
Juhwa-Lee1023 wants to merge 3 commits intoanomalyco:devfrom
Juhwa-Lee1023:fix/copilot-responses-api-mini-routing
Open

fix(copilot): extend mini model exclusion to cover gpt-5.x-mini variants#15818
Juhwa-Lee1023 wants to merge 3 commits intoanomalyco:devfrom
Juhwa-Lee1023:fix/copilot-responses-api-mini-routing

Conversation

@Juhwa-Lee1023
Copy link

@Juhwa-Lee1023 Juhwa-Lee1023 commented Mar 3, 2026

Issue for this PR

Closes #15823

Type of change

  • Bug fix

What does this PR do?

shouldUseCopilotResponsesApi in packages/opencode/src/provider/provider.ts excluded only models whose ID starts with gpt-5-mini. This means minor-versioned mini models like gpt-5.1-mini or gpt-5.2-mini were incorrectly routed to the Responses API instead of the Chat Completions API, since their IDs do not start with gpt-5-mini.

The fix broadens the exclusion: any model in the gpt-5 family whose ID contains mini is now excluded from the Responses API. This matches the original intent from PR #5877 (exclude all lightweight/mini variants) while staying forward-compatible with OpenAI's major.minor naming convention.

// Before
function shouldUseCopilotResponsesApi(modelID: string): boolean {
  return isGpt5OrLater(modelID) && !modelID.startsWith("gpt-5-mini")
}

// After
function shouldUseCopilotResponsesApi(modelID: string): boolean {
  if (!isGpt5OrLater(modelID)) return false
  if (modelID.startsWith("gpt-5") && modelID.includes("mini")) return false
  return true
}
Model ID Before After
gpt-5-mini ✅ Chat API ✅ Chat API
gpt-5.1-mini ❌ Responses API (wrong) ✅ Chat API
gpt-5.2-mini ❌ Responses API (wrong) ✅ Chat API
gpt-5 ✅ Responses API ✅ Responses API
gpt-5.1 ✅ Responses API ✅ Responses API

How did you verify your code works?

Reviewed the existing shouldUseCopilotResponsesApi unit tests in packages/opencode/test/provider/provider.test.ts and confirmed all pass with the updated logic.

Screenshots / recordings

N/A — logic-only change, no UI.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

The shouldUseCopilotResponsesApi check previously excluded only models
starting with 'gpt-5-mini', meaning future minor-versioned mini models
like 'gpt-5.1-mini', 'gpt-5.2-mini' would be incorrectly routed to the
Responses API instead of the Chat API.

Broaden the exclusion to cover any model in the gpt-5 family that
contains 'mini' in its name, matching the original intent of excluding
all lightweight/mini variants from the Responses API.
@github-actions github-actions bot added needs:compliance This means the issue will auto-close after 2 hours. needs:issue labels Mar 3, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 3, 2026

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions github-actions bot removed needs:issue needs:compliance This means the issue will auto-close after 2 hours. labels Mar 3, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 3, 2026

Thanks for updating your PR! It now meets our contributing guidelines. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(copilot): gpt-5.x-mini variants incorrectly routed to Responses API

1 participant