diff --git a/CHANGELOG.md b/CHANGELOG.md index edf2bf00..68787954 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Added multi-branch indexing support for Gerrit. [#433](https://github.com/sourcebot-dev/sourcebot/pull/433) - [ask sb] Added `reasoningEffort` option to OpenAI provider. [#446](https://github.com/sourcebot-dev/sourcebot/pull/446) +- [ask db] Added `headers` option to all providers. [#449](https://github.com/sourcebot-dev/sourcebot/pull/449) ### Fixed - Removed prefix from structured log output. [#443](https://github.com/sourcebot-dev/sourcebot/pull/443) diff --git a/docs/docs/configuration/language-model-providers.mdx b/docs/docs/configuration/language-model-providers.mdx index 514731ec..cb76be05 100644 --- a/docs/docs/configuration/language-model-providers.mdx +++ b/docs/docs/configuration/language-model-providers.mdx @@ -324,8 +324,34 @@ The OpenAI compatible provider allows you to use any model that is compatible wi } ``` +# Custom headers -## Schema reference +You can pass custom headers to the language model provider by using the `headers` parameter. Header values can either be a string or a environment variable. Headers are supported for all providers. + +```json wrap icon="code" Example config with custom headers +{ + "$schema": "https://raw.githubusercontent.com/sourcebot-dev/sourcebot/main/schemas/v3/index.json", + "models": [ + { + // ... provider, model, displayName, etc... + + // Key-value pairs of headers + "headers": { + // Header values can be passed as a environment variable... + "my-secret-header": { + "env": "MY_SECRET_HEADER_ENV_VAR" + }, + + // ... or directly as a string. + "my-non-secret-header": "plaintextvalue" + } + } + ] +} +``` + + +# Schema reference [schemas/v3/languageModel.json](https://github.com/sourcebot-dev/sourcebot/blob/main/schemas/v3/languageModel.json) diff --git a/docs/snippets/schemas/v3/index.schema.mdx b/docs/snippets/schemas/v3/index.schema.mdx index 6d64cc14..51600da2 100644 --- a/docs/snippets/schemas/v3/index.schema.mdx +++ b/docs/snippets/schemas/v3/index.schema.mdx @@ -1298,6 +1298,50 @@ "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -1322,7 +1366,6 @@ "description": "Optional display name." }, "token": { - "description": "Optional API key to use with the model. Defaults to the `ANTHROPIC_API_KEY` environment variable.", "anyOf": [ { "type": "object", @@ -1350,13 +1393,58 @@ ], "additionalProperties": false } - ] + ], + "description": "Optional API key to use with the model. Defaults to the `ANTHROPIC_API_KEY` environment variable." }, "baseUrl": { "type": "string", "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -1385,7 +1473,6 @@ "description": "Azure resource name. Defaults to the `AZURE_RESOURCE_NAME` environment variable." }, "token": { - "description": "Optional API key to use with the model. Defaults to the `AZURE_API_KEY` environment variable.", "anyOf": [ { "type": "object", @@ -1413,7 +1500,8 @@ ], "additionalProperties": false } - ] + ], + "description": "Optional API key to use with the model. Defaults to the `AZURE_API_KEY` environment variable." }, "apiVersion": { "type": "string", @@ -1424,6 +1512,50 @@ "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Use a different URL prefix for API calls. Either this or `resourceName` can be used." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -1448,7 +1580,6 @@ "description": "Optional display name." }, "token": { - "description": "Optional API key to use with the model. Defaults to the `DEEPSEEK_API_KEY` environment variable.", "anyOf": [ { "type": "object", @@ -1476,13 +1607,58 @@ ], "additionalProperties": false } - ] + ], + "description": "Optional API key to use with the model. Defaults to the `DEEPSEEK_API_KEY` environment variable." }, "baseUrl": { "type": "string", "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -1507,7 +1683,6 @@ "description": "Optional display name." }, "token": { - "description": "Optional API key to use with the model. Defaults to the `GOOGLE_GENERATIVE_AI_API_KEY` environment variable.", "anyOf": [ { "type": "object", @@ -1535,13 +1710,58 @@ ], "additionalProperties": false } - ] + ], + "description": "Optional API key to use with the model. Defaults to the `GOOGLE_GENERATIVE_AI_API_KEY` environment variable." }, "baseUrl": { "type": "string", "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -1582,7 +1802,6 @@ ] }, "credentials": { - "description": "Optional file path to service account credentials JSON. Defaults to the `GOOGLE_APPLICATION_CREDENTIALS` environment variable or application default credentials.", "anyOf": [ { "type": "object", @@ -1610,13 +1829,58 @@ ], "additionalProperties": false } - ] + ], + "description": "Optional file path to service account credentials JSON. Defaults to the `GOOGLE_APPLICATION_CREDENTIALS` environment variable or application default credentials." }, "baseUrl": { "type": "string", "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -1659,7 +1923,6 @@ ] }, "credentials": { - "description": "Optional file path to service account credentials JSON. Defaults to the `GOOGLE_APPLICATION_CREDENTIALS` environment variable or application default credentials.", "anyOf": [ { "type": "object", @@ -1687,13 +1950,58 @@ ], "additionalProperties": false } - ] + ], + "description": "Optional file path to service account credentials JSON. Defaults to the `GOOGLE_APPLICATION_CREDENTIALS` environment variable or application default credentials." }, "baseUrl": { "type": "string", "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -1718,7 +2026,6 @@ "description": "Optional display name." }, "token": { - "description": "Optional API key to use with the model. Defaults to the `MISTRAL_API_KEY` environment variable.", "anyOf": [ { "type": "object", @@ -1746,13 +2053,58 @@ ], "additionalProperties": false } - ] + ], + "description": "Optional API key to use with the model. Defaults to the `MISTRAL_API_KEY` environment variable." }, "baseUrl": { "type": "string", "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -1783,7 +2135,6 @@ "description": "Optional display name." }, "token": { - "description": "Optional API key to use with the model. Defaults to the `OPENAI_API_KEY` environment variable.", "anyOf": [ { "type": "object", @@ -1811,7 +2162,8 @@ ], "additionalProperties": false } - ] + ], + "description": "Optional API key to use with the model. Defaults to the `OPENAI_API_KEY` environment variable." }, "baseUrl": { "type": "string", @@ -1828,6 +2180,50 @@ "medium", "high" ] + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -1852,7 +2248,6 @@ "description": "Optional display name." }, "token": { - "description": "Optional API key. If specified, adds an `Authorization` header to request headers with the value Bearer .", "anyOf": [ { "type": "object", @@ -1880,7 +2275,8 @@ ], "additionalProperties": false } - ] + ], + "description": "Optional API key. If specified, adds an `Authorization` header to request headers with the value Bearer ." }, "baseUrl": { "type": "string", @@ -1890,6 +2286,50 @@ "examples": [ "http://localhost:8080/v1" ] + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -1915,7 +2355,6 @@ "description": "Optional display name." }, "token": { - "description": "Optional API key to use with the model. Defaults to the `OPENROUTER_API_KEY` environment variable.", "anyOf": [ { "type": "object", @@ -1943,13 +2382,58 @@ ], "additionalProperties": false } - ] + ], + "description": "Optional API key to use with the model. Defaults to the `OPENROUTER_API_KEY` environment variable." }, "baseUrl": { "type": "string", "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -1978,7 +2462,6 @@ "description": "Optional display name." }, "token": { - "description": "Optional API key to use with the model. Defaults to the `XAI_API_KEY` environment variable.", "anyOf": [ { "type": "object", @@ -2006,13 +2489,58 @@ ], "additionalProperties": false } - ] + ], + "description": "Optional API key to use with the model. Defaults to the `XAI_API_KEY` environment variable." }, "baseUrl": { "type": "string", "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -2114,6 +2642,50 @@ "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -2138,7 +2710,6 @@ "description": "Optional display name." }, "token": { - "description": "Optional API key to use with the model. Defaults to the `ANTHROPIC_API_KEY` environment variable.", "anyOf": [ { "type": "object", @@ -2166,13 +2737,58 @@ ], "additionalProperties": false } - ] + ], + "description": "Optional API key to use with the model. Defaults to the `ANTHROPIC_API_KEY` environment variable." }, "baseUrl": { "type": "string", "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -2201,7 +2817,6 @@ "description": "Azure resource name. Defaults to the `AZURE_RESOURCE_NAME` environment variable." }, "token": { - "description": "Optional API key to use with the model. Defaults to the `AZURE_API_KEY` environment variable.", "anyOf": [ { "type": "object", @@ -2229,7 +2844,8 @@ ], "additionalProperties": false } - ] + ], + "description": "Optional API key to use with the model. Defaults to the `AZURE_API_KEY` environment variable." }, "apiVersion": { "type": "string", @@ -2240,6 +2856,50 @@ "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Use a different URL prefix for API calls. Either this or `resourceName` can be used." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -2264,7 +2924,6 @@ "description": "Optional display name." }, "token": { - "description": "Optional API key to use with the model. Defaults to the `DEEPSEEK_API_KEY` environment variable.", "anyOf": [ { "type": "object", @@ -2292,13 +2951,58 @@ ], "additionalProperties": false } - ] + ], + "description": "Optional API key to use with the model. Defaults to the `DEEPSEEK_API_KEY` environment variable." }, "baseUrl": { "type": "string", "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -2323,7 +3027,6 @@ "description": "Optional display name." }, "token": { - "description": "Optional API key to use with the model. Defaults to the `GOOGLE_GENERATIVE_AI_API_KEY` environment variable.", "anyOf": [ { "type": "object", @@ -2351,13 +3054,58 @@ ], "additionalProperties": false } - ] + ], + "description": "Optional API key to use with the model. Defaults to the `GOOGLE_GENERATIVE_AI_API_KEY` environment variable." }, "baseUrl": { "type": "string", "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -2398,7 +3146,6 @@ ] }, "credentials": { - "description": "Optional file path to service account credentials JSON. Defaults to the `GOOGLE_APPLICATION_CREDENTIALS` environment variable or application default credentials.", "anyOf": [ { "type": "object", @@ -2426,13 +3173,58 @@ ], "additionalProperties": false } - ] + ], + "description": "Optional file path to service account credentials JSON. Defaults to the `GOOGLE_APPLICATION_CREDENTIALS` environment variable or application default credentials." }, "baseUrl": { "type": "string", "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -2475,7 +3267,6 @@ ] }, "credentials": { - "description": "Optional file path to service account credentials JSON. Defaults to the `GOOGLE_APPLICATION_CREDENTIALS` environment variable or application default credentials.", "anyOf": [ { "type": "object", @@ -2503,13 +3294,58 @@ ], "additionalProperties": false } - ] + ], + "description": "Optional file path to service account credentials JSON. Defaults to the `GOOGLE_APPLICATION_CREDENTIALS` environment variable or application default credentials." }, "baseUrl": { "type": "string", "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -2534,7 +3370,6 @@ "description": "Optional display name." }, "token": { - "description": "Optional API key to use with the model. Defaults to the `MISTRAL_API_KEY` environment variable.", "anyOf": [ { "type": "object", @@ -2562,13 +3397,58 @@ ], "additionalProperties": false } - ] + ], + "description": "Optional API key to use with the model. Defaults to the `MISTRAL_API_KEY` environment variable." }, "baseUrl": { "type": "string", "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -2599,7 +3479,6 @@ "description": "Optional display name." }, "token": { - "description": "Optional API key to use with the model. Defaults to the `OPENAI_API_KEY` environment variable.", "anyOf": [ { "type": "object", @@ -2627,7 +3506,8 @@ ], "additionalProperties": false } - ] + ], + "description": "Optional API key to use with the model. Defaults to the `OPENAI_API_KEY` environment variable." }, "baseUrl": { "type": "string", @@ -2644,6 +3524,50 @@ "medium", "high" ] + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -2668,7 +3592,6 @@ "description": "Optional display name." }, "token": { - "description": "Optional API key. If specified, adds an `Authorization` header to request headers with the value Bearer .", "anyOf": [ { "type": "object", @@ -2696,7 +3619,8 @@ ], "additionalProperties": false } - ] + ], + "description": "Optional API key. If specified, adds an `Authorization` header to request headers with the value Bearer ." }, "baseUrl": { "type": "string", @@ -2706,6 +3630,50 @@ "examples": [ "http://localhost:8080/v1" ] + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -2731,7 +3699,6 @@ "description": "Optional display name." }, "token": { - "description": "Optional API key to use with the model. Defaults to the `OPENROUTER_API_KEY` environment variable.", "anyOf": [ { "type": "object", @@ -2759,13 +3726,58 @@ ], "additionalProperties": false } - ] + ], + "description": "Optional API key to use with the model. Defaults to the `OPENROUTER_API_KEY` environment variable." }, "baseUrl": { "type": "string", "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -2794,7 +3806,6 @@ "description": "Optional display name." }, "token": { - "description": "Optional API key to use with the model. Defaults to the `XAI_API_KEY` environment variable.", "anyOf": [ { "type": "object", @@ -2822,13 +3833,58 @@ ], "additionalProperties": false } - ] + ], + "description": "Optional API key to use with the model. Defaults to the `XAI_API_KEY` environment variable." }, "baseUrl": { "type": "string", "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ diff --git a/docs/snippets/schemas/v3/languageModel.schema.mdx b/docs/snippets/schemas/v3/languageModel.schema.mdx index f23ea8b9..22785e7c 100644 --- a/docs/snippets/schemas/v3/languageModel.schema.mdx +++ b/docs/snippets/schemas/v3/languageModel.schema.mdx @@ -95,6 +95,50 @@ "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -119,7 +163,6 @@ "description": "Optional display name." }, "token": { - "description": "Optional API key to use with the model. Defaults to the `ANTHROPIC_API_KEY` environment variable.", "anyOf": [ { "type": "object", @@ -147,13 +190,58 @@ ], "additionalProperties": false } - ] + ], + "description": "Optional API key to use with the model. Defaults to the `ANTHROPIC_API_KEY` environment variable." }, "baseUrl": { "type": "string", "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -182,7 +270,6 @@ "description": "Azure resource name. Defaults to the `AZURE_RESOURCE_NAME` environment variable." }, "token": { - "description": "Optional API key to use with the model. Defaults to the `AZURE_API_KEY` environment variable.", "anyOf": [ { "type": "object", @@ -210,7 +297,8 @@ ], "additionalProperties": false } - ] + ], + "description": "Optional API key to use with the model. Defaults to the `AZURE_API_KEY` environment variable." }, "apiVersion": { "type": "string", @@ -221,6 +309,50 @@ "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Use a different URL prefix for API calls. Either this or `resourceName` can be used." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -245,7 +377,6 @@ "description": "Optional display name." }, "token": { - "description": "Optional API key to use with the model. Defaults to the `DEEPSEEK_API_KEY` environment variable.", "anyOf": [ { "type": "object", @@ -273,13 +404,58 @@ ], "additionalProperties": false } - ] + ], + "description": "Optional API key to use with the model. Defaults to the `DEEPSEEK_API_KEY` environment variable." }, "baseUrl": { "type": "string", "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -304,7 +480,6 @@ "description": "Optional display name." }, "token": { - "description": "Optional API key to use with the model. Defaults to the `GOOGLE_GENERATIVE_AI_API_KEY` environment variable.", "anyOf": [ { "type": "object", @@ -332,13 +507,58 @@ ], "additionalProperties": false } - ] + ], + "description": "Optional API key to use with the model. Defaults to the `GOOGLE_GENERATIVE_AI_API_KEY` environment variable." }, "baseUrl": { "type": "string", "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -379,7 +599,6 @@ ] }, "credentials": { - "description": "Optional file path to service account credentials JSON. Defaults to the `GOOGLE_APPLICATION_CREDENTIALS` environment variable or application default credentials.", "anyOf": [ { "type": "object", @@ -407,13 +626,58 @@ ], "additionalProperties": false } - ] + ], + "description": "Optional file path to service account credentials JSON. Defaults to the `GOOGLE_APPLICATION_CREDENTIALS` environment variable or application default credentials." }, "baseUrl": { "type": "string", "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -456,7 +720,6 @@ ] }, "credentials": { - "description": "Optional file path to service account credentials JSON. Defaults to the `GOOGLE_APPLICATION_CREDENTIALS` environment variable or application default credentials.", "anyOf": [ { "type": "object", @@ -484,13 +747,58 @@ ], "additionalProperties": false } - ] + ], + "description": "Optional file path to service account credentials JSON. Defaults to the `GOOGLE_APPLICATION_CREDENTIALS` environment variable or application default credentials." }, "baseUrl": { "type": "string", "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -515,7 +823,6 @@ "description": "Optional display name." }, "token": { - "description": "Optional API key to use with the model. Defaults to the `MISTRAL_API_KEY` environment variable.", "anyOf": [ { "type": "object", @@ -543,13 +850,58 @@ ], "additionalProperties": false } - ] + ], + "description": "Optional API key to use with the model. Defaults to the `MISTRAL_API_KEY` environment variable." }, "baseUrl": { "type": "string", "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -580,7 +932,6 @@ "description": "Optional display name." }, "token": { - "description": "Optional API key to use with the model. Defaults to the `OPENAI_API_KEY` environment variable.", "anyOf": [ { "type": "object", @@ -608,7 +959,8 @@ ], "additionalProperties": false } - ] + ], + "description": "Optional API key to use with the model. Defaults to the `OPENAI_API_KEY` environment variable." }, "baseUrl": { "type": "string", @@ -625,6 +977,50 @@ "medium", "high" ] + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -649,7 +1045,6 @@ "description": "Optional display name." }, "token": { - "description": "Optional API key. If specified, adds an `Authorization` header to request headers with the value Bearer .", "anyOf": [ { "type": "object", @@ -677,7 +1072,8 @@ ], "additionalProperties": false } - ] + ], + "description": "Optional API key. If specified, adds an `Authorization` header to request headers with the value Bearer ." }, "baseUrl": { "type": "string", @@ -687,6 +1083,50 @@ "examples": [ "http://localhost:8080/v1" ] + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -712,7 +1152,6 @@ "description": "Optional display name." }, "token": { - "description": "Optional API key to use with the model. Defaults to the `OPENROUTER_API_KEY` environment variable.", "anyOf": [ { "type": "object", @@ -740,13 +1179,58 @@ ], "additionalProperties": false } - ] + ], + "description": "Optional API key to use with the model. Defaults to the `OPENROUTER_API_KEY` environment variable." }, "baseUrl": { "type": "string", "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -775,7 +1259,6 @@ "description": "Optional display name." }, "token": { - "description": "Optional API key to use with the model. Defaults to the `XAI_API_KEY` environment variable.", "anyOf": [ { "type": "object", @@ -803,13 +1286,58 @@ ], "additionalProperties": false } - ] + ], + "description": "Optional API key to use with the model. Defaults to the `XAI_API_KEY` environment variable." }, "baseUrl": { "type": "string", "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -911,6 +1439,50 @@ "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -935,7 +1507,6 @@ "description": "Optional display name." }, "token": { - "description": "Optional API key to use with the model. Defaults to the `ANTHROPIC_API_KEY` environment variable.", "anyOf": [ { "type": "object", @@ -963,13 +1534,58 @@ ], "additionalProperties": false } - ] + ], + "description": "Optional API key to use with the model. Defaults to the `ANTHROPIC_API_KEY` environment variable." }, "baseUrl": { "type": "string", "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -998,7 +1614,6 @@ "description": "Azure resource name. Defaults to the `AZURE_RESOURCE_NAME` environment variable." }, "token": { - "description": "Optional API key to use with the model. Defaults to the `AZURE_API_KEY` environment variable.", "anyOf": [ { "type": "object", @@ -1026,7 +1641,8 @@ ], "additionalProperties": false } - ] + ], + "description": "Optional API key to use with the model. Defaults to the `AZURE_API_KEY` environment variable." }, "apiVersion": { "type": "string", @@ -1037,6 +1653,50 @@ "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Use a different URL prefix for API calls. Either this or `resourceName` can be used." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -1061,7 +1721,6 @@ "description": "Optional display name." }, "token": { - "description": "Optional API key to use with the model. Defaults to the `DEEPSEEK_API_KEY` environment variable.", "anyOf": [ { "type": "object", @@ -1089,13 +1748,58 @@ ], "additionalProperties": false } - ] + ], + "description": "Optional API key to use with the model. Defaults to the `DEEPSEEK_API_KEY` environment variable." }, "baseUrl": { "type": "string", "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -1120,7 +1824,6 @@ "description": "Optional display name." }, "token": { - "description": "Optional API key to use with the model. Defaults to the `GOOGLE_GENERATIVE_AI_API_KEY` environment variable.", "anyOf": [ { "type": "object", @@ -1148,13 +1851,58 @@ ], "additionalProperties": false } - ] + ], + "description": "Optional API key to use with the model. Defaults to the `GOOGLE_GENERATIVE_AI_API_KEY` environment variable." }, "baseUrl": { "type": "string", "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -1195,7 +1943,6 @@ ] }, "credentials": { - "description": "Optional file path to service account credentials JSON. Defaults to the `GOOGLE_APPLICATION_CREDENTIALS` environment variable or application default credentials.", "anyOf": [ { "type": "object", @@ -1223,13 +1970,58 @@ ], "additionalProperties": false } - ] + ], + "description": "Optional file path to service account credentials JSON. Defaults to the `GOOGLE_APPLICATION_CREDENTIALS` environment variable or application default credentials." }, "baseUrl": { "type": "string", "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -1272,7 +2064,6 @@ ] }, "credentials": { - "description": "Optional file path to service account credentials JSON. Defaults to the `GOOGLE_APPLICATION_CREDENTIALS` environment variable or application default credentials.", "anyOf": [ { "type": "object", @@ -1300,13 +2091,58 @@ ], "additionalProperties": false } - ] + ], + "description": "Optional file path to service account credentials JSON. Defaults to the `GOOGLE_APPLICATION_CREDENTIALS` environment variable or application default credentials." }, "baseUrl": { "type": "string", "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -1331,7 +2167,6 @@ "description": "Optional display name." }, "token": { - "description": "Optional API key to use with the model. Defaults to the `MISTRAL_API_KEY` environment variable.", "anyOf": [ { "type": "object", @@ -1359,13 +2194,58 @@ ], "additionalProperties": false } - ] + ], + "description": "Optional API key to use with the model. Defaults to the `MISTRAL_API_KEY` environment variable." }, "baseUrl": { "type": "string", "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -1396,7 +2276,6 @@ "description": "Optional display name." }, "token": { - "description": "Optional API key to use with the model. Defaults to the `OPENAI_API_KEY` environment variable.", "anyOf": [ { "type": "object", @@ -1424,7 +2303,8 @@ ], "additionalProperties": false } - ] + ], + "description": "Optional API key to use with the model. Defaults to the `OPENAI_API_KEY` environment variable." }, "baseUrl": { "type": "string", @@ -1441,6 +2321,50 @@ "medium", "high" ] + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -1465,7 +2389,6 @@ "description": "Optional display name." }, "token": { - "description": "Optional API key. If specified, adds an `Authorization` header to request headers with the value Bearer .", "anyOf": [ { "type": "object", @@ -1493,7 +2416,8 @@ ], "additionalProperties": false } - ] + ], + "description": "Optional API key. If specified, adds an `Authorization` header to request headers with the value Bearer ." }, "baseUrl": { "type": "string", @@ -1503,6 +2427,50 @@ "examples": [ "http://localhost:8080/v1" ] + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -1528,7 +2496,6 @@ "description": "Optional display name." }, "token": { - "description": "Optional API key to use with the model. Defaults to the `OPENROUTER_API_KEY` environment variable.", "anyOf": [ { "type": "object", @@ -1556,13 +2523,58 @@ ], "additionalProperties": false } - ] + ], + "description": "Optional API key to use with the model. Defaults to the `OPENROUTER_API_KEY` environment variable." }, "baseUrl": { "type": "string", "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -1591,7 +2603,6 @@ "description": "Optional display name." }, "token": { - "description": "Optional API key to use with the model. Defaults to the `XAI_API_KEY` environment variable.", "anyOf": [ { "type": "object", @@ -1619,13 +2630,58 @@ ], "additionalProperties": false } - ] + ], + "description": "Optional API key to use with the model. Defaults to the `XAI_API_KEY` environment variable." }, "baseUrl": { "type": "string", "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ diff --git a/docs/snippets/schemas/v3/shared.schema.mdx b/docs/snippets/schemas/v3/shared.schema.mdx index 97fdbabf..f31a0936 100644 --- a/docs/snippets/schemas/v3/shared.schema.mdx +++ b/docs/snippets/schemas/v3/shared.schema.mdx @@ -74,6 +74,50 @@ } }, "additionalProperties": false + }, + "LanguageModelHeaders": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } } } diff --git a/packages/schemas/src/v3/index.schema.ts b/packages/schemas/src/v3/index.schema.ts index 5b0bf21a..804093fb 100644 --- a/packages/schemas/src/v3/index.schema.ts +++ b/packages/schemas/src/v3/index.schema.ts @@ -1297,6 +1297,50 @@ const schema = { "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -1321,7 +1365,6 @@ const schema = { "description": "Optional display name." }, "token": { - "description": "Optional API key to use with the model. Defaults to the `ANTHROPIC_API_KEY` environment variable.", "anyOf": [ { "type": "object", @@ -1349,13 +1392,58 @@ const schema = { ], "additionalProperties": false } - ] + ], + "description": "Optional API key to use with the model. Defaults to the `ANTHROPIC_API_KEY` environment variable." }, "baseUrl": { "type": "string", "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -1384,7 +1472,6 @@ const schema = { "description": "Azure resource name. Defaults to the `AZURE_RESOURCE_NAME` environment variable." }, "token": { - "description": "Optional API key to use with the model. Defaults to the `AZURE_API_KEY` environment variable.", "anyOf": [ { "type": "object", @@ -1412,7 +1499,8 @@ const schema = { ], "additionalProperties": false } - ] + ], + "description": "Optional API key to use with the model. Defaults to the `AZURE_API_KEY` environment variable." }, "apiVersion": { "type": "string", @@ -1423,6 +1511,50 @@ const schema = { "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Use a different URL prefix for API calls. Either this or `resourceName` can be used." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -1447,7 +1579,6 @@ const schema = { "description": "Optional display name." }, "token": { - "description": "Optional API key to use with the model. Defaults to the `DEEPSEEK_API_KEY` environment variable.", "anyOf": [ { "type": "object", @@ -1475,13 +1606,58 @@ const schema = { ], "additionalProperties": false } - ] + ], + "description": "Optional API key to use with the model. Defaults to the `DEEPSEEK_API_KEY` environment variable." }, "baseUrl": { "type": "string", "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -1506,7 +1682,6 @@ const schema = { "description": "Optional display name." }, "token": { - "description": "Optional API key to use with the model. Defaults to the `GOOGLE_GENERATIVE_AI_API_KEY` environment variable.", "anyOf": [ { "type": "object", @@ -1534,13 +1709,58 @@ const schema = { ], "additionalProperties": false } - ] + ], + "description": "Optional API key to use with the model. Defaults to the `GOOGLE_GENERATIVE_AI_API_KEY` environment variable." }, "baseUrl": { "type": "string", "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -1581,7 +1801,6 @@ const schema = { ] }, "credentials": { - "description": "Optional file path to service account credentials JSON. Defaults to the `GOOGLE_APPLICATION_CREDENTIALS` environment variable or application default credentials.", "anyOf": [ { "type": "object", @@ -1609,13 +1828,58 @@ const schema = { ], "additionalProperties": false } - ] + ], + "description": "Optional file path to service account credentials JSON. Defaults to the `GOOGLE_APPLICATION_CREDENTIALS` environment variable or application default credentials." }, "baseUrl": { "type": "string", "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -1658,7 +1922,6 @@ const schema = { ] }, "credentials": { - "description": "Optional file path to service account credentials JSON. Defaults to the `GOOGLE_APPLICATION_CREDENTIALS` environment variable or application default credentials.", "anyOf": [ { "type": "object", @@ -1686,13 +1949,58 @@ const schema = { ], "additionalProperties": false } - ] + ], + "description": "Optional file path to service account credentials JSON. Defaults to the `GOOGLE_APPLICATION_CREDENTIALS` environment variable or application default credentials." }, "baseUrl": { "type": "string", "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -1717,7 +2025,6 @@ const schema = { "description": "Optional display name." }, "token": { - "description": "Optional API key to use with the model. Defaults to the `MISTRAL_API_KEY` environment variable.", "anyOf": [ { "type": "object", @@ -1745,13 +2052,58 @@ const schema = { ], "additionalProperties": false } - ] + ], + "description": "Optional API key to use with the model. Defaults to the `MISTRAL_API_KEY` environment variable." }, "baseUrl": { "type": "string", "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -1782,7 +2134,6 @@ const schema = { "description": "Optional display name." }, "token": { - "description": "Optional API key to use with the model. Defaults to the `OPENAI_API_KEY` environment variable.", "anyOf": [ { "type": "object", @@ -1810,7 +2161,8 @@ const schema = { ], "additionalProperties": false } - ] + ], + "description": "Optional API key to use with the model. Defaults to the `OPENAI_API_KEY` environment variable." }, "baseUrl": { "type": "string", @@ -1827,6 +2179,50 @@ const schema = { "medium", "high" ] + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -1851,7 +2247,6 @@ const schema = { "description": "Optional display name." }, "token": { - "description": "Optional API key. If specified, adds an `Authorization` header to request headers with the value Bearer .", "anyOf": [ { "type": "object", @@ -1879,7 +2274,8 @@ const schema = { ], "additionalProperties": false } - ] + ], + "description": "Optional API key. If specified, adds an `Authorization` header to request headers with the value Bearer ." }, "baseUrl": { "type": "string", @@ -1889,6 +2285,50 @@ const schema = { "examples": [ "http://localhost:8080/v1" ] + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -1914,7 +2354,6 @@ const schema = { "description": "Optional display name." }, "token": { - "description": "Optional API key to use with the model. Defaults to the `OPENROUTER_API_KEY` environment variable.", "anyOf": [ { "type": "object", @@ -1942,13 +2381,58 @@ const schema = { ], "additionalProperties": false } - ] + ], + "description": "Optional API key to use with the model. Defaults to the `OPENROUTER_API_KEY` environment variable." }, "baseUrl": { "type": "string", "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -1977,7 +2461,6 @@ const schema = { "description": "Optional display name." }, "token": { - "description": "Optional API key to use with the model. Defaults to the `XAI_API_KEY` environment variable.", "anyOf": [ { "type": "object", @@ -2005,13 +2488,58 @@ const schema = { ], "additionalProperties": false } - ] + ], + "description": "Optional API key to use with the model. Defaults to the `XAI_API_KEY` environment variable." }, "baseUrl": { "type": "string", "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -2113,6 +2641,50 @@ const schema = { "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -2137,7 +2709,6 @@ const schema = { "description": "Optional display name." }, "token": { - "description": "Optional API key to use with the model. Defaults to the `ANTHROPIC_API_KEY` environment variable.", "anyOf": [ { "type": "object", @@ -2165,13 +2736,58 @@ const schema = { ], "additionalProperties": false } - ] + ], + "description": "Optional API key to use with the model. Defaults to the `ANTHROPIC_API_KEY` environment variable." }, "baseUrl": { "type": "string", "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -2200,7 +2816,6 @@ const schema = { "description": "Azure resource name. Defaults to the `AZURE_RESOURCE_NAME` environment variable." }, "token": { - "description": "Optional API key to use with the model. Defaults to the `AZURE_API_KEY` environment variable.", "anyOf": [ { "type": "object", @@ -2228,7 +2843,8 @@ const schema = { ], "additionalProperties": false } - ] + ], + "description": "Optional API key to use with the model. Defaults to the `AZURE_API_KEY` environment variable." }, "apiVersion": { "type": "string", @@ -2239,6 +2855,50 @@ const schema = { "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Use a different URL prefix for API calls. Either this or `resourceName` can be used." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -2263,7 +2923,6 @@ const schema = { "description": "Optional display name." }, "token": { - "description": "Optional API key to use with the model. Defaults to the `DEEPSEEK_API_KEY` environment variable.", "anyOf": [ { "type": "object", @@ -2291,13 +2950,58 @@ const schema = { ], "additionalProperties": false } - ] + ], + "description": "Optional API key to use with the model. Defaults to the `DEEPSEEK_API_KEY` environment variable." }, "baseUrl": { "type": "string", "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -2322,7 +3026,6 @@ const schema = { "description": "Optional display name." }, "token": { - "description": "Optional API key to use with the model. Defaults to the `GOOGLE_GENERATIVE_AI_API_KEY` environment variable.", "anyOf": [ { "type": "object", @@ -2350,13 +3053,58 @@ const schema = { ], "additionalProperties": false } - ] + ], + "description": "Optional API key to use with the model. Defaults to the `GOOGLE_GENERATIVE_AI_API_KEY` environment variable." }, "baseUrl": { "type": "string", "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -2397,7 +3145,6 @@ const schema = { ] }, "credentials": { - "description": "Optional file path to service account credentials JSON. Defaults to the `GOOGLE_APPLICATION_CREDENTIALS` environment variable or application default credentials.", "anyOf": [ { "type": "object", @@ -2425,13 +3172,58 @@ const schema = { ], "additionalProperties": false } - ] + ], + "description": "Optional file path to service account credentials JSON. Defaults to the `GOOGLE_APPLICATION_CREDENTIALS` environment variable or application default credentials." }, "baseUrl": { "type": "string", "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -2474,7 +3266,6 @@ const schema = { ] }, "credentials": { - "description": "Optional file path to service account credentials JSON. Defaults to the `GOOGLE_APPLICATION_CREDENTIALS` environment variable or application default credentials.", "anyOf": [ { "type": "object", @@ -2502,13 +3293,58 @@ const schema = { ], "additionalProperties": false } - ] + ], + "description": "Optional file path to service account credentials JSON. Defaults to the `GOOGLE_APPLICATION_CREDENTIALS` environment variable or application default credentials." }, "baseUrl": { "type": "string", "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -2533,7 +3369,6 @@ const schema = { "description": "Optional display name." }, "token": { - "description": "Optional API key to use with the model. Defaults to the `MISTRAL_API_KEY` environment variable.", "anyOf": [ { "type": "object", @@ -2561,13 +3396,58 @@ const schema = { ], "additionalProperties": false } - ] + ], + "description": "Optional API key to use with the model. Defaults to the `MISTRAL_API_KEY` environment variable." }, "baseUrl": { "type": "string", "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -2598,7 +3478,6 @@ const schema = { "description": "Optional display name." }, "token": { - "description": "Optional API key to use with the model. Defaults to the `OPENAI_API_KEY` environment variable.", "anyOf": [ { "type": "object", @@ -2626,7 +3505,8 @@ const schema = { ], "additionalProperties": false } - ] + ], + "description": "Optional API key to use with the model. Defaults to the `OPENAI_API_KEY` environment variable." }, "baseUrl": { "type": "string", @@ -2643,6 +3523,50 @@ const schema = { "medium", "high" ] + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -2667,7 +3591,6 @@ const schema = { "description": "Optional display name." }, "token": { - "description": "Optional API key. If specified, adds an `Authorization` header to request headers with the value Bearer .", "anyOf": [ { "type": "object", @@ -2695,7 +3618,8 @@ const schema = { ], "additionalProperties": false } - ] + ], + "description": "Optional API key. If specified, adds an `Authorization` header to request headers with the value Bearer ." }, "baseUrl": { "type": "string", @@ -2705,6 +3629,50 @@ const schema = { "examples": [ "http://localhost:8080/v1" ] + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -2730,7 +3698,6 @@ const schema = { "description": "Optional display name." }, "token": { - "description": "Optional API key to use with the model. Defaults to the `OPENROUTER_API_KEY` environment variable.", "anyOf": [ { "type": "object", @@ -2758,13 +3725,58 @@ const schema = { ], "additionalProperties": false } - ] + ], + "description": "Optional API key to use with the model. Defaults to the `OPENROUTER_API_KEY` environment variable." }, "baseUrl": { "type": "string", "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -2793,7 +3805,6 @@ const schema = { "description": "Optional display name." }, "token": { - "description": "Optional API key to use with the model. Defaults to the `XAI_API_KEY` environment variable.", "anyOf": [ { "type": "object", @@ -2821,13 +3832,58 @@ const schema = { ], "additionalProperties": false } - ] + ], + "description": "Optional API key to use with the model. Defaults to the `XAI_API_KEY` environment variable." }, "baseUrl": { "type": "string", "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ diff --git a/packages/schemas/src/v3/index.type.ts b/packages/schemas/src/v3/index.type.ts index bad1219a..85dc22b2 100644 --- a/packages/schemas/src/v3/index.type.ts +++ b/packages/schemas/src/v3/index.type.ts @@ -496,6 +496,32 @@ export interface AmazonBedrockLanguageModel { * Optional base URL. */ baseUrl?: string; + headers?: LanguageModelHeaders; +} +/** + * Optional headers to use with the model. + */ +export interface LanguageModelHeaders { + /** + * This interface was referenced by `LanguageModelHeaders`'s JSON-Schema definition + * via the `patternProperty` "^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$". + */ + [k: string]: + | string + | ( + | { + /** + * The name of the secret that contains the token. + */ + secret: string; + } + | { + /** + * The name of the environment variable that contains the token. Only supported in declarative connection configs. + */ + env: string; + } + ); } export interface AnthropicLanguageModel { /** @@ -530,6 +556,7 @@ export interface AnthropicLanguageModel { * Optional base URL. */ baseUrl?: string; + headers?: LanguageModelHeaders; } export interface AzureLanguageModel { /** @@ -572,6 +599,7 @@ export interface AzureLanguageModel { * Use a different URL prefix for API calls. Either this or `resourceName` can be used. */ baseUrl?: string; + headers?: LanguageModelHeaders; } export interface DeepSeekLanguageModel { /** @@ -606,6 +634,7 @@ export interface DeepSeekLanguageModel { * Optional base URL. */ baseUrl?: string; + headers?: LanguageModelHeaders; } export interface GoogleGenerativeAILanguageModel { /** @@ -640,6 +669,7 @@ export interface GoogleGenerativeAILanguageModel { * Optional base URL. */ baseUrl?: string; + headers?: LanguageModelHeaders; } export interface GoogleVertexAnthropicLanguageModel { /** @@ -682,6 +712,7 @@ export interface GoogleVertexAnthropicLanguageModel { * Optional base URL. */ baseUrl?: string; + headers?: LanguageModelHeaders; } export interface GoogleVertexLanguageModel { /** @@ -724,6 +755,7 @@ export interface GoogleVertexLanguageModel { * Optional base URL. */ baseUrl?: string; + headers?: LanguageModelHeaders; } export interface MistralLanguageModel { /** @@ -758,6 +790,7 @@ export interface MistralLanguageModel { * Optional base URL. */ baseUrl?: string; + headers?: LanguageModelHeaders; } export interface OpenAILanguageModel { /** @@ -796,6 +829,7 @@ export interface OpenAILanguageModel { * The reasoning effort to use with the model. Defaults to `medium`. See https://platform.openai.com/docs/guides/reasoning#get-started-with-reasonings */ reasoningEffort?: string; + headers?: LanguageModelHeaders; } export interface OpenAICompatibleLanguageModel { /** @@ -830,6 +864,7 @@ export interface OpenAICompatibleLanguageModel { * Base URL of the OpenAI-compatible chat completions API endpoint. */ baseUrl: string; + headers?: LanguageModelHeaders; } export interface OpenRouterLanguageModel { /** @@ -864,6 +899,7 @@ export interface OpenRouterLanguageModel { * Optional base URL. */ baseUrl?: string; + headers?: LanguageModelHeaders; } export interface XaiLanguageModel { /** @@ -898,4 +934,5 @@ export interface XaiLanguageModel { * Optional base URL. */ baseUrl?: string; + headers?: LanguageModelHeaders; } diff --git a/packages/schemas/src/v3/languageModel.schema.ts b/packages/schemas/src/v3/languageModel.schema.ts index 075f2777..8142fcae 100644 --- a/packages/schemas/src/v3/languageModel.schema.ts +++ b/packages/schemas/src/v3/languageModel.schema.ts @@ -94,6 +94,50 @@ const schema = { "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -118,7 +162,6 @@ const schema = { "description": "Optional display name." }, "token": { - "description": "Optional API key to use with the model. Defaults to the `ANTHROPIC_API_KEY` environment variable.", "anyOf": [ { "type": "object", @@ -146,13 +189,58 @@ const schema = { ], "additionalProperties": false } - ] + ], + "description": "Optional API key to use with the model. Defaults to the `ANTHROPIC_API_KEY` environment variable." }, "baseUrl": { "type": "string", "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -181,7 +269,6 @@ const schema = { "description": "Azure resource name. Defaults to the `AZURE_RESOURCE_NAME` environment variable." }, "token": { - "description": "Optional API key to use with the model. Defaults to the `AZURE_API_KEY` environment variable.", "anyOf": [ { "type": "object", @@ -209,7 +296,8 @@ const schema = { ], "additionalProperties": false } - ] + ], + "description": "Optional API key to use with the model. Defaults to the `AZURE_API_KEY` environment variable." }, "apiVersion": { "type": "string", @@ -220,6 +308,50 @@ const schema = { "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Use a different URL prefix for API calls. Either this or `resourceName` can be used." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -244,7 +376,6 @@ const schema = { "description": "Optional display name." }, "token": { - "description": "Optional API key to use with the model. Defaults to the `DEEPSEEK_API_KEY` environment variable.", "anyOf": [ { "type": "object", @@ -272,13 +403,58 @@ const schema = { ], "additionalProperties": false } - ] + ], + "description": "Optional API key to use with the model. Defaults to the `DEEPSEEK_API_KEY` environment variable." }, "baseUrl": { "type": "string", "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -303,7 +479,6 @@ const schema = { "description": "Optional display name." }, "token": { - "description": "Optional API key to use with the model. Defaults to the `GOOGLE_GENERATIVE_AI_API_KEY` environment variable.", "anyOf": [ { "type": "object", @@ -331,13 +506,58 @@ const schema = { ], "additionalProperties": false } - ] + ], + "description": "Optional API key to use with the model. Defaults to the `GOOGLE_GENERATIVE_AI_API_KEY` environment variable." }, "baseUrl": { "type": "string", "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -378,7 +598,6 @@ const schema = { ] }, "credentials": { - "description": "Optional file path to service account credentials JSON. Defaults to the `GOOGLE_APPLICATION_CREDENTIALS` environment variable or application default credentials.", "anyOf": [ { "type": "object", @@ -406,13 +625,58 @@ const schema = { ], "additionalProperties": false } - ] + ], + "description": "Optional file path to service account credentials JSON. Defaults to the `GOOGLE_APPLICATION_CREDENTIALS` environment variable or application default credentials." }, "baseUrl": { "type": "string", "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -455,7 +719,6 @@ const schema = { ] }, "credentials": { - "description": "Optional file path to service account credentials JSON. Defaults to the `GOOGLE_APPLICATION_CREDENTIALS` environment variable or application default credentials.", "anyOf": [ { "type": "object", @@ -483,13 +746,58 @@ const schema = { ], "additionalProperties": false } - ] + ], + "description": "Optional file path to service account credentials JSON. Defaults to the `GOOGLE_APPLICATION_CREDENTIALS` environment variable or application default credentials." }, "baseUrl": { "type": "string", "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -514,7 +822,6 @@ const schema = { "description": "Optional display name." }, "token": { - "description": "Optional API key to use with the model. Defaults to the `MISTRAL_API_KEY` environment variable.", "anyOf": [ { "type": "object", @@ -542,13 +849,58 @@ const schema = { ], "additionalProperties": false } - ] + ], + "description": "Optional API key to use with the model. Defaults to the `MISTRAL_API_KEY` environment variable." }, "baseUrl": { "type": "string", "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -579,7 +931,6 @@ const schema = { "description": "Optional display name." }, "token": { - "description": "Optional API key to use with the model. Defaults to the `OPENAI_API_KEY` environment variable.", "anyOf": [ { "type": "object", @@ -607,7 +958,8 @@ const schema = { ], "additionalProperties": false } - ] + ], + "description": "Optional API key to use with the model. Defaults to the `OPENAI_API_KEY` environment variable." }, "baseUrl": { "type": "string", @@ -624,6 +976,50 @@ const schema = { "medium", "high" ] + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -648,7 +1044,6 @@ const schema = { "description": "Optional display name." }, "token": { - "description": "Optional API key. If specified, adds an `Authorization` header to request headers with the value Bearer .", "anyOf": [ { "type": "object", @@ -676,7 +1071,8 @@ const schema = { ], "additionalProperties": false } - ] + ], + "description": "Optional API key. If specified, adds an `Authorization` header to request headers with the value Bearer ." }, "baseUrl": { "type": "string", @@ -686,6 +1082,50 @@ const schema = { "examples": [ "http://localhost:8080/v1" ] + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -711,7 +1151,6 @@ const schema = { "description": "Optional display name." }, "token": { - "description": "Optional API key to use with the model. Defaults to the `OPENROUTER_API_KEY` environment variable.", "anyOf": [ { "type": "object", @@ -739,13 +1178,58 @@ const schema = { ], "additionalProperties": false } - ] + ], + "description": "Optional API key to use with the model. Defaults to the `OPENROUTER_API_KEY` environment variable." }, "baseUrl": { "type": "string", "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -774,7 +1258,6 @@ const schema = { "description": "Optional display name." }, "token": { - "description": "Optional API key to use with the model. Defaults to the `XAI_API_KEY` environment variable.", "anyOf": [ { "type": "object", @@ -802,13 +1285,58 @@ const schema = { ], "additionalProperties": false } - ] + ], + "description": "Optional API key to use with the model. Defaults to the `XAI_API_KEY` environment variable." }, "baseUrl": { "type": "string", "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -910,6 +1438,50 @@ const schema = { "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -934,7 +1506,6 @@ const schema = { "description": "Optional display name." }, "token": { - "description": "Optional API key to use with the model. Defaults to the `ANTHROPIC_API_KEY` environment variable.", "anyOf": [ { "type": "object", @@ -962,13 +1533,58 @@ const schema = { ], "additionalProperties": false } - ] + ], + "description": "Optional API key to use with the model. Defaults to the `ANTHROPIC_API_KEY` environment variable." }, "baseUrl": { "type": "string", "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -997,7 +1613,6 @@ const schema = { "description": "Azure resource name. Defaults to the `AZURE_RESOURCE_NAME` environment variable." }, "token": { - "description": "Optional API key to use with the model. Defaults to the `AZURE_API_KEY` environment variable.", "anyOf": [ { "type": "object", @@ -1025,7 +1640,8 @@ const schema = { ], "additionalProperties": false } - ] + ], + "description": "Optional API key to use with the model. Defaults to the `AZURE_API_KEY` environment variable." }, "apiVersion": { "type": "string", @@ -1036,6 +1652,50 @@ const schema = { "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Use a different URL prefix for API calls. Either this or `resourceName` can be used." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -1060,7 +1720,6 @@ const schema = { "description": "Optional display name." }, "token": { - "description": "Optional API key to use with the model. Defaults to the `DEEPSEEK_API_KEY` environment variable.", "anyOf": [ { "type": "object", @@ -1088,13 +1747,58 @@ const schema = { ], "additionalProperties": false } - ] + ], + "description": "Optional API key to use with the model. Defaults to the `DEEPSEEK_API_KEY` environment variable." }, "baseUrl": { "type": "string", "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -1119,7 +1823,6 @@ const schema = { "description": "Optional display name." }, "token": { - "description": "Optional API key to use with the model. Defaults to the `GOOGLE_GENERATIVE_AI_API_KEY` environment variable.", "anyOf": [ { "type": "object", @@ -1147,13 +1850,58 @@ const schema = { ], "additionalProperties": false } - ] + ], + "description": "Optional API key to use with the model. Defaults to the `GOOGLE_GENERATIVE_AI_API_KEY` environment variable." }, "baseUrl": { "type": "string", "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -1194,7 +1942,6 @@ const schema = { ] }, "credentials": { - "description": "Optional file path to service account credentials JSON. Defaults to the `GOOGLE_APPLICATION_CREDENTIALS` environment variable or application default credentials.", "anyOf": [ { "type": "object", @@ -1222,13 +1969,58 @@ const schema = { ], "additionalProperties": false } - ] + ], + "description": "Optional file path to service account credentials JSON. Defaults to the `GOOGLE_APPLICATION_CREDENTIALS` environment variable or application default credentials." }, "baseUrl": { "type": "string", "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -1271,7 +2063,6 @@ const schema = { ] }, "credentials": { - "description": "Optional file path to service account credentials JSON. Defaults to the `GOOGLE_APPLICATION_CREDENTIALS` environment variable or application default credentials.", "anyOf": [ { "type": "object", @@ -1299,13 +2090,58 @@ const schema = { ], "additionalProperties": false } - ] + ], + "description": "Optional file path to service account credentials JSON. Defaults to the `GOOGLE_APPLICATION_CREDENTIALS` environment variable or application default credentials." }, "baseUrl": { "type": "string", "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -1330,7 +2166,6 @@ const schema = { "description": "Optional display name." }, "token": { - "description": "Optional API key to use with the model. Defaults to the `MISTRAL_API_KEY` environment variable.", "anyOf": [ { "type": "object", @@ -1358,13 +2193,58 @@ const schema = { ], "additionalProperties": false } - ] + ], + "description": "Optional API key to use with the model. Defaults to the `MISTRAL_API_KEY` environment variable." }, "baseUrl": { "type": "string", "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -1395,7 +2275,6 @@ const schema = { "description": "Optional display name." }, "token": { - "description": "Optional API key to use with the model. Defaults to the `OPENAI_API_KEY` environment variable.", "anyOf": [ { "type": "object", @@ -1423,7 +2302,8 @@ const schema = { ], "additionalProperties": false } - ] + ], + "description": "Optional API key to use with the model. Defaults to the `OPENAI_API_KEY` environment variable." }, "baseUrl": { "type": "string", @@ -1440,6 +2320,50 @@ const schema = { "medium", "high" ] + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -1464,7 +2388,6 @@ const schema = { "description": "Optional display name." }, "token": { - "description": "Optional API key. If specified, adds an `Authorization` header to request headers with the value Bearer .", "anyOf": [ { "type": "object", @@ -1492,7 +2415,8 @@ const schema = { ], "additionalProperties": false } - ] + ], + "description": "Optional API key. If specified, adds an `Authorization` header to request headers with the value Bearer ." }, "baseUrl": { "type": "string", @@ -1502,6 +2426,50 @@ const schema = { "examples": [ "http://localhost:8080/v1" ] + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -1527,7 +2495,6 @@ const schema = { "description": "Optional display name." }, "token": { - "description": "Optional API key to use with the model. Defaults to the `OPENROUTER_API_KEY` environment variable.", "anyOf": [ { "type": "object", @@ -1555,13 +2522,58 @@ const schema = { ], "additionalProperties": false } - ] + ], + "description": "Optional API key to use with the model. Defaults to the `OPENROUTER_API_KEY` environment variable." }, "baseUrl": { "type": "string", "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ @@ -1590,7 +2602,6 @@ const schema = { "description": "Optional display name." }, "token": { - "description": "Optional API key to use with the model. Defaults to the `XAI_API_KEY` environment variable.", "anyOf": [ { "type": "object", @@ -1618,13 +2629,58 @@ const schema = { ], "additionalProperties": false } - ] + ], + "description": "Optional API key to use with the model. Defaults to the `XAI_API_KEY` environment variable." }, "baseUrl": { "type": "string", "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } }, "required": [ diff --git a/packages/schemas/src/v3/languageModel.type.ts b/packages/schemas/src/v3/languageModel.type.ts index 31968460..d420d11b 100644 --- a/packages/schemas/src/v3/languageModel.type.ts +++ b/packages/schemas/src/v3/languageModel.type.ts @@ -67,6 +67,32 @@ export interface AmazonBedrockLanguageModel { * Optional base URL. */ baseUrl?: string; + headers?: LanguageModelHeaders; +} +/** + * Optional headers to use with the model. + */ +export interface LanguageModelHeaders { + /** + * This interface was referenced by `LanguageModelHeaders`'s JSON-Schema definition + * via the `patternProperty` "^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$". + */ + [k: string]: + | string + | ( + | { + /** + * The name of the secret that contains the token. + */ + secret: string; + } + | { + /** + * The name of the environment variable that contains the token. Only supported in declarative connection configs. + */ + env: string; + } + ); } export interface AnthropicLanguageModel { /** @@ -101,6 +127,7 @@ export interface AnthropicLanguageModel { * Optional base URL. */ baseUrl?: string; + headers?: LanguageModelHeaders; } export interface AzureLanguageModel { /** @@ -143,6 +170,7 @@ export interface AzureLanguageModel { * Use a different URL prefix for API calls. Either this or `resourceName` can be used. */ baseUrl?: string; + headers?: LanguageModelHeaders; } export interface DeepSeekLanguageModel { /** @@ -177,6 +205,7 @@ export interface DeepSeekLanguageModel { * Optional base URL. */ baseUrl?: string; + headers?: LanguageModelHeaders; } export interface GoogleGenerativeAILanguageModel { /** @@ -211,6 +240,7 @@ export interface GoogleGenerativeAILanguageModel { * Optional base URL. */ baseUrl?: string; + headers?: LanguageModelHeaders; } export interface GoogleVertexAnthropicLanguageModel { /** @@ -253,6 +283,7 @@ export interface GoogleVertexAnthropicLanguageModel { * Optional base URL. */ baseUrl?: string; + headers?: LanguageModelHeaders; } export interface GoogleVertexLanguageModel { /** @@ -295,6 +326,7 @@ export interface GoogleVertexLanguageModel { * Optional base URL. */ baseUrl?: string; + headers?: LanguageModelHeaders; } export interface MistralLanguageModel { /** @@ -329,6 +361,7 @@ export interface MistralLanguageModel { * Optional base URL. */ baseUrl?: string; + headers?: LanguageModelHeaders; } export interface OpenAILanguageModel { /** @@ -367,6 +400,7 @@ export interface OpenAILanguageModel { * The reasoning effort to use with the model. Defaults to `medium`. See https://platform.openai.com/docs/guides/reasoning#get-started-with-reasonings */ reasoningEffort?: string; + headers?: LanguageModelHeaders; } export interface OpenAICompatibleLanguageModel { /** @@ -401,6 +435,7 @@ export interface OpenAICompatibleLanguageModel { * Base URL of the OpenAI-compatible chat completions API endpoint. */ baseUrl: string; + headers?: LanguageModelHeaders; } export interface OpenRouterLanguageModel { /** @@ -435,6 +470,7 @@ export interface OpenRouterLanguageModel { * Optional base URL. */ baseUrl?: string; + headers?: LanguageModelHeaders; } export interface XaiLanguageModel { /** @@ -469,4 +505,5 @@ export interface XaiLanguageModel { * Optional base URL. */ baseUrl?: string; + headers?: LanguageModelHeaders; } diff --git a/packages/schemas/src/v3/shared.schema.ts b/packages/schemas/src/v3/shared.schema.ts index 0c1792ae..666e2262 100644 --- a/packages/schemas/src/v3/shared.schema.ts +++ b/packages/schemas/src/v3/shared.schema.ts @@ -73,6 +73,50 @@ const schema = { } }, "additionalProperties": false + }, + "LanguageModelHeaders": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "The name of the secret that contains the token." + } + }, + "required": [ + "secret" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token. Only supported in declarative connection configs." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false } } } as const; diff --git a/packages/schemas/src/v3/shared.type.ts b/packages/schemas/src/v3/shared.type.ts index eeec734c..16f897e1 100644 --- a/packages/schemas/src/v3/shared.type.ts +++ b/packages/schemas/src/v3/shared.type.ts @@ -37,3 +37,16 @@ export interface GitRevisions { */ tags?: string[]; } +/** + * Optional headers to use with the model. + * + * This interface was referenced by `Shared`'s JSON-Schema + * via the `definition` "LanguageModelHeaders". + */ +export interface LanguageModelHeaders { + /** + * This interface was referenced by `LanguageModelHeaders`'s JSON-Schema definition + * via the `patternProperty` "^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$". + */ + [k: string]: string | Token; +} diff --git a/packages/web/src/app/api/(server)/chat/route.ts b/packages/web/src/app/api/(server)/chat/route.ts index a14140a0..2c9bced2 100644 --- a/packages/web/src/app/api/(server)/chat/route.ts +++ b/packages/web/src/app/api/(server)/chat/route.ts @@ -88,7 +88,7 @@ export async function POST(req: Request) { }); } - const { model, providerOptions, headers } = await _getAISDKLanguageModelAndOptions(languageModelConfig, org.id); + const { model, providerOptions } = await _getAISDKLanguageModelAndOptions(languageModelConfig, org.id); return createMessageStreamResponse({ messages, @@ -97,7 +97,6 @@ export async function POST(req: Request) { model, modelName: languageModelConfig.displayName ?? languageModelConfig.model, modelProviderOptions: providerOptions, - modelHeaders: headers, domain, orgId: org.id, }); @@ -129,7 +128,6 @@ interface CreateMessageStreamResponseProps { model: AISDKLanguageModelV2; modelName: string; modelProviderOptions?: Record>; - modelHeaders?: Record; domain: string; orgId: number; } @@ -141,7 +139,6 @@ const createMessageStreamResponse = async ({ model, modelName, modelProviderOptions, - modelHeaders, domain, orgId, }: CreateMessageStreamResponseProps) => { @@ -210,7 +207,6 @@ const createMessageStreamResponse = async ({ const researchStream = await createAgentStream({ model, providerOptions: modelProviderOptions, - headers: modelHeaders, inputMessages: messageHistory, inputSources: sources, searchScopeRepoNames: expandedRepos, diff --git a/packages/web/src/features/chat/actions.ts b/packages/web/src/features/chat/actions.ts index 330621ed..9ca1e826 100644 --- a/packages/web/src/features/chat/actions.ts +++ b/packages/web/src/features/chat/actions.ts @@ -20,8 +20,8 @@ import { LanguageModelV2 as AISDKLanguageModelV2 } from "@ai-sdk/provider"; import { createXai } from '@ai-sdk/xai'; import { createOpenRouter } from '@openrouter/ai-sdk-provider'; import { getTokenFromConfig } from "@sourcebot/crypto"; -import { ChatVisibility, OrgRole, Prisma } from "@sourcebot/db"; -import { LanguageModel } from "@sourcebot/schemas/v3/languageModel.type"; +import { ChatVisibility, OrgRole, Prisma, PrismaClient } from "@sourcebot/db"; +import { LanguageModel, LanguageModelHeaders } from "@sourcebot/schemas/v3/languageModel.type"; import { loadConfig } from "@sourcebot/shared"; import { generateText, JSONValue } from "ai"; import fs from 'fs'; @@ -375,7 +375,6 @@ export const _getConfiguredLanguageModelsFull = async (): Promise>, - headers?: Record, }> => { const { provider, model: modelId } = config; @@ -390,6 +389,9 @@ export const _getAISDKLanguageModelAndOptions = async (config: LanguageModel, or secretAccessKey: config.accessKeySecret ? await getTokenFromConfig(config.accessKeySecret, orgId, prisma) : env.AWS_SECRET_ACCESS_KEY, + headers: config.headers + ? await extractLanguageModelHeaders(config.headers, orgId, prisma) + : undefined, }); return { @@ -402,6 +404,9 @@ export const _getAISDKLanguageModelAndOptions = async (config: LanguageModel, or apiKey: config.token ? await getTokenFromConfig(config.token, orgId, prisma) : env.ANTHROPIC_API_KEY, + headers: config.headers + ? await extractLanguageModelHeaders(config.headers, orgId, prisma) + : undefined, }); return { @@ -414,10 +419,6 @@ export const _getAISDKLanguageModelAndOptions = async (config: LanguageModel, or } } satisfies AnthropicProviderOptions, }, - headers: { - // @see: https://docs.anthropic.com/en/docs/build-with-claude/extended-thinking#interleaved-thinking - 'anthropic-beta': 'interleaved-thinking-2025-05-14', - }, }; } case 'azure': { @@ -426,6 +427,9 @@ export const _getAISDKLanguageModelAndOptions = async (config: LanguageModel, or apiKey: config.token ? (await getTokenFromConfig(config.token, orgId, prisma)) : env.AZURE_API_KEY, apiVersion: config.apiVersion, resourceName: config.resourceName ?? env.AZURE_RESOURCE_NAME, + headers: config.headers + ? await extractLanguageModelHeaders(config.headers, orgId, prisma) + : undefined, }); return { @@ -436,6 +440,9 @@ export const _getAISDKLanguageModelAndOptions = async (config: LanguageModel, or const deepseek = createDeepSeek({ baseURL: config.baseUrl, apiKey: config.token ? (await getTokenFromConfig(config.token, orgId, prisma)) : env.DEEPSEEK_API_KEY, + headers: config.headers + ? await extractLanguageModelHeaders(config.headers, orgId, prisma) + : undefined, }); return { @@ -448,6 +455,9 @@ export const _getAISDKLanguageModelAndOptions = async (config: LanguageModel, or apiKey: config.token ? await getTokenFromConfig(config.token, orgId, prisma) : env.GOOGLE_GENERATIVE_AI_API_KEY, + headers: config.headers + ? await extractLanguageModelHeaders(config.headers, orgId, prisma) + : undefined, }); return { @@ -463,6 +473,9 @@ export const _getAISDKLanguageModelAndOptions = async (config: LanguageModel, or keyFilename: await getTokenFromConfig(config.credentials, orgId, prisma), } } : {}), + headers: config.headers + ? await extractLanguageModelHeaders(config.headers, orgId, prisma) + : undefined, }); return { @@ -486,6 +499,9 @@ export const _getAISDKLanguageModelAndOptions = async (config: LanguageModel, or keyFilename: await getTokenFromConfig(config.credentials, orgId, prisma), } } : {}), + headers: config.headers + ? await extractLanguageModelHeaders(config.headers, orgId, prisma) + : undefined, }); return { @@ -498,6 +514,9 @@ export const _getAISDKLanguageModelAndOptions = async (config: LanguageModel, or apiKey: config.token ? await getTokenFromConfig(config.token, orgId, prisma) : env.MISTRAL_API_KEY, + headers: config.headers + ? await extractLanguageModelHeaders(config.headers, orgId, prisma) + : undefined, }); return { @@ -510,6 +529,9 @@ export const _getAISDKLanguageModelAndOptions = async (config: LanguageModel, or apiKey: config.token ? await getTokenFromConfig(config.token, orgId, prisma) : env.OPENAI_API_KEY, + headers: config.headers + ? await extractLanguageModelHeaders(config.headers, orgId, prisma) + : undefined, }); return { @@ -528,6 +550,9 @@ export const _getAISDKLanguageModelAndOptions = async (config: LanguageModel, or apiKey: config.token ? await getTokenFromConfig(config.token, orgId, prisma) : undefined, + headers: config.headers + ? await extractLanguageModelHeaders(config.headers, orgId, prisma) + : undefined, }); return { @@ -540,6 +565,9 @@ export const _getAISDKLanguageModelAndOptions = async (config: LanguageModel, or apiKey: config.token ? await getTokenFromConfig(config.token, orgId, prisma) : env.OPENROUTER_API_KEY, + headers: config.headers + ? await extractLanguageModelHeaders(config.headers, orgId, prisma) + : undefined, }); return { @@ -552,6 +580,9 @@ export const _getAISDKLanguageModelAndOptions = async (config: LanguageModel, or apiKey: config.token ? await getTokenFromConfig(config.token, orgId, prisma) : env.XAI_API_KEY, + headers: config.headers + ? await extractLanguageModelHeaders(config.headers, orgId, prisma) + : undefined, }); return { @@ -559,4 +590,28 @@ export const _getAISDKLanguageModelAndOptions = async (config: LanguageModel, or }; } } -} \ No newline at end of file +} + +const extractLanguageModelHeaders = async ( + headers: LanguageModelHeaders, + orgId: number, + db: PrismaClient, +): Promise> => { + const resolvedHeaders: Record = {}; + + if (!headers) { + return resolvedHeaders; + } + + for (const [headerName, headerValue] of Object.entries(headers)) { + if (typeof headerValue === "string") { + resolvedHeaders[headerName] = headerValue; + continue; + } + + const value = await getTokenFromConfig(headerValue, orgId, db); + resolvedHeaders[headerName] = value; + } + + return resolvedHeaders; +} diff --git a/packages/web/src/features/chat/agent.ts b/packages/web/src/features/chat/agent.ts index 29307e17..7010151f 100644 --- a/packages/web/src/features/chat/agent.ts +++ b/packages/web/src/features/chat/agent.ts @@ -32,7 +32,6 @@ const stepCountIsGTE = (stepCount: number): StopCondition => { export const createAgentStream = async ({ model, providerOptions, - headers, inputMessages, inputSources, searchScopeRepoNames, @@ -46,7 +45,6 @@ export const createAgentStream = async ({ const stream = streamText({ model, providerOptions, - headers, system: baseSystemPrompt, messages: inputMessages, tools: { diff --git a/schemas/v3/languageModel.json b/schemas/v3/languageModel.json index 2acf9f64..660cd44f 100644 --- a/schemas/v3/languageModel.json +++ b/schemas/v3/languageModel.json @@ -39,6 +39,9 @@ "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "$ref": "./shared.json#/definitions/LanguageModelHeaders" } }, "required": [ @@ -71,6 +74,9 @@ "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "$ref": "./shared.json#/definitions/LanguageModelHeaders" } }, "required": [ @@ -111,6 +117,9 @@ "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Use a different URL prefix for API calls. Either this or `resourceName` can be used." + }, + "headers": { + "$ref": "./shared.json#/definitions/LanguageModelHeaders" } }, "required": [ @@ -143,6 +152,9 @@ "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "$ref": "./shared.json#/definitions/LanguageModelHeaders" } }, "required": [ @@ -175,6 +187,9 @@ "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "$ref": "./shared.json#/definitions/LanguageModelHeaders" } }, "required": [ @@ -223,6 +238,9 @@ "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "$ref": "./shared.json#/definitions/LanguageModelHeaders" } }, "required": [ @@ -273,6 +291,9 @@ "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "$ref": "./shared.json#/definitions/LanguageModelHeaders" } }, "required": [ @@ -305,6 +326,9 @@ "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "$ref": "./shared.json#/definitions/LanguageModelHeaders" } }, "required": [ @@ -353,6 +377,9 @@ "medium", "high" ] + }, + "headers": { + "$ref": "./shared.json#/definitions/LanguageModelHeaders" } }, "required": [ @@ -388,6 +415,9 @@ "examples": [ "http://localhost:8080/v1" ] + }, + "headers": { + "$ref": "./shared.json#/definitions/LanguageModelHeaders" } }, "required": [ @@ -421,6 +451,9 @@ "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "$ref": "./shared.json#/definitions/LanguageModelHeaders" } }, "required": [ @@ -457,6 +490,9 @@ "format": "url", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Optional base URL." + }, + "headers": { + "$ref": "./shared.json#/definitions/LanguageModelHeaders" } }, "required": [ diff --git a/schemas/v3/shared.json b/schemas/v3/shared.json index 8af4cbdc..6721e3e7 100644 --- a/schemas/v3/shared.json +++ b/schemas/v3/shared.json @@ -72,6 +72,23 @@ } }, "additionalProperties": false + }, + "LanguageModelHeaders": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/Token" + } + ] + } + }, + "additionalProperties": false } } } \ No newline at end of file