Skip to content

OpenCode is unable to invoke third-party models added by enterprises in GitHub Copilot. #34030

Closed as not planned

Description

@KTY810

Description

  1. I have a GitHub Copilot Enterprise account, and our company has added third-party models that are not part of Copilot to the platform.
  2. When I connect Copilot to OpenCode, I am unable to read and use the third-party models that have been added to Copilot.

Plugins

oh-my-openagent

OpenCode version

1.17.10

Steps to reproduce

  1. Copilot Enterprise Administrator Adding Third-Party Models
  2. Connecting OpenCode to Copilot
  3. Viewing Copilot Models Recognized by OpenCode

Screenshot and/or share link

No response

Operating System

ubuntu22.04

Terminal

No response

Activity

  1. github-actions commented on Jun 26, 2026

    @github-actions
    Contributor

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

    If your issue is specifically about the static model list not reflecting enterprise-managed models, #13470 is likely the most relevant existing report.

  2. KTY810 commented on Jun 26, 2026

    @KTY810
    Author

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

    If your issue is specifically about the static model list not reflecting enterprise-managed models, #13470 is likely the most relevant existing report.

    There is a difference. What I'm focusing on is using third-party models configured in GitHub Copilot's enterprise settings. The current issue is that OpenCode cannot read them.

  3. KTY810 commented on Jun 26, 2026

    @KTY810
    Author

    OpenCode GitHub Copilot Experimental Models Debug Report

    Issue Summary

    OpenCode 1.17.11 does not automatically discover some GitHub Copilot Business / enterprise Experimental models that are visible to the same authenticated account when the request uses VS Code / Copilot CLI style headers.

    The missing models are returned by the Copilot /models API only when these headers are included:

    Editor-Version: vscode/1.107.1
    Editor-Plugin-Version: copilot-chat/0.26.7
    Copilot-Integration-Id: copilot-developer-cli

    With OpenCode's default model discovery headers, the models are absent. Manually registering the models in opencode.json and adding the same headers at the model level makes OpenCode able to use them.

    Environment

    • OpenCode version: 1.17.11
    • OS: Linux
    • GitHub Copilot auth in OpenCode: oauth configured for provider github-copilot
    • Copilot plan/SKU: Copilot Business seat, login redacted
    • OpenCode config path: ~/.config/opencode/opencode.json

    Reproduction Data

    The same OpenCode GitHub Copilot OAuth token was used for both requests below. Only headers changed. Authorization values are redacted and not shown.

    Request A: OpenCode-style default headers

    Request target:

    GET https://api.business.githubcopilot.com/models
    

    Headers used, excluding authorization:

    {
      "User-Agent": "opencode/1.17.11",
      "X-GitHub-Api-Version": "2026-06-01",
      "Accept": "application/json"
    }

    Sanitized response summary:

    {
      "status": 200,
      "totalReturned": 33,
      "pickerEnabled": 16,
      "experimental": [],
      "allPickerIds": [
        "claude-haiku-4.5",
        "claude-opus-4.5",
        "claude-opus-4.6",
        "claude-opus-4.7",
        "claude-opus-4.8",
        "claude-sonnet-4.5",
        "claude-sonnet-4.6",
        "gemini-2.5-pro",
        "gemini-3-flash-preview",
        "gemini-3.1-pro-preview",
        "gemini-3.5-flash",
        "gpt-5-mini",
        "gpt-5.3-codex",
        "gpt-5.4",
        "gpt-5.4-mini",
        "gpt-5.5"
      ]
    }

    Request B: VS Code / Copilot CLI-style headers

    Request target:

    GET https://api.business.githubcopilot.com/models
    

    Headers used, excluding authorization:

    {
      "User-Agent": "GithubCopilot/1.155.0",
      "Editor-Version": "vscode/1.107.1",
      "Editor-Plugin-Version": "copilot-chat/0.26.7",
      "Copilot-Integration-Id": "copilot-developer-cli",
      "X-GitHub-Api-Version": "2026-06-01",
      "Accept": "application/json"
    }

    Sanitized response summary:

    {
      "status": 200,
      "totalReturned": 39,
      "pickerEnabled": 21,
      "experimental": [
        "*/GLM/glm-5.1",
        "*/GLM/glm-5.2",
        "*/HUAWEI/glm-5.2",
        "*/QDeepseekV4/deepseek-v4-flash",
        "*/QDeepseekV4/deepseek-v4-pro",
        "*/Qwen37plus/qwen3.7-plus"
      ]
    }

    Experimental Model API Metadata

    The Experimental models returned by Request B are picker-enabled and support /chat/completions.

    [
      {
        "id": "*/QDeepseekV4/deepseek-v4-flash",
        "name": "deepseek-v4-flash",
        "model_picker_enabled": true,
        "supported_endpoints": ["/chat/completions"],
        "limits": {
          "max_context_window_tokens": 1000000,
          "max_prompt_tokens": 840000,
          "max_output_tokens": 128000
        },
        "supports": {
          "streaming": true,
          "tool_calls": true
        }
      },
      {
        "id": "*/QDeepseekV4/deepseek-v4-pro",
        "name": "deepseek-v4-pro",
        "model_picker_enabled": true,
        "supported_endpoints": ["/chat/completions"],
        "limits": {
          "max_context_window_tokens": 1000000,
          "max_prompt_tokens": 840000,
          "max_output_tokens": 128000
        },
        "supports": {
          "tool_calls": true
        }
      },
      {
        "id": "*/Qwen37plus/qwen3.7-plus",
        "name": "qwen3.7-plus",
        "model_picker_enabled": true,
        "supported_endpoints": ["/chat/completions"],
        "limits": {
          "max_context_window_tokens": 1000000,
          "max_prompt_tokens": 991000,
          "max_output_tokens": 64000
        },
        "supports": {
          "tool_calls": true
        }
      },
      {
        "id": "*/GLM/glm-5.1",
        "name": "glm-5.1",
        "model_picker_enabled": true,
        "supported_endpoints": ["/chat/completions"],
        "limits": {
          "max_context_window_tokens": 200000,
          "max_prompt_tokens": 167232,
          "max_output_tokens": 32768
        },
        "supports": {
          "tool_calls": true
        }
      },
      {
        "id": "*/GLM/glm-5.2",
        "name": "glm-5.2",
        "model_picker_enabled": true,
        "supported_endpoints": ["/chat/completions"],
        "limits": {
          "max_context_window_tokens": 1000000,
          "max_prompt_tokens": 868928,
          "max_output_tokens": 131072
        },
        "supports": {
          "tool_calls": true
        }
      },
      {
        "id": "*/HUAWEI/glm-5.2",
        "name": "huawei-glm5.2",
        "model_picker_enabled": true,
        "supported_endpoints": ["/chat/completions"],
        "limits": {
          "max_context_window_tokens": 192000,
          "max_prompt_tokens": 128000,
          "max_output_tokens": 64000
        },
        "supports": {
          "tool_calls": true
        }
      }
    ]

    OpenCode Behavior Before Workaround

    opencode models github-copilot

    Before manual configuration, OpenCode listed only the standard GitHub Copilot models and did not list any */... Experimental model.

    Direct use of a raw Experimental ID without registration

    Command:

    opencode run -m "github-copilot/*/GLM/glm-5.2" --format json "Reply exactly OK"

    Observed result:

    {
      "type": "error",
      "error": {
        "name": "UnknownError",
        "data": {
          "message": "Unexpected server error. Check server logs for details."
        }
      }
    }

    Relevant sanitized log:

    timestamp=2026-06-26T07:57:28.626Z level=INFO message=created id=<session> version=1.17.11 directory=<home> model=undefined
    

    This indicates that an unknown slash-containing model ID is not cleanly resolved when it is not already registered in OpenCode's model catalog.

    Manual raw ID registration without model-level headers

    After registering the raw model ID in a temporary local opencode.json, OpenCode did send the full model ID:

    timestamp=2026-06-26T08:02:58.781Z level=INFO message=stream providerID=github-copilot modelID=*/GLM/glm-5.2 session.id=<session> small=false agent="Sisyphus - ultraworker" mode=primary
    timestamp=2026-06-26T08:02:58.794Z level=INFO message="llm runtime selected" llm.runtime=ai-sdk llm.provider=github-copilot llm.model=*/GLM/glm-5.2
    

    But the API returned:

    {
      "error": {
        "message": "The requested model is not supported.",
        "code": "model_not_supported",
        "param": "model",
        "type": "invalid_request_error"
      },
      "metadata": {
        "url": "https://api.githubcopilot.com/chat/completions"
      }
    }

    This was fixed by adding the VS Code / Copilot CLI-style headers at the model level.

    Confirmed Workaround

    Register the Experimental models manually under the github-copilot provider and attach the VS Code / Copilot CLI-style headers to each model.

    After this workaround, OpenCode lists the models:

    github-copilot/*/GLM/glm-5.1
    github-copilot/*/GLM/glm-5.2
    github-copilot/*/HUAWEI/glm-5.2
    github-copilot/*/QDeepseekV4/deepseek-v4-flash
    github-copilot/*/QDeepseekV4/deepseek-v4-pro
    github-copilot/*/Qwen37plus/qwen3.7-plus
    

    And this command succeeds:

    opencode run -m "github-copilot/*/GLM/glm-5.2" --format json "Reply exactly OK"

    Sanitized successful response:

    {
      "type": "text",
      "text": "OK"
    }

    Relevant sanitized success log:

    timestamp=2026-06-26T08:14:20.350Z level=INFO message=stream providerID=github-copilot modelID=*/GLM/glm-5.2 session.id=<session> small=false agent="Sisyphus - ultraworker" mode=primary
    timestamp=2026-06-26T08:14:20.358Z level=INFO message="llm runtime selected" llm.runtime=ai-sdk llm.provider=github-copilot llm.model=*/GLM/glm-5.2
    

    Current Local OpenCode Configuration Applied

    File changed:

    ~/.config/opencode/opencode.json
    

    The current configuration adds these models under provider.github-copilot.models.

    Each model has:

    {
      "family": "custom",
      "tool_call": true,
      "temperature": false,
      "experimental": true,
      "headers": {
        "Editor-Version": "vscode/1.107.1",
        "Editor-Plugin-Version": "copilot-chat/0.26.7",
        "Copilot-Integration-Id": "copilot-developer-cli"
      }
    }

    The six configured model IDs are:

    */QDeepseekV4/deepseek-v4-flash
    */QDeepseekV4/deepseek-v4-pro
    */Qwen37plus/qwen3.7-plus
    */GLM/glm-5.1
    */GLM/glm-5.2
    */HUAWEI/glm-5.2
    

    Copy-Paste Configuration Snippet

    Use this shape in ~/.config/opencode/opencode.json under the top-level provider object. Merge it with existing providers instead of replacing the entire file.

    {
      "provider": {
        "github-copilot": {
          "models": {
            "*/QDeepseekV4/deepseek-v4-flash": {
              "name": "deepseek-v4-flash",
              "family": "custom",
              "limit": { "context": 1000000, "input": 840000, "output": 128000 },
              "tool_call": true,
              "temperature": false,
              "experimental": true,
              "headers": {
                "Editor-Version": "vscode/1.107.1",
                "Editor-Plugin-Version": "copilot-chat/0.26.7",
                "Copilot-Integration-Id": "copilot-developer-cli"
              }
            },
            "*/QDeepseekV4/deepseek-v4-pro": {
              "name": "deepseek-v4-pro",
              "family": "custom",
              "limit": { "context": 1000000, "input": 840000, "output": 128000 },
              "tool_call": true,
              "temperature": false,
              "experimental": true,
              "headers": {
                "Editor-Version": "vscode/1.107.1",
                "Editor-Plugin-Version": "copilot-chat/0.26.7",
                "Copilot-Integration-Id": "copilot-developer-cli"
              }
            },
            "*/Qwen37plus/qwen3.7-plus": {
              "name": "qwen3.7-plus",
              "family": "custom",
              "limit": { "context": 1000000, "input": 991000, "output": 64000 },
              "tool_call": true,
              "temperature": false,
              "experimental": true,
              "headers": {
                "Editor-Version": "vscode/1.107.1",
                "Editor-Plugin-Version": "copilot-chat/0.26.7",
                "Copilot-Integration-Id": "copilot-developer-cli"
              }
            },
            "*/GLM/glm-5.1": {
              "name": "glm-5.1",
              "family": "custom",
              "limit": { "context": 200000, "input": 167232, "output": 32768 },
              "tool_call": true,
              "temperature": false,
              "experimental": true,
              "headers": {
                "Editor-Version": "vscode/1.107.1",
                "Editor-Plugin-Version": "copilot-chat/0.26.7",
                "Copilot-Integration-Id": "copilot-developer-cli"
              }
            },
            "*/GLM/glm-5.2": {
              "name": "glm-5.2",
              "family": "custom",
              "limit": { "context": 1000000, "input": 868928, "output": 131072 },
              "tool_call": true,
              "temperature": false,
              "experimental": true,
              "headers": {
                "Editor-Version": "vscode/1.107.1",
                "Editor-Plugin-Version": "copilot-chat/0.26.7",
                "Copilot-Integration-Id": "copilot-developer-cli"
              }
            },
            "*/HUAWEI/glm-5.2": {
              "name": "huawei-glm5.2",
              "family": "custom",
              "limit": { "context": 192000, "input": 128000, "output": 64000 },
              "tool_call": true,
              "temperature": false,
              "experimental": true,
              "headers": {
                "Editor-Version": "vscode/1.107.1",
                "Editor-Plugin-Version": "copilot-chat/0.26.7",
                "Copilot-Integration-Id": "copilot-developer-cli"
              }
            }
          }
        }
      }
    }
    
    
    ## Commands Used for Verification
    
    List GitHub Copilot models visible to OpenCode:
    
    ```bash
    opencode models github-copilot

    Run one Experimental model:

    opencode run -m "github-copilot/*/GLM/glm-5.2" --format json "Reply exactly OK"

    Expected minimal response:

    OK
    

    Suggested Upstream Fix Areas

    1. GitHub Copilot model discovery should use the same headers official Copilot clients use, or otherwise preserve account-specific enterprise / Experimental model visibility.
    2. provider.github-copilot.options.headers appears in resolved config, but in this test it did not make opencode models github-copilot discover the Experimental models. If provider-level headers are intended to affect Copilot model discovery, this may be a bug.
    3. If a slash-containing model ID is not registered, opencode run -m provider/model/with/slashes currently degrades into model=undefined and an Unexpected server error. A clearer model not found error would make diagnosis easier.
    4. When Copilot /models returns picker-enabled IDs containing slashes, OpenCode should be able to register and select those IDs without requiring manual opencode.json entries.
  4. rekram1-node commented on Jun 27, 2026

    @rekram1-node
    Collaborator

    GitHub Copilot model discovery should use the same headers official Copilot clients use, or otherwise preserve account-specific enterprise / Experimental model visibility.

    Nah we arent supposed to. They gave us specific guidelines and we follow them.

  5. KTY810 commented on Jun 29, 2026

    @KTY810
    Author

    What I'm trying to say is that my account has the necessary permissions, and I can see the corresponding model on GitHub Copilot and use it there, but by default, it isn't detected on OpenCode.

  6. KTY810 commented on Jul 1, 2026

    @KTY810
    Author

    This is likely an issue with GitHub Copilot rather than OpenCode.

  7. brunogabriel commented on Jul 7, 2026

    @brunogabriel

    Any update?

  8. rekram1-node commented on Jul 7, 2026

    @rekram1-node
    Collaborator

    i dont have access to 3rd party models in an enterprise setup, so need some community support to help figure it out, look into the github copilot model fetching logic, see whats wrong w/ it if anything

  9. github-actions commented on Sep 6, 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

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions