Connect GitHub Enterprise Copilot

Register GitHub Copilot on a GitHub Enterprise Cloud tenant with data residency as a Kimchi model provider through the provider management API.

Connect GitHub Copilot on your GitHub Enterprise Cloud tenant with data residency to route requests to the models included in your Copilot subscription. Your tenant runs its own endpoints under <your-tenant>.ghe.com, so both the token and the provider registration differ from standard github.com Copilot.

⚠️

The console does not support GitHub Enterprise Cloud with data residency. To connect an enterprise tenant, register the provider through the API as described below.

Before you start

  • A Kimchi API key for the registration request and the verification request; see the inference quickstart.
  • Your GitHub Enterprise Cloud tenant domain, for example acme.ghe.com.

Step 1: Get a token from your tenant

Use GitHub's device-code OAuth flow with the Copilot OAuth App client ID, but run it against your tenant instead of github.com:

# 1. Request a device code
curl -s -X POST https://<your-tenant>.ghe.com/login/device/code \
  -H "Accept: application/json" \
  -d "client_id=Iv1.b507a08c87ecfe98&scope=read:user"

Open the verification_uri returned in the response in a browser and enter the user_code.

# 2. Poll for the access token
curl -s -X POST https://<your-tenant>.ghe.com/login/oauth/access_token \
  -H "Accept: application/json" \
  -d "client_id=Iv1.b507a08c87ecfe98&device_code=<device_code>&grant_type=urn:ietf:params:oauth:grant-type:device_code"

The access_token value (starting with ghu_...) is your API key. Classic PATs (ghp_) and fine-grained PATs (github_pat_) are not supported. The token must be issued by your tenant: a token from github.com does not work for an enterprise tenant.

Step 2: Register the provider through the API

Register the provider through the provider management API. Use https://api.cast.ai, or https://api.eu.cast.ai for EU-region organizations, and replace <your-kimchi-api-key> with your Kimchi API key:

curl -X POST https://api.cast.ai/v1/llm/providers \
  -H "X-API-Key: <your-kimchi-api-key>" \
  -H "Content-Type: application/json" \
  -d '{
    "providers": [
      {
        "name": "github-copilot-enterprise",
        "supportedProvider": "GITHUB_COPILOT",
        "apiKey": "<your-github-token>",
        "models": ["claude-opus-4-8", "claude-fable-5-1"],
        "includeInCli": true,
        "githubCopilotConfig": {
          "enterpriseHost": "<your-tenant>.ghe.com"
        }
      }
    ]
  }'

Where:

  • models is required. Use the exact model names Kimchi lists for github_copilot, for example claude-opus-4-8. Some names keep a dot, such as claude-sonnet-4.6. An unknown name returns model X is not supported for provider github_copilot. To list the valid names:

    curl -s https://api.cast.ai/v1/llm/openai/supported-providers \
      -H "X-API-Key: <your-kimchi-api-key>" \
      | jq -r '.supportedProviders[] | select(.provider == "github_copilot") | .models[].name'
  • includeInCli makes the models available in the Kimchi CLI. It defaults to false when you register through the API.

  • enterpriseHost is the bare tenant domain, for example acme.ghe.com: no https://, no path, and no port. Without it, requests go to public github.com, where the tenant token does not work. To add the host to an existing provider, send githubCopilotConfig together with the full models list to PATCH /v1/llm/providers/{provider_id}.

Once the provider is registered, Kimchi exchanges the token against your tenant and routes chat to your tenant's Copilot API automatically. No other configuration is needed.

To register a standard github.com Copilot provider through the API, use the same request without the githubCopilotConfig block. The console handles that path; see Supported Providers.

Verify the connection

Send a request to the Kimchi gateway with one of the models you registered. Use https://llm.kimchi.dev, or https://llm.eu.kimchi.dev for EU-region organizations. Replace <your-kimchi-api-key> with your Kimchi API key and <model-id> with one of the models you enabled:

curl https://llm.kimchi.dev/openai/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer <your-kimchi-api-key>" \
  -X POST \
  -d '{
    "model": "<model-id>",
    "messages": [
      {
        "role": "user",
        "content": "Test the connection"
      }
    ]
  }'

A successful response means Kimchi exchanged your token on the tenant and routed the request to your tenant's Copilot API.

See also


Did this page help you?