Skip to content

List models uses incorrect URL for GitHub Enterprise. #4654

Description

@Divitum

Describe the bug

Copilot CLI on an enterprise account attempts to list models using a non-enterprise URL and gets 401 unauthorized.

Affected version

GitHub Copilot CLI 1.0.81.

Steps to reproduce the behavior

  1. Run copilot -p "hello" on an enterprise account and a company VPN.
  2. It immediately responds with:
Error: Authentication failed (Request ID: 554C:1ECD:2F6B18C:3939587:6A9160A9)

Your GitHub token may be invalid, expired, or lacking the required permissions.

To resolve this, try the following:
  • Start 'copilot' and run the '/login' command to re-authenticate
  • If using a Fine-Grained PAT, ensure it has the 'Copilot Requests' permission enabled
  • If using COPILOT_GITHUB_TOKEN, GH_TOKEN or GITHUB_TOKEN environment variable, verify the token is valid and not expired
  • Run 'gh auth status' to check your current authentication status
  1. Check the session logs, and see it attempts to list models from non-enterprise url api.githubcopilot.com
2026-08-28T12:16:10.529Z [DEBUG] [rust:hyper_util::client::legacy::pool] pooling idle connection for ("https", copilot-api.company.ghe.com)
2026-08-28T12:16:10.530Z [DEBUG] [rust:rmcp::transport::streamable_http_client] server doesn't support sse, skip common stream
2026-08-28T12:16:11.290Z [DEBUG] [rust:hyper_util::client::legacy::pool] pooling idle connection for ("https", api.githubcopilot.com)
2026-08-28T12:16:11.293Z [ERROR] Error loading models: Error: 401 "unauthorized: AuthenticateToken authentication failed\n"

Expected behavior

List models should go to the enterprise endpoint and authorization should not fail.

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions