feat: remove OpenRouter Transforms feature (#10341)

- Remove openRouterUseMiddleOutTransform checkbox from settings UI
- Remove openRouterUseMiddleOutTransform from TypeScript types
- Remove transforms parameter logic from OpenRouter handler
- Remove setting from EVALS_SETTINGS
- Remove translation keys from all locale files (18 locales)

Co-authored-by: Roo Code <roomote@roocode.com>
This commit is contained in:
roomote[bot] 2025-12-25 09:53:48 -08:00 committed by GitHub
parent 1e71015e54
commit a07d28c7e6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
25 changed files with 21 additions and 88 deletions

View file

@ -291,7 +291,6 @@ export const isGlobalStateKey = (key: string): key is Keys<GlobalState> =>
// Default settings when running evals (unless overridden).
export const EVALS_SETTINGS: RooCodeSettings = {
apiProvider: "openrouter",
openRouterUseMiddleOutTransform: false,
lastShownAnnouncementId: "jul-09-2025-3-23-0",

View file

@ -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({

View file

@ -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,

View file

@ -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 }),

View file

@ -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,

View file

@ -352,7 +352,6 @@ export type ExtensionState = Pick<
profileThresholds: Record<string, number>
hasOpenedModeSelector: boolean
openRouterImageApiKey?: string
openRouterUseMiddleOutTransform?: boolean
messageQueue?: QueuedMessage[]
lastShownAnnouncementId?: string
apiModelId?: string

View file

@ -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 = ({
</VSCodeButtonLink>
)}
{!simplifySettings && (
<>
<div>
<Checkbox
checked={openRouterBaseUrlSelected}
onChange={(checked: boolean) => {
setOpenRouterBaseUrlSelected(checked)
if (!checked) {
setApiConfigurationField("openRouterBaseUrl", "")
}
}}>
{t("settings:providers.useCustomBaseUrl")}
</Checkbox>
{openRouterBaseUrlSelected && (
<VSCodeTextField
value={apiConfiguration?.openRouterBaseUrl || ""}
type="url"
onInput={handleInputChange("openRouterBaseUrl")}
placeholder="Default: https://openrouter.ai/api/v1"
className="w-full mt-1"
/>
)}
</div>
<div>
<Checkbox
checked={apiConfiguration?.openRouterUseMiddleOutTransform ?? true}
onChange={handleInputChange("openRouterUseMiddleOutTransform", noTransform)}>
<Trans
i18nKey="settings:providers.openRouterTransformsText"
components={{
a: <a href="https://openrouter.ai/docs/transforms" />,
}}
/>
checked={openRouterBaseUrlSelected}
onChange={(checked: boolean) => {
setOpenRouterBaseUrlSelected(checked)
if (!checked) {
setApiConfigurationField("openRouterBaseUrl", "")
}
}}>
{t("settings:providers.useCustomBaseUrl")}
</Checkbox>
</>
{openRouterBaseUrlSelected && (
<VSCodeTextField
value={apiConfiguration?.openRouterBaseUrl || ""}
type="url"
onInput={handleInputChange("openRouterBaseUrl")}
placeholder="Default: https://openrouter.ai/api/v1"
className="w-full mt-1"
/>
)}
</div>
)}
<ModelPicker
apiConfiguration={apiConfiguration}

View file

@ -294,7 +294,6 @@
"getRequestyApiKey": "Obtenir clau API de Requesty",
"getRequestyBaseUrl": "URL base",
"requestyUseCustomBaseUrl": "Utilitza l'URL base personalitzada",
"openRouterTransformsText": "Comprimir prompts i cadenes de missatges a la mida del context (<a>Transformacions d'OpenRouter</a>)",
"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",

View file

@ -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 (<a>OpenRouter Transformationen</a>)",
"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",

View file

@ -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 (<a>OpenRouter Transforms</a>)",
"anthropicApiKey": "Anthropic API Key",
"getAnthropicApiKey": "Get Anthropic API Key",
"anthropicUseAuthToken": "Pass Anthropic API Key as Authorization header instead of X-Api-Key",

View file

@ -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 (<a>Transformaciones de OpenRouter</a>)",
"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",

View file

@ -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 (<a>Transformations OpenRouter</a>)",
"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",

View file

@ -294,7 +294,6 @@
"getRequestyApiKey": "Requesty API कुंजी प्राप्त करें",
"getRequestyBaseUrl": "बेस URL",
"requestyUseCustomBaseUrl": "कस्टम बेस URL का उपयोग करें",
"openRouterTransformsText": "संदर्भ आकार के लिए प्रॉम्प्ट और संदेश श्रृंखलाओं को संपीड़ित करें (<a>OpenRouter ट्रांसफॉर्म</a>)",
"anthropicApiKey": "Anthropic API कुंजी",
"getAnthropicApiKey": "Anthropic API कुंजी प्राप्त करें",
"anthropicUseAuthToken": "X-Api-Key के बजाय Anthropic API कुंजी को Authorization हेडर के रूप में पास करें",

View file

@ -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 (<a>OpenRouter Transforms</a>)",
"anthropicApiKey": "Anthropic API Key",
"getAnthropicApiKey": "Dapatkan Anthropic API Key",
"anthropicUseAuthToken": "Kirim Anthropic API Key sebagai Authorization header alih-alih X-Api-Key",

View file

@ -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 (<a>Trasformazioni OpenRouter</a>)",
"anthropicApiKey": "Chiave API Anthropic",
"getAnthropicApiKey": "Ottieni chiave API Anthropic",
"anthropicUseAuthToken": "Passa la chiave API Anthropic come header di autorizzazione invece di X-Api-Key",

View file

@ -294,7 +294,6 @@
"getRequestyApiKey": "Requesty APIキーを取得",
"getRequestyBaseUrl": "ベースURL",
"requestyUseCustomBaseUrl": "カスタムベースURLを使用する",
"openRouterTransformsText": "プロンプトとメッセージチェーンをコンテキストサイズに圧縮 (<a>OpenRouter Transforms</a>)",
"anthropicApiKey": "Anthropic APIキー",
"getAnthropicApiKey": "Anthropic APIキーを取得",
"anthropicUseAuthToken": "Anthropic APIキーをX-Api-Keyの代わりにAuthorizationヘッダーとして渡す",

View file

@ -294,7 +294,6 @@
"getRequestyApiKey": "Requesty API 키 받기",
"getRequestyBaseUrl": "기본 URL",
"requestyUseCustomBaseUrl": "사용자 정의 기본 URL 사용",
"openRouterTransformsText": "프롬프트와 메시지 체인을 컨텍스트 크기로 압축 (<a>OpenRouter Transforms</a>)",
"anthropicApiKey": "Anthropic API 키",
"getAnthropicApiKey": "Anthropic API 키 받기",
"anthropicUseAuthToken": "X-Api-Key 대신 Authorization 헤더로 Anthropic API 키 전달",

View file

@ -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 (<a>OpenRouter Transforms</a>)",
"anthropicApiKey": "Anthropic API-sleutel",
"getAnthropicApiKey": "Anthropic API-sleutel ophalen",
"anthropicUseAuthToken": "Anthropic API-sleutel als Authorization-header doorgeven in plaats van X-Api-Key",

View file

@ -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 (<a>Transformacje OpenRouter</a>)",
"anthropicApiKey": "Klucz API Anthropic",
"getAnthropicApiKey": "Uzyskaj klucz API Anthropic",
"anthropicUseAuthToken": "Przekaż klucz API Anthropic jako nagłówek Authorization zamiast X-Api-Key",

View file

@ -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 (<a>Transformações OpenRouter</a>)",
"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",

View file

@ -294,7 +294,6 @@
"getRequestyApiKey": "Получить Requesty API-ключ",
"getRequestyBaseUrl": "Базовый URL",
"requestyUseCustomBaseUrl": "Использовать пользовательский базовый URL",
"openRouterTransformsText": "Сжимать подсказки и цепочки сообщений до размера контекста (<a>OpenRouter Transforms</a>)",
"anthropicApiKey": "Anthropic API-ключ",
"getAnthropicApiKey": "Получить Anthropic API-ключ",
"anthropicUseAuthToken": "Передавать Anthropic API-ключ как Authorization-заголовок вместо X-Api-Key",

View file

@ -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 (<a>OpenRouter Dönüşümleri</a>)",
"anthropicApiKey": "Anthropic API Anahtarı",
"getAnthropicApiKey": "Anthropic API Anahtarı Al",
"anthropicUseAuthToken": "Anthropic API Anahtarını X-Api-Key yerine Authorization başlığı olarak geçir",

View file

@ -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 (<a>OpenRouter Transforms</a>)",
"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",

View file

@ -294,7 +294,6 @@
"getRequestyApiKey": "获取 Requesty API 密钥",
"getRequestyBaseUrl": "基础 URL",
"requestyUseCustomBaseUrl": "使用自定义基础 URL",
"openRouterTransformsText": "自动压缩提示词和消息链到上下文长度限制内 (<a>OpenRouter转换</a>)",
"anthropicApiKey": "Anthropic API 密钥",
"getAnthropicApiKey": "获取 Anthropic API 密钥",
"anthropicUseAuthToken": "将 Anthropic API 密钥作为 Authorization 标头传递,而不是 X-Api-Key",

View file

@ -294,7 +294,6 @@
"getRequestyApiKey": "取得 Requesty API 金鑰",
"getRequestyBaseUrl": "基礎 URL",
"requestyUseCustomBaseUrl": "使用自訂基礎 URL",
"openRouterTransformsText": "將提示和訊息鏈壓縮到上下文大小 (<a>OpenRouter 轉換</a>)",
"anthropicApiKey": "Anthropic API 金鑰",
"getAnthropicApiKey": "取得 Anthropic API 金鑰",
"anthropicUseAuthToken": "將 Anthropic API 金鑰作為 Authorization 標頭傳遞,而非使用 X-Api-Key",