Configuring Custom AI Providers in VS Code
Visual Studio Codego watch the original →
the gist
VS Code now supports using third-party and local AI models directly via API keys, bypassing the need for a GitHub Copilot subscription.
Direct Model Integration
VS Code allows developers to bypass GitHub Copilot authentication by manually configuring language model providers. Users can access the "Manage Language Models" view to input API keys for native providers like Anthropic. Once configured, these models handle background tasks such as generating commit messages, renaming symbols, and providing chat responses. Developers can verify these connections by opening the "Chat Debug" view, which displays the raw API requests and responses sent to the provider endpoints.
Custom and Third-Party Endpoints
For models not natively supported, VS Code provides a custom endpoint configuration that maps to a chat-language-models.json file. This configuration file allows fine-grained control over model behavior, including:
- Setting input and output token constraints.
- Enabling or disabling specific capabilities like tool calling, vision, and thinking.
- Selecting the appropriate API format, such as Chat Completions or Messages.
Additionally, the editor supports third-party extensions, such as the Hugging Face provider, which can be installed via the marketplace. These extensions allow users to pull specific model repositories into the editor. To avoid cluttering the model picker, users can toggle the visibility of individual models within the provider settings.
Offline and Local Capabilities
Because these integrations rely on direct API keys rather than a centralized authentication service, they enable the use of local models. Developers can point VS Code to local inference servers, such as LM Studio, to maintain full functionality in air-gapped environments or while offline. All configured models, whether remote or local, are fully compatible with the VS Code agent harness.