Skip to content

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

Closed as not planned

Description

@Juhwa-Lee1023

Summary

shouldUseCopilotResponsesApi in packages/opencode/src/provider/provider.ts only excludes models whose ID starts with gpt-5-mini:

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

This means any minor-versioned mini model — gpt-5.1-mini, gpt-5.2-mini, etc. — is incorrectly routed to the Responses API instead of the Chat Completions API, because those IDs don't start with gpt-5-mini.

Impact

Model ID Current behaviour Expected
gpt-5-mini ✅ Chat API ✅ Chat API
gpt-5.1-mini ❌ Responses API ✅ Chat API
gpt-5.2-mini ❌ Responses API ✅ Chat API
gpt-5 ✅ Responses API ✅ Responses API
gpt-5.1 ✅ Responses API ✅ Responses API

Routing a mini model to the Responses API can cause invalid_request_body errors or unexpected behaviour, since mini models are not expected to support the Responses API endpoint.

Expected fix

Broaden the exclusion to any model in the gpt-5 family that contains mini anywhere in the name, to stay forward-compatible with OpenAI's major.minor naming convention.

Activity

  1. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Mar 3, 2026
  2. github-actions commented on Mar 3, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

  3. Juhwa-Lee1023 commented on Mar 3, 2026

    @Juhwa-Lee1023
    Author

    Not a duplicate of #4943.

    This fork's dev branch has diverged from upstream (sst/opencode) and implements its own shouldUseCopilotResponsesApi function independently. The upstream fix at f1bb5870 took a completely different approach — switching the routing condition from gpt-5 string inclusion to codex inclusion — so it is not applicable here.

    The bug in this fork is specific to its own shouldUseCopilotResponsesApi logic: it excludes only models whose ID starts with gpt-5-mini, which misses minor-versioned mini variants like gpt-5.1-codex-mini that already exist in this codebase. PR #15818 fixes exactly that.

  4. github-actions commented on May 3, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

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

Metadata

Metadata

Assignees

Labels

coreAnything pertaining to core functionality of the application (opencode server stuff)

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions