# Bring your own key for GitHub Copilot

Use your existing LLM provider with GitHub Copilot to save costs or consolidate billing.

使用自带密钥（BYOK）后，您可以将 Copilot 与您选择的模型配合使用，例如在本地计算机上运行的模型或由外部提供商托管的模型。

有两种相互独立的机制可用于向 Copilot 提供你自己的 LLM 密钥。 一个允许用户在本地配置自己的模型，另一个允许用户和企业所有者为所有用户提供自定义模型。

## Local BYOK

Various Copilot clients allow users to configure custom LLM keys locally.

These keys are only handled client-side: they are stored locally and the associated models aren't available to other users. This mechanism removes dependency on GitHub's Copilot API, making it suitable for air-gapped environments or users without Copilot subscriptions.

Local BYOK is available in the following clients.

| Client             | More information                                                                                                                                                                                                         |
| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| VS Code            | [Add a model from a built in provider](https://code.visualstudio.com/docs/agent-customization/language-models#_add-a-model-from-a-built-in-provider) in the VS Code documentation                                        |
| JetBrains          | [Bring your own key (BYOK) support for JetBrains IDEs and Xcode](https://github.blog/changelog/2025-09-11-bring-your-own-key-byok-support-for-jetbrains-ides-and-xcode-in-public-preview/#try-it-out) on the GitHub Blog |
| Xcode              | [Bring your own key (BYOK) support for JetBrains IDEs and Xcode](https://github.blog/changelog/2025-09-11-bring-your-own-key-byok-support-for-jetbrains-ides-and-xcode-in-public-preview/#try-it-out) on the GitHub Blog |
| Copilot 命令行界面（CLI） | [在 GitHub Copilot CLI 中使用自己的 LLM 模型](/zh/enterprise-cloud@latest/copilot/how-tos/copilot-cli/customize-copilot/use-byok-models)                                                                                          |
| GitHub Copilot 应用  | [在 GitHub Copilot 应用中使用自己的 LLM 模型](/zh/enterprise-cloud@latest/copilot/how-tos/github-copilot-app/use-byok-models)                                                                                                       |
| Copilot SDK        | [BYOK （自带密钥）](/zh/enterprise-cloud@latest/copilot/how-tos/copilot-sdk/auth/byok)                                                                                                                                         |

For users on a Copilot业务 or Copilot Enterprise plan, the ability to use local BYOK in IDEs can be disabled by an enterprise or organization policy.

## Enterprise BYOK

> \[!NOTE]
> 此功能目前处于公开预览，可能会发生更改。

Enterprise owners can add keys for custom models in their enterprise settings. They can also allow organization owners to do the same in their organization settings, by enabling the **Enable custom models** policy.

Custom models are available in 副驾驶聊天、 Copilot 命令行界面（CLI）和 VS Code, and apply to users on the enterprise's Copilot业务 or Copilot Enterprise plan. Users can select them in the same way they would select a GitHub-hosted model.

Enterprise BYOK is handled server-side and affects the models served to users by the Copilot API. Users must have a Copilot license and internet access to use the custom models.

For more information, see [Enabling custom models for GitHub Copilot in your enterprise](/zh/enterprise-cloud@latest/copilot/how-tos/administer-copilot/manage-for-enterprise/enable-custom-models).