diff --git a/packages/types/src/global-settings.ts b/packages/types/src/global-settings.ts index a11fae1e11..225a27de33 100644 --- a/packages/types/src/global-settings.ts +++ b/packages/types/src/global-settings.ts @@ -291,7 +291,6 @@ export const isGlobalStateKey = (key: string): key is Keys => // Default settings when running evals (unless overridden). export const EVALS_SETTINGS: RooCodeSettings = { apiProvider: "openrouter", - openRouterUseMiddleOutTransform: false, lastShownAnnouncementId: "jul-09-2025-3-23-0", diff --git a/packages/types/src/provider-settings.ts b/packages/types/src/provider-settings.ts index 443cbafcf1..95fbcf10c9 100644 --- a/packages/types/src/provider-settings.ts +++ b/packages/types/src/provider-settings.ts @@ -207,7 +207,6 @@ const openRouterSchema = baseProviderSettingsSchema.extend({ openRouterModelId: z.string().optional(), openRouterBaseUrl: z.string().optional(), openRouterSpecificProvider: z.string().optional(), - openRouterUseMiddleOutTransform: z.boolean().optional(), }) const bedrockSchema = apiModelIdProviderModelSchema.extend({ diff --git a/src/api/providers/__tests__/openrouter.spec.ts b/src/api/providers/__tests__/openrouter.spec.ts index 1ebdd68494..8875df9a47 100644 --- a/src/api/providers/__tests__/openrouter.spec.ts +++ b/src/api/providers/__tests__/openrouter.spec.ts @@ -268,38 +268,11 @@ describe("OpenRouterHandler", () => { stream_options: { include_usage: true }, temperature: 0, top_p: undefined, - transforms: ["middle-out"], }), { headers: { "x-anthropic-beta": "fine-grained-tool-streaming-2025-05-14" } }, ) }) - it("supports the middle-out transform", async () => { - const handler = new OpenRouterHandler({ - ...mockOptions, - openRouterUseMiddleOutTransform: true, - }) - const mockStream = { - async *[Symbol.asyncIterator]() { - yield { - id: "test-id", - choices: [{ delta: { content: "test response" } }], - } - }, - } - - const mockCreate = vitest.fn().mockResolvedValue(mockStream) - ;(OpenAI as any).prototype.chat = { - completions: { create: mockCreate }, - } as any - - await handler.createMessage("test", []).next() - - expect(mockCreate).toHaveBeenCalledWith(expect.objectContaining({ transforms: ["middle-out"] }), { - headers: { "x-anthropic-beta": "fine-grained-tool-streaming-2025-05-14" }, - }) - }) - it("adds cache control for supported models", async () => { const handler = new OpenRouterHandler({ ...mockOptions, diff --git a/src/api/providers/openrouter.ts b/src/api/providers/openrouter.ts index 2f79ec73d7..3e1964e54d 100644 --- a/src/api/providers/openrouter.ts +++ b/src/api/providers/openrouter.ts @@ -293,8 +293,6 @@ export class OpenRouterHandler extends BaseProvider implements SingleCompletionH } } - const transforms = (this.options.openRouterUseMiddleOutTransform ?? true) ? ["middle-out"] : undefined - // https://openrouter.ai/docs/transforms const completionParams: OpenRouterChatCompletionParams = { model: modelId, @@ -313,7 +311,6 @@ export class OpenRouterHandler extends BaseProvider implements SingleCompletionH allow_fallbacks: false, }, }), - ...(transforms && { transforms }), ...(reasoning && { reasoning }), ...(metadata?.tools && { tools: this.convertToolsForOpenAI(metadata.tools) }), ...(metadata?.tool_choice && { tool_choice: metadata.tool_choice }), diff --git a/src/core/webview/ClineProvider.ts b/src/core/webview/ClineProvider.ts index 781c6d8a31..d19a6b6ea6 100644 --- a/src/core/webview/ClineProvider.ts +++ b/src/core/webview/ClineProvider.ts @@ -1896,7 +1896,6 @@ export class ClineProvider imageGenerationProvider, openRouterImageApiKey, openRouterImageGenerationSelectedModel, - openRouterUseMiddleOutTransform, featureRoomoteControlEnabled, isBrowserSessionActive, } = await this.getState() @@ -2067,7 +2066,6 @@ export class ClineProvider imageGenerationProvider, openRouterImageApiKey, openRouterImageGenerationSelectedModel, - openRouterUseMiddleOutTransform, featureRoomoteControlEnabled, claudeCodeIsAuthenticated: await (async () => { try { @@ -2259,7 +2257,6 @@ export class ClineProvider customModes, maxOpenTabsContext: stateValues.maxOpenTabsContext ?? 20, maxWorkspaceFiles: stateValues.maxWorkspaceFiles ?? 200, - openRouterUseMiddleOutTransform: stateValues.openRouterUseMiddleOutTransform, browserToolEnabled: stateValues.browserToolEnabled ?? true, telemetrySetting: stateValues.telemetrySetting || "unset", showRooIgnoredFiles: stateValues.showRooIgnoredFiles ?? false, diff --git a/src/shared/ExtensionMessage.ts b/src/shared/ExtensionMessage.ts index 589d22d383..c83cbc9154 100644 --- a/src/shared/ExtensionMessage.ts +++ b/src/shared/ExtensionMessage.ts @@ -352,7 +352,6 @@ export type ExtensionState = Pick< profileThresholds: Record hasOpenedModeSelector: boolean openRouterImageApiKey?: string - openRouterUseMiddleOutTransform?: boolean messageQueue?: QueuedMessage[] lastShownAnnouncementId?: string apiModelId?: string diff --git a/webview-ui/src/components/settings/providers/OpenRouter.tsx b/webview-ui/src/components/settings/providers/OpenRouter.tsx index 32e0a8bb95..51c75b3f24 100644 --- a/webview-ui/src/components/settings/providers/OpenRouter.tsx +++ b/webview-ui/src/components/settings/providers/OpenRouter.tsx @@ -1,5 +1,4 @@ import { useCallback, useState } from "react" -import { Trans } from "react-i18next" import { Checkbox } from "vscrui" import { VSCodeTextField } from "@vscode/webview-ui-toolkit/react" @@ -11,7 +10,7 @@ import { useAppTranslation } from "@src/i18n/TranslationContext" import { getOpenRouterAuthUrl } from "@src/oauth/urls" import { VSCodeButtonLink } from "@src/components/common/VSCodeButtonLink" -import { inputEventTransform, noTransform } from "../transforms" +import { inputEventTransform } from "../transforms" import { ModelPicker } from "../ModelPicker" import { OpenRouterBalanceDisplay } from "./OpenRouterBalanceDisplay" @@ -78,40 +77,28 @@ export const OpenRouter = ({ )} {!simplifySettings && ( - <> -
- { - setOpenRouterBaseUrlSelected(checked) - - if (!checked) { - setApiConfigurationField("openRouterBaseUrl", "") - } - }}> - {t("settings:providers.useCustomBaseUrl")} - - {openRouterBaseUrlSelected && ( - - )} -
+
- , - }} - /> + checked={openRouterBaseUrlSelected} + onChange={(checked: boolean) => { + setOpenRouterBaseUrlSelected(checked) + + if (!checked) { + setApiConfigurationField("openRouterBaseUrl", "") + } + }}> + {t("settings:providers.useCustomBaseUrl")} - + {openRouterBaseUrlSelected && ( + + )} +
)} Transformacions d'OpenRouter)", "anthropicApiKey": "Clau API d'Anthropic", "getAnthropicApiKey": "Obtenir clau API d'Anthropic", "anthropicUseAuthToken": "Passar la clau API d'Anthropic com a capçalera d'autorització en lloc de X-Api-Key", diff --git a/webview-ui/src/i18n/locales/de/settings.json b/webview-ui/src/i18n/locales/de/settings.json index b84713afca..9b99911067 100644 --- a/webview-ui/src/i18n/locales/de/settings.json +++ b/webview-ui/src/i18n/locales/de/settings.json @@ -296,7 +296,6 @@ "getRequestyApiKey": "Requesty API-Schlüssel erhalten", "getRequestyBaseUrl": "Basis-URL", "requestyUseCustomBaseUrl": "Benutzerdefinierte Basis-URL verwenden", - "openRouterTransformsText": "Prompts und Nachrichtenketten auf Kontextgröße komprimieren (OpenRouter Transformationen)", "anthropicApiKey": "Anthropic API-Schlüssel", "getAnthropicApiKey": "Anthropic API-Schlüssel erhalten", "anthropicUseAuthToken": "Anthropic API-Schlüssel als Authorization-Header anstelle von X-Api-Key übergeben", diff --git a/webview-ui/src/i18n/locales/en/settings.json b/webview-ui/src/i18n/locales/en/settings.json index 63ae8ef45e..c7fa7e0794 100644 --- a/webview-ui/src/i18n/locales/en/settings.json +++ b/webview-ui/src/i18n/locales/en/settings.json @@ -303,7 +303,6 @@ "getRequestyApiKey": "Create new Requesty API Key", "getRequestyBaseUrl": "Base URL", "requestyUseCustomBaseUrl": "Use custom base URL", - "openRouterTransformsText": "Compress prompts and message chains to the context size (OpenRouter Transforms)", "anthropicApiKey": "Anthropic API Key", "getAnthropicApiKey": "Get Anthropic API Key", "anthropicUseAuthToken": "Pass Anthropic API Key as Authorization header instead of X-Api-Key", diff --git a/webview-ui/src/i18n/locales/es/settings.json b/webview-ui/src/i18n/locales/es/settings.json index 8e52b12d28..80b3604af4 100644 --- a/webview-ui/src/i18n/locales/es/settings.json +++ b/webview-ui/src/i18n/locales/es/settings.json @@ -294,7 +294,6 @@ "getRequestyApiKey": "Obtener clave API de Requesty", "getRequestyBaseUrl": "URL base", "requestyUseCustomBaseUrl": "Utilice una URL base personalizada", - "openRouterTransformsText": "Comprimir prompts y cadenas de mensajes al tamaño del contexto (Transformaciones de OpenRouter)", "anthropicApiKey": "Clave API de Anthropic", "getAnthropicApiKey": "Obtener clave API de Anthropic", "anthropicUseAuthToken": "Pasar la clave API de Anthropic como encabezado de autorización en lugar de X-Api-Key", diff --git a/webview-ui/src/i18n/locales/fr/settings.json b/webview-ui/src/i18n/locales/fr/settings.json index 21f11f52c2..332e001e2b 100644 --- a/webview-ui/src/i18n/locales/fr/settings.json +++ b/webview-ui/src/i18n/locales/fr/settings.json @@ -294,7 +294,6 @@ "getRequestyApiKey": "Obtenir la clé API Requesty", "getRequestyBaseUrl": "URL de base", "requestyUseCustomBaseUrl": "Utiliser une URL de base personnalisée", - "openRouterTransformsText": "Compresser les prompts et chaînes de messages à la taille du contexte (Transformations OpenRouter)", "anthropicApiKey": "Clé API Anthropic", "getAnthropicApiKey": "Obtenir la clé API Anthropic", "anthropicUseAuthToken": "Passer la clé API Anthropic comme en-tête d'autorisation au lieu de X-Api-Key", diff --git a/webview-ui/src/i18n/locales/hi/settings.json b/webview-ui/src/i18n/locales/hi/settings.json index 83b9893dcf..e68243284b 100644 --- a/webview-ui/src/i18n/locales/hi/settings.json +++ b/webview-ui/src/i18n/locales/hi/settings.json @@ -294,7 +294,6 @@ "getRequestyApiKey": "Requesty API कुंजी प्राप्त करें", "getRequestyBaseUrl": "बेस URL", "requestyUseCustomBaseUrl": "कस्टम बेस URL का उपयोग करें", - "openRouterTransformsText": "संदर्भ आकार के लिए प्रॉम्प्ट और संदेश श्रृंखलाओं को संपीड़ित करें (OpenRouter ट्रांसफॉर्म)", "anthropicApiKey": "Anthropic API कुंजी", "getAnthropicApiKey": "Anthropic API कुंजी प्राप्त करें", "anthropicUseAuthToken": "X-Api-Key के बजाय Anthropic API कुंजी को Authorization हेडर के रूप में पास करें", diff --git a/webview-ui/src/i18n/locales/id/settings.json b/webview-ui/src/i18n/locales/id/settings.json index 4b058814e5..89d2439092 100644 --- a/webview-ui/src/i18n/locales/id/settings.json +++ b/webview-ui/src/i18n/locales/id/settings.json @@ -298,7 +298,6 @@ "getRequestyApiKey": "Dapatkan Requesty API Key", "getRequestyBaseUrl": "Base URL", "requestyUseCustomBaseUrl": "Gunakan URL dasar khusus", - "openRouterTransformsText": "Kompres prompt dan rantai pesan ke ukuran konteks (OpenRouter Transforms)", "anthropicApiKey": "Anthropic API Key", "getAnthropicApiKey": "Dapatkan Anthropic API Key", "anthropicUseAuthToken": "Kirim Anthropic API Key sebagai Authorization header alih-alih X-Api-Key", diff --git a/webview-ui/src/i18n/locales/it/settings.json b/webview-ui/src/i18n/locales/it/settings.json index f986b9819c..30d10d7564 100644 --- a/webview-ui/src/i18n/locales/it/settings.json +++ b/webview-ui/src/i18n/locales/it/settings.json @@ -294,7 +294,6 @@ "getRequestyApiKey": "Ottieni chiave API Requesty", "getRequestyBaseUrl": "URL base", "requestyUseCustomBaseUrl": "Utilizza URL di base personalizzato", - "openRouterTransformsText": "Comprimi prompt e catene di messaggi alla dimensione del contesto (Trasformazioni OpenRouter)", "anthropicApiKey": "Chiave API Anthropic", "getAnthropicApiKey": "Ottieni chiave API Anthropic", "anthropicUseAuthToken": "Passa la chiave API Anthropic come header di autorizzazione invece di X-Api-Key", diff --git a/webview-ui/src/i18n/locales/ja/settings.json b/webview-ui/src/i18n/locales/ja/settings.json index a73dc43e93..49dad63430 100644 --- a/webview-ui/src/i18n/locales/ja/settings.json +++ b/webview-ui/src/i18n/locales/ja/settings.json @@ -294,7 +294,6 @@ "getRequestyApiKey": "Requesty APIキーを取得", "getRequestyBaseUrl": "ベースURL", "requestyUseCustomBaseUrl": "カスタムベースURLを使用する", - "openRouterTransformsText": "プロンプトとメッセージチェーンをコンテキストサイズに圧縮 (OpenRouter Transforms)", "anthropicApiKey": "Anthropic APIキー", "getAnthropicApiKey": "Anthropic APIキーを取得", "anthropicUseAuthToken": "Anthropic APIキーをX-Api-Keyの代わりにAuthorizationヘッダーとして渡す", diff --git a/webview-ui/src/i18n/locales/ko/settings.json b/webview-ui/src/i18n/locales/ko/settings.json index e180ea2283..168aad0c36 100644 --- a/webview-ui/src/i18n/locales/ko/settings.json +++ b/webview-ui/src/i18n/locales/ko/settings.json @@ -294,7 +294,6 @@ "getRequestyApiKey": "Requesty API 키 받기", "getRequestyBaseUrl": "기본 URL", "requestyUseCustomBaseUrl": "사용자 정의 기본 URL 사용", - "openRouterTransformsText": "프롬프트와 메시지 체인을 컨텍스트 크기로 압축 (OpenRouter Transforms)", "anthropicApiKey": "Anthropic API 키", "getAnthropicApiKey": "Anthropic API 키 받기", "anthropicUseAuthToken": "X-Api-Key 대신 Authorization 헤더로 Anthropic API 키 전달", diff --git a/webview-ui/src/i18n/locales/nl/settings.json b/webview-ui/src/i18n/locales/nl/settings.json index 8da7d91b76..367c0efd86 100644 --- a/webview-ui/src/i18n/locales/nl/settings.json +++ b/webview-ui/src/i18n/locales/nl/settings.json @@ -294,7 +294,6 @@ "getRequestyApiKey": "Requesty API-sleutel ophalen", "getRequestyBaseUrl": "Basis-URL", "requestyUseCustomBaseUrl": "Gebruik aangepaste basis-URL", - "openRouterTransformsText": "Comprimeer prompts en berichtreeksen tot de contextgrootte (OpenRouter Transforms)", "anthropicApiKey": "Anthropic API-sleutel", "getAnthropicApiKey": "Anthropic API-sleutel ophalen", "anthropicUseAuthToken": "Anthropic API-sleutel als Authorization-header doorgeven in plaats van X-Api-Key", diff --git a/webview-ui/src/i18n/locales/pl/settings.json b/webview-ui/src/i18n/locales/pl/settings.json index 2e0116663c..f9f2bf90f8 100644 --- a/webview-ui/src/i18n/locales/pl/settings.json +++ b/webview-ui/src/i18n/locales/pl/settings.json @@ -294,7 +294,6 @@ "getRequestyApiKey": "Uzyskaj klucz API Requesty", "getRequestyBaseUrl": "Bazowy URL", "requestyUseCustomBaseUrl": "Użyj niestandardowego bazowego URL", - "openRouterTransformsText": "Kompresuj podpowiedzi i łańcuchy wiadomości do rozmiaru kontekstu (Transformacje OpenRouter)", "anthropicApiKey": "Klucz API Anthropic", "getAnthropicApiKey": "Uzyskaj klucz API Anthropic", "anthropicUseAuthToken": "Przekaż klucz API Anthropic jako nagłówek Authorization zamiast X-Api-Key", diff --git a/webview-ui/src/i18n/locales/pt-BR/settings.json b/webview-ui/src/i18n/locales/pt-BR/settings.json index 453078d820..6e5f438a6a 100644 --- a/webview-ui/src/i18n/locales/pt-BR/settings.json +++ b/webview-ui/src/i18n/locales/pt-BR/settings.json @@ -294,7 +294,6 @@ "getRequestyApiKey": "Obter chave de API Requesty", "getRequestyBaseUrl": "URL Base", "requestyUseCustomBaseUrl": "Usar URL base personalizada", - "openRouterTransformsText": "Comprimir prompts e cadeias de mensagens para o tamanho do contexto (Transformações OpenRouter)", "anthropicApiKey": "Chave de API Anthropic", "getAnthropicApiKey": "Obter chave de API Anthropic", "anthropicUseAuthToken": "Passar a chave de API Anthropic como cabeçalho Authorization em vez de X-Api-Key", diff --git a/webview-ui/src/i18n/locales/ru/settings.json b/webview-ui/src/i18n/locales/ru/settings.json index 8c62813108..74cd3f9234 100644 --- a/webview-ui/src/i18n/locales/ru/settings.json +++ b/webview-ui/src/i18n/locales/ru/settings.json @@ -294,7 +294,6 @@ "getRequestyApiKey": "Получить Requesty API-ключ", "getRequestyBaseUrl": "Базовый URL", "requestyUseCustomBaseUrl": "Использовать пользовательский базовый URL", - "openRouterTransformsText": "Сжимать подсказки и цепочки сообщений до размера контекста (OpenRouter Transforms)", "anthropicApiKey": "Anthropic API-ключ", "getAnthropicApiKey": "Получить Anthropic API-ключ", "anthropicUseAuthToken": "Передавать Anthropic API-ключ как Authorization-заголовок вместо X-Api-Key", diff --git a/webview-ui/src/i18n/locales/tr/settings.json b/webview-ui/src/i18n/locales/tr/settings.json index 05a12b8100..5026317bd3 100644 --- a/webview-ui/src/i18n/locales/tr/settings.json +++ b/webview-ui/src/i18n/locales/tr/settings.json @@ -294,7 +294,6 @@ "getRequestyApiKey": "Requesty API Anahtarı Al", "getRequestyBaseUrl": "Temel URL", "requestyUseCustomBaseUrl": "Özel temel URL kullan", - "openRouterTransformsText": "İstem ve mesaj zincirlerini bağlam boyutuna sıkıştır (OpenRouter Dönüşümleri)", "anthropicApiKey": "Anthropic API Anahtarı", "getAnthropicApiKey": "Anthropic API Anahtarı Al", "anthropicUseAuthToken": "Anthropic API Anahtarını X-Api-Key yerine Authorization başlığı olarak geçir", diff --git a/webview-ui/src/i18n/locales/vi/settings.json b/webview-ui/src/i18n/locales/vi/settings.json index d310079672..99eb519cb1 100644 --- a/webview-ui/src/i18n/locales/vi/settings.json +++ b/webview-ui/src/i18n/locales/vi/settings.json @@ -294,7 +294,6 @@ "getRequestyApiKey": "Lấy khóa API Requesty", "getRequestyBaseUrl": "URL cơ sở", "requestyUseCustomBaseUrl": "Sử dụng URL cơ sở tùy chỉnh", - "openRouterTransformsText": "Nén lời nhắc và chuỗi tin nhắn theo kích thước ngữ cảnh (OpenRouter Transforms)", "anthropicApiKey": "Khóa API Anthropic", "getAnthropicApiKey": "Lấy khóa API Anthropic", "anthropicUseAuthToken": "Truyền khóa API Anthropic dưới dạng tiêu đề Authorization thay vì X-Api-Key", diff --git a/webview-ui/src/i18n/locales/zh-CN/settings.json b/webview-ui/src/i18n/locales/zh-CN/settings.json index df5583ba34..54de739914 100644 --- a/webview-ui/src/i18n/locales/zh-CN/settings.json +++ b/webview-ui/src/i18n/locales/zh-CN/settings.json @@ -294,7 +294,6 @@ "getRequestyApiKey": "获取 Requesty API 密钥", "getRequestyBaseUrl": "基础 URL", "requestyUseCustomBaseUrl": "使用自定义基础 URL", - "openRouterTransformsText": "自动压缩提示词和消息链到上下文长度限制内 (OpenRouter转换)", "anthropicApiKey": "Anthropic API 密钥", "getAnthropicApiKey": "获取 Anthropic API 密钥", "anthropicUseAuthToken": "将 Anthropic API 密钥作为 Authorization 标头传递,而不是 X-Api-Key", diff --git a/webview-ui/src/i18n/locales/zh-TW/settings.json b/webview-ui/src/i18n/locales/zh-TW/settings.json index 25291e4222..a2e94872af 100644 --- a/webview-ui/src/i18n/locales/zh-TW/settings.json +++ b/webview-ui/src/i18n/locales/zh-TW/settings.json @@ -294,7 +294,6 @@ "getRequestyApiKey": "取得 Requesty API 金鑰", "getRequestyBaseUrl": "基礎 URL", "requestyUseCustomBaseUrl": "使用自訂基礎 URL", - "openRouterTransformsText": "將提示和訊息鏈壓縮到上下文大小 (OpenRouter 轉換)", "anthropicApiKey": "Anthropic API 金鑰", "getAnthropicApiKey": "取得 Anthropic API 金鑰", "anthropicUseAuthToken": "將 Anthropic API 金鑰作為 Authorization 標頭傳遞,而非使用 X-Api-Key",