From e60c3adcee3a3d5b57817bc2d0c68f41829dc7f4 Mon Sep 17 00:00:00 2001 From: Thibault Jaigu Date: Wed, 24 Jun 2026 15:39:30 +0100 Subject: [PATCH] feat: add Requesty as an OpenAI-compatible chat model provider --- .../language-model-providers.mdx | 21 ++ docs/snippets/schemas/v3/index.schema.mdx | 220 ++++++++++++++++++ .../schemas/v3/languageModel.schema.mdx | 220 ++++++++++++++++++ packages/schemas/src/v3/index.schema.ts | 220 ++++++++++++++++++ packages/schemas/src/v3/index.type.ts | 40 ++++ .../schemas/src/v3/languageModel.schema.ts | 220 ++++++++++++++++++ packages/schemas/src/v3/languageModel.type.ts | 40 ++++ packages/setupWizard/src/models.ts | 5 +- packages/shared/src/env.server.ts | 2 + .../components/chatBox/modelProviderLogo.tsx | 5 + packages/web/src/features/chat/llm.server.ts | 16 ++ packages/web/src/features/chat/types.ts | 1 + schemas/v3/languageModel.json | 45 ++++ 13 files changed, 1054 insertions(+), 1 deletion(-) diff --git a/docs/docs/configuration/language-model-providers.mdx b/docs/docs/configuration/language-model-providers.mdx index 032e38e8c..d218ba286 100644 --- a/docs/docs/configuration/language-model-providers.mdx +++ b/docs/docs/configuration/language-model-providers.mdx @@ -342,6 +342,27 @@ The OpenAI compatible provider allows you to use any model that is compatible wi } ``` +### Requesty + +[Requesty](https://requesty.ai) is an OpenAI-compatible LLM gateway. Models are referenced in `provider/model` format (e.g. `openai/gpt-4o-mini`). See the [Requesty docs](https://docs.requesty.ai). + +```json wrap icon="code" Example config with Requesty provider +{ + "$schema": "https://raw.githubusercontent.com/sourcebot-dev/sourcebot/main/schemas/v3/index.json", + "models": [ + { + "provider": "requesty", + "model": "openai/gpt-4o-mini", + "displayName": "OPTIONAL_DISPLAY_NAME", + "token": { + "env": "REQUESTY_API_KEY" + }, + "baseUrl": "OPTIONAL_BASE_URL" + } + ] +} +``` + ### xAI [Vercel AI SDK xAI Docs](https://ai-sdk.dev/providers/ai-sdk-providers/xai) diff --git a/docs/snippets/schemas/v3/index.schema.mdx b/docs/snippets/schemas/v3/index.schema.mdx index 864359251..92d4e84b0 100644 --- a/docs/snippets/schemas/v3/index.schema.mdx +++ b/docs/snippets/schemas/v3/index.schema.mdx @@ -3143,6 +3143,116 @@ ], "additionalProperties": false }, + "RequestyLanguageModel": { + "type": "object", + "properties": { + "provider": { + "const": "requesty", + "description": "Requesty Configuration" + }, + "model": { + "type": "string", + "description": "The name of the language model in `provider/model` format.", + "examples": [ + "openai/gpt-4o-mini" + ] + }, + "displayName": { + "type": "string", + "description": "Optional display name." + }, + "token": { + "anyOf": [ + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "googleCloudSecret": { + "type": "string", + "description": "The resource name of a Google Cloud secret. Must be in the format `projects//secrets//versions/`. See https://cloud.google.com/secret-manager/docs/creating-and-accessing-secrets" + } + }, + "required": [ + "googleCloudSecret" + ], + "additionalProperties": false + } + ], + "description": "Optional API key to use with the model. Defaults to the `REQUESTY_API_KEY` environment variable." + }, + "baseUrl": { + "type": "string", + "format": "url", + "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", + "description": "Optional base URL. Defaults to `https://router.requesty.ai/v1`." + }, + "temperature": { + "type": "number", + "description": "Optional temperature setting to use with the model." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "googleCloudSecret": { + "type": "string", + "description": "The resource name of a Google Cloud secret. Must be in the format `projects//secrets//versions/`. See https://cloud.google.com/secret-manager/docs/creating-and-accessing-secrets" + } + }, + "required": [ + "googleCloudSecret" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false + } + }, + "required": [ + "provider", + "model" + ], + "additionalProperties": false + }, "XaiLanguageModel": { "type": "object", "properties": { @@ -4709,6 +4819,116 @@ ], "additionalProperties": false }, + { + "type": "object", + "properties": { + "provider": { + "const": "requesty", + "description": "Requesty Configuration" + }, + "model": { + "type": "string", + "description": "The name of the language model in `provider/model` format.", + "examples": [ + "openai/gpt-4o-mini" + ] + }, + "displayName": { + "type": "string", + "description": "Optional display name." + }, + "token": { + "anyOf": [ + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "googleCloudSecret": { + "type": "string", + "description": "The resource name of a Google Cloud secret. Must be in the format `projects//secrets//versions/`. See https://cloud.google.com/secret-manager/docs/creating-and-accessing-secrets" + } + }, + "required": [ + "googleCloudSecret" + ], + "additionalProperties": false + } + ], + "description": "Optional API key to use with the model. Defaults to the `REQUESTY_API_KEY` environment variable." + }, + "baseUrl": { + "type": "string", + "format": "url", + "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", + "description": "Optional base URL. Defaults to `https://router.requesty.ai/v1`." + }, + "temperature": { + "type": "number", + "description": "Optional temperature setting to use with the model." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "googleCloudSecret": { + "type": "string", + "description": "The resource name of a Google Cloud secret. Must be in the format `projects//secrets//versions/`. See https://cloud.google.com/secret-manager/docs/creating-and-accessing-secrets" + } + }, + "required": [ + "googleCloudSecret" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false + } + }, + "required": [ + "provider", + "model" + ], + "additionalProperties": false + }, { "type": "object", "properties": { diff --git a/docs/snippets/schemas/v3/languageModel.schema.mdx b/docs/snippets/schemas/v3/languageModel.schema.mdx index 90aee08af..ab34b6f1c 100644 --- a/docs/snippets/schemas/v3/languageModel.schema.mdx +++ b/docs/snippets/schemas/v3/languageModel.schema.mdx @@ -1457,6 +1457,116 @@ ], "additionalProperties": false }, + "RequestyLanguageModel": { + "type": "object", + "properties": { + "provider": { + "const": "requesty", + "description": "Requesty Configuration" + }, + "model": { + "type": "string", + "description": "The name of the language model in `provider/model` format.", + "examples": [ + "openai/gpt-4o-mini" + ] + }, + "displayName": { + "type": "string", + "description": "Optional display name." + }, + "token": { + "anyOf": [ + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "googleCloudSecret": { + "type": "string", + "description": "The resource name of a Google Cloud secret. Must be in the format `projects//secrets//versions/`. See https://cloud.google.com/secret-manager/docs/creating-and-accessing-secrets" + } + }, + "required": [ + "googleCloudSecret" + ], + "additionalProperties": false + } + ], + "description": "Optional API key to use with the model. Defaults to the `REQUESTY_API_KEY` environment variable." + }, + "baseUrl": { + "type": "string", + "format": "url", + "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", + "description": "Optional base URL. Defaults to `https://router.requesty.ai/v1`." + }, + "temperature": { + "type": "number", + "description": "Optional temperature setting to use with the model." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "googleCloudSecret": { + "type": "string", + "description": "The resource name of a Google Cloud secret. Must be in the format `projects//secrets//versions/`. See https://cloud.google.com/secret-manager/docs/creating-and-accessing-secrets" + } + }, + "required": [ + "googleCloudSecret" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false + } + }, + "required": [ + "provider", + "model" + ], + "additionalProperties": false + }, "XaiLanguageModel": { "type": "object", "properties": { @@ -3023,6 +3133,116 @@ ], "additionalProperties": false }, + { + "type": "object", + "properties": { + "provider": { + "const": "requesty", + "description": "Requesty Configuration" + }, + "model": { + "type": "string", + "description": "The name of the language model in `provider/model` format.", + "examples": [ + "openai/gpt-4o-mini" + ] + }, + "displayName": { + "type": "string", + "description": "Optional display name." + }, + "token": { + "anyOf": [ + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "googleCloudSecret": { + "type": "string", + "description": "The resource name of a Google Cloud secret. Must be in the format `projects//secrets//versions/`. See https://cloud.google.com/secret-manager/docs/creating-and-accessing-secrets" + } + }, + "required": [ + "googleCloudSecret" + ], + "additionalProperties": false + } + ], + "description": "Optional API key to use with the model. Defaults to the `REQUESTY_API_KEY` environment variable." + }, + "baseUrl": { + "type": "string", + "format": "url", + "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", + "description": "Optional base URL. Defaults to `https://router.requesty.ai/v1`." + }, + "temperature": { + "type": "number", + "description": "Optional temperature setting to use with the model." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "googleCloudSecret": { + "type": "string", + "description": "The resource name of a Google Cloud secret. Must be in the format `projects//secrets//versions/`. See https://cloud.google.com/secret-manager/docs/creating-and-accessing-secrets" + } + }, + "required": [ + "googleCloudSecret" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false + } + }, + "required": [ + "provider", + "model" + ], + "additionalProperties": false + }, { "type": "object", "properties": { diff --git a/packages/schemas/src/v3/index.schema.ts b/packages/schemas/src/v3/index.schema.ts index 8c1d64b52..eb85de9ce 100644 --- a/packages/schemas/src/v3/index.schema.ts +++ b/packages/schemas/src/v3/index.schema.ts @@ -3142,6 +3142,116 @@ const schema = { ], "additionalProperties": false }, + "RequestyLanguageModel": { + "type": "object", + "properties": { + "provider": { + "const": "requesty", + "description": "Requesty Configuration" + }, + "model": { + "type": "string", + "description": "The name of the language model in `provider/model` format.", + "examples": [ + "openai/gpt-4o-mini" + ] + }, + "displayName": { + "type": "string", + "description": "Optional display name." + }, + "token": { + "anyOf": [ + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "googleCloudSecret": { + "type": "string", + "description": "The resource name of a Google Cloud secret. Must be in the format `projects//secrets//versions/`. See https://cloud.google.com/secret-manager/docs/creating-and-accessing-secrets" + } + }, + "required": [ + "googleCloudSecret" + ], + "additionalProperties": false + } + ], + "description": "Optional API key to use with the model. Defaults to the `REQUESTY_API_KEY` environment variable." + }, + "baseUrl": { + "type": "string", + "format": "url", + "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", + "description": "Optional base URL. Defaults to `https://router.requesty.ai/v1`." + }, + "temperature": { + "type": "number", + "description": "Optional temperature setting to use with the model." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "googleCloudSecret": { + "type": "string", + "description": "The resource name of a Google Cloud secret. Must be in the format `projects//secrets//versions/`. See https://cloud.google.com/secret-manager/docs/creating-and-accessing-secrets" + } + }, + "required": [ + "googleCloudSecret" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false + } + }, + "required": [ + "provider", + "model" + ], + "additionalProperties": false + }, "XaiLanguageModel": { "type": "object", "properties": { @@ -4708,6 +4818,116 @@ const schema = { ], "additionalProperties": false }, + { + "type": "object", + "properties": { + "provider": { + "const": "requesty", + "description": "Requesty Configuration" + }, + "model": { + "type": "string", + "description": "The name of the language model in `provider/model` format.", + "examples": [ + "openai/gpt-4o-mini" + ] + }, + "displayName": { + "type": "string", + "description": "Optional display name." + }, + "token": { + "anyOf": [ + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "googleCloudSecret": { + "type": "string", + "description": "The resource name of a Google Cloud secret. Must be in the format `projects//secrets//versions/`. See https://cloud.google.com/secret-manager/docs/creating-and-accessing-secrets" + } + }, + "required": [ + "googleCloudSecret" + ], + "additionalProperties": false + } + ], + "description": "Optional API key to use with the model. Defaults to the `REQUESTY_API_KEY` environment variable." + }, + "baseUrl": { + "type": "string", + "format": "url", + "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", + "description": "Optional base URL. Defaults to `https://router.requesty.ai/v1`." + }, + "temperature": { + "type": "number", + "description": "Optional temperature setting to use with the model." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "googleCloudSecret": { + "type": "string", + "description": "The resource name of a Google Cloud secret. Must be in the format `projects//secrets//versions/`. See https://cloud.google.com/secret-manager/docs/creating-and-accessing-secrets" + } + }, + "required": [ + "googleCloudSecret" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false + } + }, + "required": [ + "provider", + "model" + ], + "additionalProperties": false + }, { "type": "object", "properties": { diff --git a/packages/schemas/src/v3/index.type.ts b/packages/schemas/src/v3/index.type.ts index 7fa7f5a17..341d3d214 100644 --- a/packages/schemas/src/v3/index.type.ts +++ b/packages/schemas/src/v3/index.type.ts @@ -24,6 +24,7 @@ export type LanguageModel = | OpenAILanguageModel | OpenAICompatibleLanguageModel | OpenRouterLanguageModel + | RequestyLanguageModel | XaiLanguageModel; export type AppConfig = GitHubAppConfig; /** @@ -1280,6 +1281,45 @@ export interface OpenRouterLanguageModel { temperature?: number; headers?: LanguageModelHeaders; } +export interface RequestyLanguageModel { + /** + * Requesty Configuration + */ + provider: "requesty"; + /** + * The name of the language model in `provider/model` format. + */ + model: string; + /** + * Optional display name. + */ + displayName?: string; + /** + * Optional API key to use with the model. Defaults to the `REQUESTY_API_KEY` environment variable. + */ + token?: + | { + /** + * The name of the environment variable that contains the token. + */ + env: string; + } + | { + /** + * The resource name of a Google Cloud secret. Must be in the format `projects//secrets//versions/`. See https://cloud.google.com/secret-manager/docs/creating-and-accessing-secrets + */ + googleCloudSecret: string; + }; + /** + * Optional base URL. Defaults to `https://router.requesty.ai/v1`. + */ + baseUrl?: string; + /** + * Optional temperature setting to use with the model. + */ + temperature?: number; + headers?: LanguageModelHeaders; +} export interface XaiLanguageModel { /** * xAI Configuration diff --git a/packages/schemas/src/v3/languageModel.schema.ts b/packages/schemas/src/v3/languageModel.schema.ts index ab418ce79..ba8090bda 100644 --- a/packages/schemas/src/v3/languageModel.schema.ts +++ b/packages/schemas/src/v3/languageModel.schema.ts @@ -1456,6 +1456,116 @@ const schema = { ], "additionalProperties": false }, + "RequestyLanguageModel": { + "type": "object", + "properties": { + "provider": { + "const": "requesty", + "description": "Requesty Configuration" + }, + "model": { + "type": "string", + "description": "The name of the language model in `provider/model` format.", + "examples": [ + "openai/gpt-4o-mini" + ] + }, + "displayName": { + "type": "string", + "description": "Optional display name." + }, + "token": { + "anyOf": [ + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "googleCloudSecret": { + "type": "string", + "description": "The resource name of a Google Cloud secret. Must be in the format `projects//secrets//versions/`. See https://cloud.google.com/secret-manager/docs/creating-and-accessing-secrets" + } + }, + "required": [ + "googleCloudSecret" + ], + "additionalProperties": false + } + ], + "description": "Optional API key to use with the model. Defaults to the `REQUESTY_API_KEY` environment variable." + }, + "baseUrl": { + "type": "string", + "format": "url", + "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", + "description": "Optional base URL. Defaults to `https://router.requesty.ai/v1`." + }, + "temperature": { + "type": "number", + "description": "Optional temperature setting to use with the model." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "googleCloudSecret": { + "type": "string", + "description": "The resource name of a Google Cloud secret. Must be in the format `projects//secrets//versions/`. See https://cloud.google.com/secret-manager/docs/creating-and-accessing-secrets" + } + }, + "required": [ + "googleCloudSecret" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false + } + }, + "required": [ + "provider", + "model" + ], + "additionalProperties": false + }, "XaiLanguageModel": { "type": "object", "properties": { @@ -3022,6 +3132,116 @@ const schema = { ], "additionalProperties": false }, + { + "type": "object", + "properties": { + "provider": { + "const": "requesty", + "description": "Requesty Configuration" + }, + "model": { + "type": "string", + "description": "The name of the language model in `provider/model` format.", + "examples": [ + "openai/gpt-4o-mini" + ] + }, + "displayName": { + "type": "string", + "description": "Optional display name." + }, + "token": { + "anyOf": [ + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "googleCloudSecret": { + "type": "string", + "description": "The resource name of a Google Cloud secret. Must be in the format `projects//secrets//versions/`. See https://cloud.google.com/secret-manager/docs/creating-and-accessing-secrets" + } + }, + "required": [ + "googleCloudSecret" + ], + "additionalProperties": false + } + ], + "description": "Optional API key to use with the model. Defaults to the `REQUESTY_API_KEY` environment variable." + }, + "baseUrl": { + "type": "string", + "format": "url", + "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", + "description": "Optional base URL. Defaults to `https://router.requesty.ai/v1`." + }, + "temperature": { + "type": "number", + "description": "Optional temperature setting to use with the model." + }, + "headers": { + "type": "object", + "description": "Optional headers to use with the model.", + "patternProperties": { + "^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$": { + "anyOf": [ + { + "type": "string" + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "The name of the environment variable that contains the token." + } + }, + "required": [ + "env" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "googleCloudSecret": { + "type": "string", + "description": "The resource name of a Google Cloud secret. Must be in the format `projects//secrets//versions/`. See https://cloud.google.com/secret-manager/docs/creating-and-accessing-secrets" + } + }, + "required": [ + "googleCloudSecret" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": false + } + }, + "required": [ + "provider", + "model" + ], + "additionalProperties": false + }, { "type": "object", "properties": { diff --git a/packages/schemas/src/v3/languageModel.type.ts b/packages/schemas/src/v3/languageModel.type.ts index 5c3b25668..4c9649096 100644 --- a/packages/schemas/src/v3/languageModel.type.ts +++ b/packages/schemas/src/v3/languageModel.type.ts @@ -12,6 +12,7 @@ export type LanguageModel = | OpenAILanguageModel | OpenAICompatibleLanguageModel | OpenRouterLanguageModel + | RequestyLanguageModel | XaiLanguageModel; export interface AmazonBedrockLanguageModel { @@ -606,6 +607,45 @@ export interface OpenRouterLanguageModel { temperature?: number; headers?: LanguageModelHeaders; } +export interface RequestyLanguageModel { + /** + * Requesty Configuration + */ + provider: "requesty"; + /** + * The name of the language model in `provider/model` format. + */ + model: string; + /** + * Optional display name. + */ + displayName?: string; + /** + * Optional API key to use with the model. Defaults to the `REQUESTY_API_KEY` environment variable. + */ + token?: + | { + /** + * The name of the environment variable that contains the token. + */ + env: string; + } + | { + /** + * The resource name of a Google Cloud secret. Must be in the format `projects//secrets//versions/`. See https://cloud.google.com/secret-manager/docs/creating-and-accessing-secrets + */ + googleCloudSecret: string; + }; + /** + * Optional base URL. Defaults to `https://router.requesty.ai/v1`. + */ + baseUrl?: string; + /** + * Optional temperature setting to use with the model. + */ + temperature?: number; + headers?: LanguageModelHeaders; +} export interface XaiLanguageModel { /** * xAI Configuration diff --git a/packages/setupWizard/src/models.ts b/packages/setupWizard/src/models.ts index 50faea65f..c2bdfa287 100644 --- a/packages/setupWizard/src/models.ts +++ b/packages/setupWizard/src/models.ts @@ -20,6 +20,7 @@ export const PROVIDER_ENV_KEYS: Record = { 'mistral': 'MISTRAL_API_KEY', 'xai': 'XAI_API_KEY', 'openrouter': 'OPENROUTER_API_KEY', + 'requesty': 'REQUESTY_API_KEY', 'openai-compatible': 'OPENAI_COMPATIBLE_API_KEY', 'azure': 'AZURE_OPENAI_API_KEY', }; @@ -172,7 +173,8 @@ async function collectModelConfig( case 'deepseek': case 'mistral': case 'xai': - case 'openrouter': { + case 'openrouter': + case 'requesty': { const envKey = await ensureApiKey(provider, env); return { provider, model, token: { env: envKey } } satisfies LanguageModel; } @@ -337,6 +339,7 @@ export async function collectModels(): Promise<{ models: LanguageModel[]; env: E { value: 'deepseek', name: 'DeepSeek' }, { value: 'mistral', name: 'Mistral' }, { value: 'openrouter', name: 'OpenRouter' }, + { value: 'requesty', name: 'Requesty' }, { value: 'xai', name: 'xAI', description: 'Grok' }, ], }); diff --git a/packages/shared/src/env.server.ts b/packages/shared/src/env.server.ts index 57c83f9f0..f7b291af7 100644 --- a/packages/shared/src/env.server.ts +++ b/packages/shared/src/env.server.ts @@ -295,6 +295,8 @@ const options = { OPENROUTER_API_KEY: z.string().optional(), + REQUESTY_API_KEY: z.string().optional(), + XAI_API_KEY: z.string().optional(), MISTRAL_API_KEY: z.string().optional(), diff --git a/packages/web/src/features/chat/components/chatBox/modelProviderLogo.tsx b/packages/web/src/features/chat/components/chatBox/modelProviderLogo.tsx index 535cc79d3..be7dc78ac 100644 --- a/packages/web/src/features/chat/components/chatBox/modelProviderLogo.tsx +++ b/packages/web/src/features/chat/components/chatBox/modelProviderLogo.tsx @@ -78,6 +78,11 @@ export const ModelProviderLogo = ({ Icon: Box, className: 'text-muted-foreground' }; + case 'requesty': + return { + Icon: Box, + className: 'text-muted-foreground' + }; } }, [provider]); diff --git a/packages/web/src/features/chat/llm.server.ts b/packages/web/src/features/chat/llm.server.ts index 07dad6f0c..dc0b06b54 100644 --- a/packages/web/src/features/chat/llm.server.ts +++ b/packages/web/src/features/chat/llm.server.ts @@ -291,6 +291,22 @@ export const getAISDKLanguageModelAndOptions = async (config: LanguageModel): Pr model: openrouter(modelId), }; } + case 'requesty': { + const requesty = createOpenAICompatible({ + baseURL: config.baseUrl ?? 'https://router.requesty.ai/v1', + name: config.displayName ?? 'requesty', + apiKey: config.token + ? await getTokenFromConfig(config.token) + : env.REQUESTY_API_KEY, + headers: config.headers + ? await extractLanguageModelKeyValuePairs(config.headers) + : undefined, + }); + + return { + model: requesty.chatModel(modelId), + }; + } case 'xai': { const xai = createXai({ baseURL: config.baseUrl, diff --git a/packages/web/src/features/chat/types.ts b/packages/web/src/features/chat/types.ts index 38a737a09..1c171ec8f 100644 --- a/packages/web/src/features/chat/types.ts +++ b/packages/web/src/features/chat/types.ts @@ -199,6 +199,7 @@ export const languageModelProviders = [ "openai", "openai-compatible", "openrouter", + "requesty", "xai", ] as const satisfies readonly LanguageModelProvider[]; diff --git a/schemas/v3/languageModel.json b/schemas/v3/languageModel.json index 3f1d13d52..47ebb0f68 100644 --- a/schemas/v3/languageModel.json +++ b/schemas/v3/languageModel.json @@ -585,6 +585,48 @@ ], "additionalProperties": false }, + "RequestyLanguageModel": { + "type": "object", + "properties": { + "provider": { + "const": "requesty", + "description": "Requesty Configuration" + }, + "model": { + "type": "string", + "description": "The name of the language model in `provider/model` format.", + "examples": [ + "openai/gpt-4o-mini" + ] + }, + "displayName": { + "type": "string", + "description": "Optional display name." + }, + "token": { + "$ref": "./shared.json#/definitions/Token", + "description": "Optional API key to use with the model. Defaults to the `REQUESTY_API_KEY` environment variable." + }, + "baseUrl": { + "type": "string", + "format": "url", + "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", + "description": "Optional base URL. Defaults to `https://router.requesty.ai/v1`." + }, + "temperature": { + "type": "number", + "description": "Optional temperature setting to use with the model." + }, + "headers": { + "$ref": "./shared.json#/definitions/LanguageModelHeaders" + } + }, + "required": [ + "provider", + "model" + ], + "additionalProperties": false + }, "XaiLanguageModel": { "type": "object", "properties": { @@ -663,6 +705,9 @@ { "$ref": "#/definitions/OpenRouterLanguageModel" }, + { + "$ref": "#/definitions/RequestyLanguageModel" + }, { "$ref": "#/definitions/XaiLanguageModel" }