Skip to content

Connect VS Code#

Connect VS Code to OptScale AI to use models available through the OptScale AI Gateway.

VS Code connects the model through the Custom Endpoint provider. The Custom Endpoint UI collects the provider name and API key, then opens chatLanguageModels.json so the model endpoint can be completed. Chat uses that model after it is selected in the model picker.

Prerequisites#

Before configuring VS Code, confirm that:

  • VS Code is installed.
  • An organization exists and at least one Active provider is configured.
  • Allowed providers are assigned to the user connecting VS Code to OptScale AI.
  • The OptScale AI deployment is accessible over HTTPS with a valid TLS certificate.

In Chat, copy Base URL, API key, and Model name from Connect this model to external tools → OPENAI-COMPATIBLE. For details, see Get connection values from Chat.

For shared model naming rules and limitations, see External Tools.

Add OptScale AI as a custom endpoint#

The steps below are based on VS Code for Linux. The same configuration applies to VS Code on other supported operating systems, although some menu or UI item names may differ slightly.

  1. Open the Language Models editor:

    • In the Chat view, open the model picker and select Manage Models.
    • Or open the Command Palette and run Chat: Manage Language Models.
  2. Click Add Models, then select Custom Endpoint.

  3. Enter a group name for the models, for example OptScale AI. This name is the provider label in the model picker.

  4. Enter a display name and the API key copied from the OPENAI-COMPATIBLE tab.

  5. Select Chat Completions as the API type. This OptScale AI connection uses Chat Completions.

  6. Complete the generated model entry in chatLanguageModels.json. VS Code opens this file after Custom Endpoint is configured.

    The generated configuration looks similar to the following:

    [
      {
        "name": "OptScale AI",
        "vendor": "customendpoint",
        "apiKey": "${input:chat.lm.secret.-1c736958}",
        "apiType": "chat-completions",
        "models": [
          {
            "id": "",
            "name": "",
            "url": "",
            "toolCalling": true,
            "vision": true,
            "maxInputTokens": 128000,
            "maxOutputTokens": 16000
          }
        ]
      }
    ]
    
  7. Set the model fields:

    • models[].id — enter the Model name copied from the OPENAI-COMPATIBLE tab.
    • models[].name — enter the name to display in the VS Code model picker, for example GPT-5.4 (OptScale AI).
    • models[].url — copy the Base URL from the OPENAI-COMPATIBLE tab and append /chat/completions.

    For example:

    [
      {
        "name": "OptScale AI",
        "vendor": "customendpoint",
        "apiKey": "${input:chat.lm.secret.-1c736958}",
        "apiType": "chat-completions",
        "models": [
          {
            "id": "openai_provider_00000000-0000-0000-0000-000000000000/gpt-5.4",
            "name": "GPT-5.4 (OptScale AI)",
            "url": "https://my.optscale.ai/llm_proxy/00000000-0000-0000-0000-000000000000/v1/chat/completions",
            "toolCalling": true,
            "vision": true,
            "maxInputTokens": 128000,
            "maxOutputTokens": 16000
          }
        ]
      }
    ]
    

    Note

    Do not replace the generated apiKey reference with the actual API key. VS Code stores the API key entered in Custom Endpoint in the operating system's secret storage and writes only its reference to chatLanguageModels.json.

  8. Save the file.

Select and verify the model#

  1. Open the VS Code Chat view.
  2. Open the model picker.
  3. Select the OptScale AI model. If the model does not appear in the model picker, restart VS Code.
  4. Send the following prompt:

    Reply with exactly: OptScale AI connection works.
    

    The expected response is:

    OptScale AI connection works.
    
  5. In the Admin Console, open Analytics → Traces and confirm that a row appears for the selected Provider and Model. Requester is the user for whom the connection was configured.

What is routed through OptScale AI#

The custom endpoint model is used for Chat when it is selected in the model picker. Inline chat and utility tasks keep their own models until they are configured separately. See Configure the model for other VS Code features.

Semantic search, inline suggestions, and features that use embeddings still require a GitHub account. Those features are not sent through the OptScale AI custom endpoint.

Configure the model for other VS Code features#

Utility tasks, such as title generation and commit messages, use built-in GitHub Copilot models until chat.utilityModel and chat.utilitySmallModel are set.

To use the OptScale AI model for inline chat and utility tasks, configure settings.json:

{
  "inlineChat.defaultModel": "<DISPLAY_NAME> (customendpoint)",
  "chat.utilityModel": "customendpoint/<MODEL_NAME>",
  "chat.utilitySmallModel": "customendpoint/<MODEL_NAME>"
}

These settings control:

  • inlineChat.defaultModel — the model used for inline chat.
  • chat.utilityModel — general utility tasks, such as titles and summaries.
  • chat.utilitySmallModel — lightweight utility tasks, such as commit messages and intent detection.

Use customendpoint/<MODEL_NAME> for chat.utilityModel and chat.utilitySmallModel. Use <DISPLAY_NAME> (customendpoint) for inlineChat.defaultModel. If the display name in chatLanguageModels.json changes, update inlineChat.defaultModel to match.

Self-signed certificates#

Deployments with a certificate issued by a public certificate authority and a public DNS name require no additional TLS configuration.

For internal deployments that use a self-signed certificate, add the cluster certificate to the operating system's trusted certificate store before configuring the custom endpoint.

Warning

Do not disable TLS certificate verification globally as a workaround.

See also#