Skip to content

Support variable interpolation in chatLanguageModels.json requestHeaders #329469

Open

Agent suggestions

Public preview

Description

Feature request

Support variable (template) interpolation in requestHeaders values of chatLanguageModels.json, so values can be dynamic per workspace — e.g. include the current repo/folder name in a custom header without editing the file per repo.

Motivation / Use case

With the Custom Endpoint (vendor: customendpoint) provider, I configure a gateway (LiteLLM) and want to tag every request with the repository it originates from:

{
  "name": "Example Vendor",
  "vendor": "customendpoint",
  "apiKey": "${input:chat.lm.secret.lalala}",
  "models": [
    {
      "id": "example/model",
      "url": "https://litellm.example.com",
      "requestHeaders": {
        "x-litellm-tags": "${workspaceFolderBasename}"
      }
    }
  ]
}

I want x-litellm-tags to resolve to the current repo name per workspace.

Current behavior

requestHeaders values are sent verbatim. I traced the path:

  • languageModelsConfigurationService.ts parses the JSON with a JSONVisitor — values taken literally.
  • languageModels.ts _resolveConfiguration() only resolves ${input:...} for properties marked secret: true in the schema (e.g. apiKey).
  • customEndpointProvider.ts copies requestHeaders verbatim into model info.
  • openAIEndpoint.ts _sanitizeCustomHeaders() filters names but does not interpolate values.
  • Only ${apiKey} is specially replaced (_interpolateApiKey).

So ${workspaceFolder}, ${workspaceFolderBasename}, ${env:FOO}, ${userHome} etc. are sent as literal strings.

Proposed change

Apply the same variable substitution already used by other config surfaces (tasks.json/launch.json via IConfigurationResolverService) to requestHeaders values — or at minimum support ${workspaceFolder}, ${workspaceFolderBasename}, ${userHome}, and ${env:VAR}.

At minimum a subset could be resolved: identical tokens to ${apiKey} but scoped to workspace/user/env.

Notes

  • macOS + VS Code 1.x, Dev Container remote extension host in use.
  • This is the chatLanguageModels.json BYOK custom-endpoint schema (requestHeaders), not the deprecated chat.customOAIModels setting.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions