Prerequisites
- A TrueFoundry account with at least one model provider configured. See the Gateway quick start.
- A TrueFoundry API key. See Authentication.
- A recent stable release of VS Code.
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.
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.
chatLanguageModels.json with an empty model entry.4
Add your models
Fill in the Keep 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
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 usersettings.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 theapplication: 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.