Skip to content

[FEATURE]: Request GitHub Copilot auto model routing API access + chat.model plugin hook #20235

@fastdrumr

Description

@fastdrumr

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

Request GitHub to grant opencode access to the Copilot auto model routing API (/models/session).

VS Code's Copilot extension has a server-side auto model selection feature that uses ML to classify prompt complexity and route to the best model. The API endpoints are:

  • POST /models/session — creates an auto-mode session, returns available models and a session token
  • POST /models/session/intent — per-turn routing, returns ranked candidate models based on prompt analysis

This API is currently restricted to first-party OAuth clients (VS Code's client ID). When opencode's client ID (Ov23li8tweQw6odWQebz) calls these endpoints, it gets a 404.

Why this matters:

What's needed:
The opencode team already has an official partnership with GitHub for Copilot support. Requesting access to the /models/session and /models/session/intent endpoints for opencode's OAuth client ID would enable native auto model selection matching VS Code's experience.

Additionally, a chat.model plugin hook would allow the community to implement model routing as external plugins regardless of API access. Proposed signature:

"chat.model": async (incoming: {
  sessionID: string
  agent: string
  model: Provider.Model
  provider: Provider.Info
  message: MessageV2.User
}, output: {
  model: Provider.Model
}) => void

This would enable auto model selection, cost-based routing, A/B testing, and fallback chains as external plugins.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions