Skip to main content
This guide shows how to use models from the TrueFoundry AI Gateway in Visual Studio Code’s built-in chat. VS Code’s Custom Endpoint provider lets you bring your own models to chat, agent mode, and the model picker, and it can call the gateway over the OpenAI Chat Completions, OpenAI Responses, or Anthropic Messages API. You don’t need a GitHub account or a Copilot plan to use chat with your own models. If your organization already uses GitHub Copilot, see GitHub Copilot for organization-level BYOK and the Copilot CLI.

Prerequisites

  1. A TrueFoundry account with at least one model provider configured. See the Gateway quick start.
  2. A TrueFoundry API key. See Authentication.
  3. A recent stable release of VS Code.
Agent mode sends tool definitions on every request, so pick models that support tool calling and streaming. A context window of at least 128K tokens is recommended.

Add the gateway as a Custom Endpoint

1

Get your gateway base URL and model IDs

Open the AI Gateway playground and copy the base URL and model IDs from the unified code snippet. Model IDs use the provider-account/model format, for example openai-main/gpt-4o. See how to find the gateway base URL.
TrueFoundry playground showing the unified code snippet with the base URL and model name
2

Open Manage Language Models

Open the Command Palette (Cmd+Shift+P on macOS, Ctrl+Shift+P on Windows and Linux) and run Chat: Manage Language Models.
3

Add a Custom Endpoint

Click Add Models and choose Custom Endpoint. When prompted, enter:
  • Name: a name for the group of models, for example TrueFoundry.
  • API key: your TrueFoundry API key. VS Code keeps it in its secret storage, and the config file only holds a reference to it.
  • API type: Chat Completions. You can change the API type per model in the next step.
VS Code then opens chatLanguageModels.json with an empty model entry.
4

Add your models

Fill in the models array. Each model has its own url, which is the full gateway endpoint for its API type. Replace {GATEWAY_BASE_URL} with your gateway base URL and the model IDs with your own:
chatLanguageModels.json
Keep the apiKey value VS Code generated for you. It points to the key you entered in the previous step.
5

Pick a model in chat

Save the file, open the Chat view, and click the model picker. Your models appear under the TrueFoundry group. Select one and send a prompt in agent mode.If the models don’t appear, run Developer: Reload Window from the Command Palette.

Model fields

Route utility tasks through the gateway

Besides the main chat model, VS Code runs built-in utility flows on a separate utility model. When the main model is a Custom Endpoint model, utility flows default to GitHub Copilot’s models, so if you aren’t signed in to GitHub, VS Code shows a Set BYOK utility models notification in the Chat view. To send them through the gateway as well, click Configure on the notification, or add this to your user settings.json:
settings.json
To use a specific model for utility tasks instead, set Chat: Utility Model (chat.utilityModel) or Chat: Utility Small Model (chat.utilitySmallModel). Either one takes precedence over chat.byokUtilityModelDefault.

Verify in request logs

Open Request Logs in the TrueFoundry AI Gateway. Each model call is one request, so an agent turn that reads a file shows a tool-call request followed by the final answer. Requests from VS Code carry the application: vscode metadata from requestHeaders. Their user agent is GitHubCopilotChat, because VS Code’s built-in chat runs on the bundled Copilot Chat extension even when you aren’t signed in. See Request logging.

Limitations

  • Inline completions stay on GitHub. Ghost-text completions as you type can’t use a Custom Endpoint. They need a GitHub sign-in and always run on GitHub’s models.
  • Some workspace features need GitHub. Semantic codebase search and embeddings aren’t covered by Custom Endpoint models.
  • Copilot Business and Enterprise policies apply. If you sign in with a Copilot Business or Enterprise account, your admin can turn off bring-your-own-key models, and Custom Endpoint won’t be offered.

Connect MCP Gateway servers

VS Code reads remote MCP servers from .vscode/mcp.json in your workspace or from your user profile. To add servers from the TrueFoundry MCP Gateway, follow the VS Code tab in Connect MCP from your IDE. MCP works the same whichever model you pick, so you can combine gateway models and gateway MCP servers in one agent session.