Skip to main content

GitHub Copilot

GitHub Copilot is an AI programming assistant launched by GitHub. It is deeply integrated into mainstream editors such as VS Code and JetBrains, providing capabilities including code completion, chat-based conversation, and Agent functionality.

Prerequisites

  • You have activated a TCB environment and obtained the environment ID cloudBaseEnvID
  • Enable the required model in the AI console
  • Obtain the Base URL and API Key in the AI console
Base URLhttps://<ENV_ID>.api.tcloudbasegateway.com/v1/ai/cloudbase

codebuddy

Configuration Steps

GitHub Copilot provides both an IDE plugin and a CLI tool.

Taking VS Code as an example

  1. In the model list of the dialog box, click the settings icon to open the Language Models panel.

copilot1.png

  1. Click the Add Models button.

copilot2.png

  1. Select Custom Endpoint from the menu.

copilot3.png

  1. An interactive pop-up window appears. Enter the Group Name (model group name), using cloudbase as an example here.

copilot4.png

  1. Enter the API Key, which you obtain from the AI console.

copilot5.png

  1. Select the Chat Completions protocol.

copilot6.png

  1. After pressing Enter, the model configuration file opens automatically, and you can edit the fields in models.

The meanings of each field are as follows:

Field to EnterExplanation
urlThe Base URL for the large model, which is obtained in the AI console.
idThe large model ID. Copy the identifier of an enabled large model from the model list in the AI console and enter it here.
nameThe display name of the large model, which can be filled in arbitrarily.
[
{
"name": "cloudbase",
"vendor": "customendpoint",
"apiKey": "${input:chat.lm.secret.-6bd4af55}",
"apiType": "chat-completions",
"models": [
{
"id": "hy3-preview",
"name": "hy3-preview",
"url": "https://{{cloudBaseEnvID}}.api.tcloudbasegateway.com/v1/ai/cloudbase",
"toolCalling": true,
"vision": true,
"maxInputTokens": 128000,
"maxOutputTokens": 16000
}
]
}
]
note

The apiKey field is automatically generated by Copilot and does not require manual modification. Fields such as toolCalling, vision, maxInputTokens, and maxOutputTokens can be adjusted as needed based on the capabilities of the model you are using.

  1. After completing the configuration, expand Other Models in the model list within the dialog box, select the custom model you created, and then you can start a conversation.