# GitHub Copilot

Source: https://docs.aicentos.com/en/clients/copilot

Language: en

> Use aicentos's OpenAI-compatible endpoint in GitHub Copilot Chat through bring-your-own-key (BYOK)

GitHub Copilot in VS Code offers bring-your-own-key (BYOK), which lets you point chat requests at a custom OpenAI-compatible endpoint. Set the endpoint to aicentos and fill in the key created in the console, and the models aicentos offers become available in Copilot Chat / Agent.

## Prerequisites

First create a dedicated key for Copilot on the console's "API Keys" page (naming it `copilot-vscode` or `copilot-work` makes usage easier to track).

* Console: [https://aicentos.com](https://aicentos.com)
* Create a key: [https://aicentos.com/keys](https://aicentos.com/keys)
* Top up when the balance runs out: [https://aicentos.com/wallet](https://aicentos.com/wallet)

Also make sure your local VS Code and the GitHub Copilot Chat extension are updated to a version that supports custom endpoints; older versions only offer built-in vendor BYOK with no generic "custom endpoint" entry.

## Configuration to fill in

| Field        | Value                                                                        |
| ------------ | ---------------------------------------------------------------------------- |
| Provider     | Custom Endpoint (OpenAI Compatible in older versions)                        |
| Base URL     | `https://aicentos.com/v1`                                                    |
| API type     | Chat Completions (corresponds to `https://aicentos.com/v1/chat/completions`) |
| API Key      | The key created in the console                                               |
| Model ID     | A model name from the Model Gallery in the console                           |
| Tool Calling | `true` (required to use Agent mode)                                          |

## Setup steps

### Option 1: Graphical interface

* Open the Chat view in VS Code.
* Click the model picker above the input box and choose **Manage Language Models** (**Manage Models...** in older versions).
* Click **Add Models** and pick **Custom Endpoint** (**OpenAI Compatible** in older versions) from the provider list.
* Enter a group name and the API Key.
* Choose **Chat Completions** as the API type.
* Complete the model details as prompted: `id` is the model name from the console, `url` is `https://aicentos.com/v1/chat/completions`.
* After saving, go back to Chat and select the newly added model in the model dropdown.

### Option 2: settings.json

Run **Preferences: Open User Settings (JSON)** from the command palette and add:

```json
{
  "github.copilot.chat.customOAIModels": {
    "aicentos-gpt": {
      "name": "aicentos GPT",
      "url": "https://aicentos.com/v1/chat/completions",
      "toolCalling": true,
      "vision": false,
      "maxInputTokens": 128000,
      "maxOutputTokens": 16384
    }
  }
}
```

The outermost key of the object (e.g. `aicentos-gpt`) is the model ID shown in the model picker and must be unique.

Reference documentation: [https://code.visualstudio.com/docs/copilot/customization/language-models](https://code.visualstudio.com/docs/copilot/customization/language-models)

## Test

After saving the settings, start a new conversation in Chat and send a simple prompt first; a normal response means the connection works. Then move on to Agent / Edit mode for real work.

## Notes

* BYOK only applies to **Chat / Agent / Edit**; it does not cover inline code completion (Tab completion). Semantic search, embeddings and similar features still go through Copilot's own service.
* To use **Agent** mode, the model must support **tool calling** and `toolCalling` must be `true`; otherwise the model will not appear in the model picker.
* The `url` field must be the full `https://aicentos.com/v1/chat/completions`, not just up to `/v1`.
* `github.copilot.chat.customOAIModels` is the older form; newer versions use `chatLanguageModels.json` together with `customendpoint`. Follow whatever entry point your current VS Code version actually offers.
* With GitHub Copilot Business / Enterprise, administrators may disable BYOK through policy.
* If a newly added model does not show up right away, restart VS Code once.
* When errors occur, check in order: whether the key has extra spaces, whether the model name matches the console, whether the account balance is sufficient, and whether the API type is correct. Top up at [https://aicentos.com/wallet](https://aicentos.com/wallet) if the balance runs out.