From cc1f4f6c536989b4aa20c0e20094a25d04446a5a Mon Sep 17 00:00:00 2001 From: decolua Date: Sat, 13 Jun 2026 17:19:56 +0700 Subject: [PATCH] test(open-sse): golden lock provider.js translate-path (A1-prep) Snapshot buildProviderUrl/buildProviderHeaders/getTargetFormat for all providers before merging the translate-path with executor URL/header builders. Co-authored-by: Cursor --- .../golden-provider-service.test.js.snap | 2678 +++++++++++++++++ .../golden-provider-service.test.js | 68 + 2 files changed, 2746 insertions(+) create mode 100644 tests/translator/__snapshots__/golden-provider-service.test.js.snap create mode 100644 tests/translator/golden-provider-service.test.js diff --git a/tests/translator/__snapshots__/golden-provider-service.test.js.snap b/tests/translator/__snapshots__/golden-provider-service.test.js.snap new file mode 100644 index 00000000..2323982d --- /dev/null +++ b/tests/translator/__snapshots__/golden-provider-service.test.js.snap @@ -0,0 +1,2678 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > agentrouter → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Anthropic-Beta": "claude-code-20250219,oauth-2025-04-20,interleaved-thinking-2025-05-14,context-management-2025-06-27,prompt-caching-scope-2026-01-05,advanced-tool-use-2025-11-20,effort-2025-11-24,structured-outputs-2025-12-15,fast-mode-2026-02-01,redact-thinking-2026-02-12,token-efficient-tools-2026-03-28", + "Anthropic-Dangerous-Direct-Browser-Access": "true", + "Anthropic-Version": "2023-06-01", + "Authorization": "Bearer ", + "Content-Type": "application/json", + "User-Agent": "claude-cli/2.1.92 (external, sdk-cli)", + "X-App": "cli", + "X-Stainless-Arch": "arm64", + "X-Stainless-Helper-Method": "stream", + "X-Stainless-Lang": "js", + "X-Stainless-Os": "MacOS", + "X-Stainless-Package-Version": "0.80.0", + "X-Stainless-Retry-Count": "0", + "X-Stainless-Runtime": "node", + "X-Stainless-Runtime-Version": "v24.14.0", + "X-Stainless-Timeout": "600", + }, + "nonStream": { + "Anthropic-Beta": "claude-code-20250219,oauth-2025-04-20,interleaved-thinking-2025-05-14,context-management-2025-06-27,prompt-caching-scope-2026-01-05,advanced-tool-use-2025-11-20,effort-2025-11-24,structured-outputs-2025-12-15,fast-mode-2026-02-01,redact-thinking-2026-02-12,token-efficient-tools-2026-03-28", + "Anthropic-Dangerous-Direct-Browser-Access": "true", + "Anthropic-Version": "2023-06-01", + "Authorization": "Bearer ", + "Content-Type": "application/json", + "User-Agent": "claude-cli/2.1.92 (external, sdk-cli)", + "X-App": "cli", + "X-Stainless-Arch": "arm64", + "X-Stainless-Helper-Method": "stream", + "X-Stainless-Lang": "js", + "X-Stainless-Os": "MacOS", + "X-Stainless-Package-Version": "0.80.0", + "X-Stainless-Retry-Count": "0", + "X-Stainless-Runtime": "node", + "X-Stainless-Runtime-Version": "v24.14.0", + "X-Stainless-Timeout": "600", + }, + "oauth": { + "Accept": "text/event-stream", + "Anthropic-Beta": "claude-code-20250219,oauth-2025-04-20,interleaved-thinking-2025-05-14,context-management-2025-06-27,prompt-caching-scope-2026-01-05,advanced-tool-use-2025-11-20,effort-2025-11-24,structured-outputs-2025-12-15,fast-mode-2026-02-01,redact-thinking-2026-02-12,token-efficient-tools-2026-03-28", + "Anthropic-Dangerous-Direct-Browser-Access": "true", + "Anthropic-Version": "2023-06-01", + "Authorization": "Bearer ", + "Content-Type": "application/json", + "User-Agent": "claude-cli/2.1.92 (external, sdk-cli)", + "X-App": "cli", + "X-Stainless-Arch": "arm64", + "X-Stainless-Helper-Method": "stream", + "X-Stainless-Lang": "js", + "X-Stainless-Os": "MacOS", + "X-Stainless-Package-Version": "0.80.0", + "X-Stainless-Retry-Count": "0", + "X-Stainless-Runtime": "node", + "X-Stainless-Runtime-Version": "v24.14.0", + "X-Stainless-Timeout": "600", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > ai21 → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "nonStream": { + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > aimlapi → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "nonStream": { + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > alicode → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "nonStream": { + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > alicode-intl → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "nonStream": { + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > anthropic → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Anthropic-Beta": "claude-code-20250219,interleaved-thinking-2025-05-14", + "Anthropic-Version": "2023-06-01", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "nonStream": { + "Anthropic-Beta": "claude-code-20250219,interleaved-thinking-2025-05-14", + "Anthropic-Version": "2023-06-01", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "oauth": { + "Accept": "text/event-stream", + "Anthropic-Beta": "claude-code-20250219,interleaved-thinking-2025-05-14", + "Anthropic-Version": "2023-06-01", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > antigravity → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + "User-Agent": "antigravity/1.107.0 darwin/arm64", + }, + "nonStream": { + "Authorization": "Bearer ", + "Content-Type": "application/json", + "User-Agent": "antigravity/1.107.0 darwin/arm64", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + "User-Agent": "antigravity/1.107.0 darwin/arm64", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > assemblyai → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "nonStream": { + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > azure → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "nonStream": { + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > baseten → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "nonStream": { + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > bazaarlink → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "nonStream": { + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > blackbox → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "nonStream": { + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > byteplus → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "nonStream": { + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > bytez → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "nonStream": { + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > cerebras → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "nonStream": { + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > chutes → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "nonStream": { + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > claude → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Anthropic-Beta": "claude-code-20250219,oauth-2025-04-20,interleaved-thinking-2025-05-14,context-management-2025-06-27,prompt-caching-scope-2026-01-05,advanced-tool-use-2025-11-20,effort-2025-11-24,structured-outputs-2025-12-15,fast-mode-2026-02-01,redact-thinking-2026-02-12,token-efficient-tools-2026-03-28", + "Anthropic-Dangerous-Direct-Browser-Access": "true", + "Anthropic-Version": "2023-06-01", + "Content-Type": "application/json", + "User-Agent": "claude-cli/2.1.92 (external, sdk-cli)", + "X-App": "cli", + "X-Stainless-Arch": "arm64", + "X-Stainless-Helper-Method": "stream", + "X-Stainless-Lang": "js", + "X-Stainless-Os": "MacOS", + "X-Stainless-Package-Version": "0.80.0", + "X-Stainless-Retry-Count": "0", + "X-Stainless-Runtime": "node", + "X-Stainless-Runtime-Version": "v24.14.0", + "X-Stainless-Timeout": "600", + "x-api-key": "", + }, + "nonStream": { + "Anthropic-Beta": "claude-code-20250219,oauth-2025-04-20,interleaved-thinking-2025-05-14,context-management-2025-06-27,prompt-caching-scope-2026-01-05,advanced-tool-use-2025-11-20,effort-2025-11-24,structured-outputs-2025-12-15,fast-mode-2026-02-01,redact-thinking-2026-02-12,token-efficient-tools-2026-03-28", + "Anthropic-Dangerous-Direct-Browser-Access": "true", + "Anthropic-Version": "2023-06-01", + "Content-Type": "application/json", + "User-Agent": "claude-cli/2.1.92 (external, sdk-cli)", + "X-App": "cli", + "X-Stainless-Arch": "arm64", + "X-Stainless-Helper-Method": "stream", + "X-Stainless-Lang": "js", + "X-Stainless-Os": "MacOS", + "X-Stainless-Package-Version": "0.80.0", + "X-Stainless-Retry-Count": "0", + "X-Stainless-Runtime": "node", + "X-Stainless-Runtime-Version": "v24.14.0", + "X-Stainless-Timeout": "600", + "x-api-key": "", + }, + "oauth": { + "Accept": "text/event-stream", + "Anthropic-Beta": "claude-code-20250219,oauth-2025-04-20,interleaved-thinking-2025-05-14,context-management-2025-06-27,prompt-caching-scope-2026-01-05,advanced-tool-use-2025-11-20,effort-2025-11-24,structured-outputs-2025-12-15,fast-mode-2026-02-01,redact-thinking-2026-02-12,token-efficient-tools-2026-03-28", + "Anthropic-Dangerous-Direct-Browser-Access": "true", + "Anthropic-Version": "2023-06-01", + "Authorization": "Bearer ", + "Content-Type": "application/json", + "User-Agent": "claude-cli/2.1.92 (external, sdk-cli)", + "X-App": "cli", + "X-Stainless-Arch": "arm64", + "X-Stainless-Helper-Method": "stream", + "X-Stainless-Lang": "js", + "X-Stainless-Os": "MacOS", + "X-Stainless-Package-Version": "0.80.0", + "X-Stainless-Retry-Count": "0", + "X-Stainless-Runtime": "node", + "X-Stainless-Runtime-Version": "v24.14.0", + "X-Stainless-Timeout": "600", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > cline → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + "HTTP-Referer": "https://cline.bot", + "User-Agent": "9Router/0.4.80", + "X-CLIENT-TYPE": "9router", + "X-CLIENT-VERSION": "0.4.80", + "X-CORE-VERSION": "0.4.80", + "X-IS-MULTIROOT": "false", + "X-PLATFORM": "darwin", + "X-PLATFORM-VERSION": "v22.22.0", + "X-Title": "Cline", + }, + "nonStream": { + "Authorization": "Bearer ", + "Content-Type": "application/json", + "HTTP-Referer": "https://cline.bot", + "User-Agent": "9Router/0.4.80", + "X-CLIENT-TYPE": "9router", + "X-CLIENT-VERSION": "0.4.80", + "X-CORE-VERSION": "0.4.80", + "X-IS-MULTIROOT": "false", + "X-PLATFORM": "darwin", + "X-PLATFORM-VERSION": "v22.22.0", + "X-Title": "Cline", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + "HTTP-Referer": "https://cline.bot", + "User-Agent": "9Router/0.4.80", + "X-CLIENT-TYPE": "9router", + "X-CLIENT-VERSION": "0.4.80", + "X-CORE-VERSION": "0.4.80", + "X-IS-MULTIROOT": "false", + "X-PLATFORM": "darwin", + "X-PLATFORM-VERSION": "v22.22.0", + "X-Title": "Cline", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > cloudflare-ai → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "nonStream": { + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > codebuddy → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "nonStream": { + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > codex → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + "User-Agent": "codex_cli_rs/0.136.0", + "originator": "codex_cli_rs", + }, + "nonStream": { + "Authorization": "Bearer ", + "Content-Type": "application/json", + "User-Agent": "codex_cli_rs/0.136.0", + "originator": "codex_cli_rs", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + "User-Agent": "codex_cli_rs/0.136.0", + "originator": "codex_cli_rs", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > cohere → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "nonStream": { + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > commandcode → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + "x-cli-environment": "cli", + "x-command-code-version": "0.25.7", + }, + "nonStream": { + "Authorization": "Bearer ", + "Content-Type": "application/json", + "x-cli-environment": "cli", + "x-command-code-version": "0.25.7", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + "x-cli-environment": "cli", + "x-command-code-version": "0.25.7", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > completions → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "nonStream": { + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > cursor → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/connect+proto", + "User-Agent": "connect-es/1.6.1", + "connect-accept-encoding": "gzip", + "connect-protocol-version": "1", + }, + "nonStream": { + "Authorization": "Bearer ", + "Content-Type": "application/connect+proto", + "User-Agent": "connect-es/1.6.1", + "connect-accept-encoding": "gzip", + "connect-protocol-version": "1", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/connect+proto", + "User-Agent": "connect-es/1.6.1", + "connect-accept-encoding": "gzip", + "connect-protocol-version": "1", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > deepgram → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "nonStream": { + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > deepinfra → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "nonStream": { + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > deepseek → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "nonStream": { + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > enally → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "nonStream": { + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > fireworks → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "nonStream": { + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > freetheai → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "nonStream": { + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > gemini → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Content-Type": "application/json", + "x-goog-api-key": "", + }, + "nonStream": { + "Content-Type": "application/json", + "x-goog-api-key": "", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > gemini-cli → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "nonStream": { + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > github → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + "X-Initiator": "user", + "copilot-integration-id": "vscode-chat", + "editor-plugin-version": "copilot-chat/0.26.7", + "editor-version": "vscode/1.107.1", + "openai-intent": "conversation-panel", + "user-agent": "GitHubCopilotChat/0.26.7", + "x-github-api-version": "2025-04-01", + "x-request-id": "", + "x-vscode-user-agent-library-version": "electron-fetch", + }, + "nonStream": { + "Accept": "application/json", + "Authorization": "Bearer ", + "Content-Type": "application/json", + "X-Initiator": "user", + "copilot-integration-id": "vscode-chat", + "editor-plugin-version": "copilot-chat/0.26.7", + "editor-version": "vscode/1.107.1", + "openai-intent": "conversation-panel", + "user-agent": "GitHubCopilotChat/0.26.7", + "x-github-api-version": "2025-04-01", + "x-request-id": "", + "x-vscode-user-agent-library-version": "electron-fetch", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + "X-Initiator": "user", + "copilot-integration-id": "vscode-chat", + "editor-plugin-version": "copilot-chat/0.26.7", + "editor-version": "vscode/1.107.1", + "openai-intent": "conversation-panel", + "user-agent": "GitHubCopilotChat/0.26.7", + "x-github-api-version": "2025-04-01", + "x-request-id": "", + "x-vscode-user-agent-library-version": "electron-fetch", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > gitlab → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "nonStream": { + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > glhf → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "nonStream": { + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > glm → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Anthropic-Beta": "claude-code-20250219,interleaved-thinking-2025-05-14", + "Anthropic-Version": "2023-06-01", + "Content-Type": "application/json", + "x-api-key": "", + }, + "nonStream": { + "Anthropic-Beta": "claude-code-20250219,interleaved-thinking-2025-05-14", + "Anthropic-Version": "2023-06-01", + "Content-Type": "application/json", + "x-api-key": "", + }, + "oauth": { + "Accept": "text/event-stream", + "Anthropic-Beta": "claude-code-20250219,interleaved-thinking-2025-05-14", + "Anthropic-Version": "2023-06-01", + "Content-Type": "application/json", + "x-api-key": undefined, + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > glm-cn → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "nonStream": { + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > grok-web → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "nonStream": { + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > groq → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "nonStream": { + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > hyperbolic → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "nonStream": { + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > iflow → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + "User-Agent": "iFlow-Cli", + }, + "nonStream": { + "Authorization": "Bearer ", + "Content-Type": "application/json", + "User-Agent": "iFlow-Cli", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + "User-Agent": "iFlow-Cli", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > inference-net → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "nonStream": { + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > kilocode → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "nonStream": { + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > kimi → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Anthropic-Beta": "claude-code-20250219,interleaved-thinking-2025-05-14", + "Anthropic-Version": "2023-06-01", + "Content-Type": "application/json", + "x-api-key": "", + }, + "nonStream": { + "Anthropic-Beta": "claude-code-20250219,interleaved-thinking-2025-05-14", + "Anthropic-Version": "2023-06-01", + "Content-Type": "application/json", + "x-api-key": "", + }, + "oauth": { + "Accept": "text/event-stream", + "Anthropic-Beta": "claude-code-20250219,interleaved-thinking-2025-05-14", + "Anthropic-Version": "2023-06-01", + "Content-Type": "application/json", + "x-api-key": undefined, + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > kimi-coding → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Anthropic-Beta": "claude-code-20250219,interleaved-thinking-2025-05-14", + "Anthropic-Version": "2023-06-01", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "nonStream": { + "Anthropic-Beta": "claude-code-20250219,interleaved-thinking-2025-05-14", + "Anthropic-Version": "2023-06-01", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "oauth": { + "Accept": "text/event-stream", + "Anthropic-Beta": "claude-code-20250219,interleaved-thinking-2025-05-14", + "Anthropic-Version": "2023-06-01", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > kiro → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + "User-Agent": "AWS-SDK-JS/3.0.0 kiro-ide/1.0.0", + "X-Amz-Target": "AmazonCodeWhispererStreamingService.GenerateAssistantResponse", + "X-Amz-User-Agent": "aws-sdk-js/3.0.0 kiro-ide/1.0.0", + }, + "nonStream": { + "Accept": "application/vnd.amazon.eventstream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + "User-Agent": "AWS-SDK-JS/3.0.0 kiro-ide/1.0.0", + "X-Amz-Target": "AmazonCodeWhispererStreamingService.GenerateAssistantResponse", + "X-Amz-User-Agent": "aws-sdk-js/3.0.0 kiro-ide/1.0.0", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + "User-Agent": "AWS-SDK-JS/3.0.0 kiro-ide/1.0.0", + "X-Amz-Target": "AmazonCodeWhispererStreamingService.GenerateAssistantResponse", + "X-Amz-User-Agent": "aws-sdk-js/3.0.0 kiro-ide/1.0.0", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > kluster → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "nonStream": { + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > lepton → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "nonStream": { + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > llm7 → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "nonStream": { + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > longcat → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "nonStream": { + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > mimo-free → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "nonStream": { + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > minimax → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Anthropic-Beta": "claude-code-20250219,interleaved-thinking-2025-05-14", + "Anthropic-Version": "2023-06-01", + "Content-Type": "application/json", + "x-api-key": "", + }, + "nonStream": { + "Anthropic-Beta": "claude-code-20250219,interleaved-thinking-2025-05-14", + "Anthropic-Version": "2023-06-01", + "Content-Type": "application/json", + "x-api-key": "", + }, + "oauth": { + "Accept": "text/event-stream", + "Anthropic-Beta": "claude-code-20250219,interleaved-thinking-2025-05-14", + "Anthropic-Version": "2023-06-01", + "Content-Type": "application/json", + "x-api-key": undefined, + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > minimax-cn → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Anthropic-Beta": "claude-code-20250219,interleaved-thinking-2025-05-14", + "Anthropic-Version": "2023-06-01", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "nonStream": { + "Anthropic-Beta": "claude-code-20250219,interleaved-thinking-2025-05-14", + "Anthropic-Version": "2023-06-01", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "oauth": { + "Accept": "text/event-stream", + "Anthropic-Beta": "claude-code-20250219,interleaved-thinking-2025-05-14", + "Anthropic-Version": "2023-06-01", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > mistral → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "nonStream": { + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > mmf → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "nonStream": { + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > modal → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "nonStream": { + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > morph → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "nonStream": { + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > nanobanana → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "nonStream": { + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > nebius → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "nonStream": { + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > nlpcloud → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "nonStream": { + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > nous-research → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "nonStream": { + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > novita → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "nonStream": { + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > nscale → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "nonStream": { + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > nvidia → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "nonStream": { + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > ollama → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "nonStream": { + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > ollama-local → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "nonStream": { + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > openai → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "nonStream": { + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > opencode → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + "x-opencode-client": "desktop", + }, + "nonStream": { + "Authorization": "Bearer ", + "Content-Type": "application/json", + "x-opencode-client": "desktop", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + "x-opencode-client": "desktop", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > opencode-go → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "nonStream": { + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > openrouter → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + "HTTP-Referer": "https://endpoint-proxy.local", + "X-Title": "Endpoint Proxy", + }, + "nonStream": { + "Authorization": "Bearer ", + "Content-Type": "application/json", + "HTTP-Referer": "https://endpoint-proxy.local", + "X-Title": "Endpoint Proxy", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + "HTTP-Referer": "https://endpoint-proxy.local", + "X-Title": "Endpoint Proxy", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > perplexity → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "nonStream": { + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > perplexity-web → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "nonStream": { + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > predibase → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "nonStream": { + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > publicai → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "nonStream": { + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > puter → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "nonStream": { + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > qoder → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "nonStream": { + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > qwen → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "nonStream": { + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > reka → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "nonStream": { + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > sambanova → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "nonStream": { + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > scaleway → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "nonStream": { + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > siliconflow → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "nonStream": { + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > together → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "nonStream": { + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > uncloseai → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "nonStream": { + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > vercel-ai-gateway → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "nonStream": { + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > vertex → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Content-Type": "application/json", + }, + "nonStream": { + "Content-Type": "application/json", + }, + "oauth": { + "Accept": "text/event-stream", + "Content-Type": "application/json", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > vertex-partner → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Content-Type": "application/json", + }, + "nonStream": { + "Content-Type": "application/json", + }, + "oauth": { + "Accept": "text/event-stream", + "Content-Type": "application/json", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > volcengine-ark → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "nonStream": { + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > xai → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "nonStream": { + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > xiaomi-mimo → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "nonStream": { + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderHeaders (translate path) > xiaomi-tokenplan → headers 1`] = ` +{ + "apiKey": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "nonStream": { + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, + "oauth": { + "Accept": "text/event-stream", + "Authorization": "Bearer ", + "Content-Type": "application/json", + }, +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > agentrouter → url 1`] = ` +{ + "nonStream": "https://agentrouter.org/v1/messages", + "stream": "https://agentrouter.org/v1/messages", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > ai21 → url 1`] = ` +{ + "nonStream": "https://api.ai21.com/studio/v1/chat/completions", + "stream": "https://api.ai21.com/studio/v1/chat/completions", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > aimlapi → url 1`] = ` +{ + "nonStream": "https://api.aimlapi.com/v1/chat/completions", + "stream": "https://api.aimlapi.com/v1/chat/completions", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > alicode → url 1`] = ` +{ + "nonStream": "https://coding.dashscope.aliyuncs.com/v1/chat/completions", + "stream": "https://coding.dashscope.aliyuncs.com/v1/chat/completions", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > alicode-intl → url 1`] = ` +{ + "nonStream": "https://coding-intl.dashscope.aliyuncs.com/v1/chat/completions", + "stream": "https://coding-intl.dashscope.aliyuncs.com/v1/chat/completions", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > anthropic → url 1`] = ` +{ + "nonStream": "https://api.anthropic.com/v1/messages", + "stream": "https://api.anthropic.com/v1/messages", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > antigravity → url 1`] = ` +{ + "nonStream": "https://daily-cloudcode-pa.googleapis.com/v1internal:generateContent", + "stream": "https://daily-cloudcode-pa.googleapis.com/v1internal:streamGenerateContent?alt=sse", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > assemblyai → url 1`] = ` +{ + "nonStream": "https://api.assemblyai.com/v1/audio/transcriptions", + "stream": "https://api.assemblyai.com/v1/audio/transcriptions", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > azure → url 1`] = ` +{ + "nonStream": "", + "stream": "", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > baseten → url 1`] = ` +{ + "nonStream": "https://inference.baseten.co/v1/chat/completions", + "stream": "https://inference.baseten.co/v1/chat/completions", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > bazaarlink → url 1`] = ` +{ + "nonStream": "https://bazaarlink.ai/api/v1/chat/completions", + "stream": "https://bazaarlink.ai/api/v1/chat/completions", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > blackbox → url 1`] = ` +{ + "nonStream": "https://api.blackbox.ai/chat/completions", + "stream": "https://api.blackbox.ai/chat/completions", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > byteplus → url 1`] = ` +{ + "nonStream": "https://ark.ap-southeast.bytepluses.com/api/coding/v3/chat/completions", + "stream": "https://ark.ap-southeast.bytepluses.com/api/coding/v3/chat/completions", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > bytez → url 1`] = ` +{ + "nonStream": "https://api.bytez.com/models/v2", + "stream": "https://api.bytez.com/models/v2", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > cerebras → url 1`] = ` +{ + "nonStream": "https://api.cerebras.ai/v1/chat/completions", + "stream": "https://api.cerebras.ai/v1/chat/completions", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > chutes → url 1`] = ` +{ + "nonStream": "https://llm.chutes.ai/v1/chat/completions", + "stream": "https://llm.chutes.ai/v1/chat/completions", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > claude → url 1`] = ` +{ + "nonStream": "https://api.anthropic.com/v1/messages?beta=true", + "stream": "https://api.anthropic.com/v1/messages?beta=true", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > cline → url 1`] = ` +{ + "nonStream": "https://api.cline.bot/api/v1/chat/completions", + "stream": "https://api.cline.bot/api/v1/chat/completions", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > cloudflare-ai → url 1`] = ` +{ + "nonStream": "https://api.cloudflare.com/client/v4/accounts/{accountId}/ai/v1/chat/completions", + "stream": "https://api.cloudflare.com/client/v4/accounts/{accountId}/ai/v1/chat/completions", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > codebuddy → url 1`] = ` +{ + "nonStream": "https://copilot.tencent.com/v1/chat/completions", + "stream": "https://copilot.tencent.com/v1/chat/completions", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > codex → url 1`] = ` +{ + "nonStream": "https://chatgpt.com/backend-api/codex/responses", + "stream": "https://chatgpt.com/backend-api/codex/responses", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > cohere → url 1`] = ` +{ + "nonStream": "https://api.cohere.ai/v1/chat/completions", + "stream": "https://api.cohere.ai/v1/chat/completions", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > commandcode → url 1`] = ` +{ + "nonStream": "https://api.commandcode.ai/alpha/generate", + "stream": "https://api.commandcode.ai/alpha/generate", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > completions → url 1`] = ` +{ + "nonStream": "https://completions.me/api/v1/chat/completions", + "stream": "https://completions.me/api/v1/chat/completions", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > cursor → url 1`] = ` +{ + "nonStream": "https://api2.cursor.sh", + "stream": "https://api2.cursor.sh", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > deepgram → url 1`] = ` +{ + "nonStream": "https://api.deepgram.com/v1/listen", + "stream": "https://api.deepgram.com/v1/listen", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > deepinfra → url 1`] = ` +{ + "nonStream": "https://api.deepinfra.com/v1/openai/chat/completions", + "stream": "https://api.deepinfra.com/v1/openai/chat/completions", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > deepseek → url 1`] = ` +{ + "nonStream": "https://api.deepseek.com/chat/completions", + "stream": "https://api.deepseek.com/chat/completions", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > enally → url 1`] = ` +{ + "nonStream": "https://ai.enally.in/v1/chat/completions", + "stream": "https://ai.enally.in/v1/chat/completions", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > fireworks → url 1`] = ` +{ + "nonStream": "https://api.fireworks.ai/inference/v1/chat/completions", + "stream": "https://api.fireworks.ai/inference/v1/chat/completions", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > freetheai → url 1`] = ` +{ + "nonStream": "https://api.freetheai.xyz/v1/chat/completions", + "stream": "https://api.freetheai.xyz/v1/chat/completions", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > gemini → url 1`] = ` +{ + "nonStream": "https://generativelanguage.googleapis.com/v1beta/models/test-model:generateContent", + "stream": "https://generativelanguage.googleapis.com/v1beta/models/test-model:streamGenerateContent?alt=sse", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > gemini-cli → url 1`] = ` +{ + "nonStream": "https://cloudcode-pa.googleapis.com/v1internal:generateContent", + "stream": "https://cloudcode-pa.googleapis.com/v1internal:streamGenerateContent?alt=sse", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > github → url 1`] = ` +{ + "nonStream": "https://api.githubcopilot.com/chat/completions", + "stream": "https://api.githubcopilot.com/chat/completions", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > gitlab → url 1`] = ` +{ + "nonStream": "https://gitlab.com/api/v4/chat/completions", + "stream": "https://gitlab.com/api/v4/chat/completions", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > glhf → url 1`] = ` +{ + "nonStream": "https://glhf.chat/api/openai/v1/chat/completions", + "stream": "https://glhf.chat/api/openai/v1/chat/completions", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > glm → url 1`] = ` +{ + "nonStream": "https://api.z.ai/api/anthropic/v1/messages?beta=true", + "stream": "https://api.z.ai/api/anthropic/v1/messages?beta=true", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > glm-cn → url 1`] = ` +{ + "nonStream": "https://open.bigmodel.cn/api/coding/paas/v4/chat/completions", + "stream": "https://open.bigmodel.cn/api/coding/paas/v4/chat/completions", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > grok-web → url 1`] = ` +{ + "nonStream": "https://grok.com/rest/app-chat/conversations/new", + "stream": "https://grok.com/rest/app-chat/conversations/new", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > groq → url 1`] = ` +{ + "nonStream": "https://api.groq.com/openai/v1/chat/completions", + "stream": "https://api.groq.com/openai/v1/chat/completions", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > hyperbolic → url 1`] = ` +{ + "nonStream": "https://api.hyperbolic.xyz/v1/chat/completions", + "stream": "https://api.hyperbolic.xyz/v1/chat/completions", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > iflow → url 1`] = ` +{ + "nonStream": "https://apis.iflow.cn/v1/chat/completions", + "stream": "https://apis.iflow.cn/v1/chat/completions", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > inference-net → url 1`] = ` +{ + "nonStream": "https://api.inference.net/v1/chat/completions", + "stream": "https://api.inference.net/v1/chat/completions", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > kilocode → url 1`] = ` +{ + "nonStream": "https://api.kilo.ai/api/openrouter/chat/completions", + "stream": "https://api.kilo.ai/api/openrouter/chat/completions", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > kimi → url 1`] = ` +{ + "nonStream": "https://api.kimi.com/coding/v1/messages?beta=true", + "stream": "https://api.kimi.com/coding/v1/messages?beta=true", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > kimi-coding → url 1`] = ` +{ + "nonStream": "https://api.kimi.com/coding/v1/messages", + "stream": "https://api.kimi.com/coding/v1/messages", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > kiro → url 1`] = ` +{ + "nonStream": "https://runtime.us-east-1.kiro.dev/generateAssistantResponse", + "stream": "https://runtime.us-east-1.kiro.dev/generateAssistantResponse", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > kluster → url 1`] = ` +{ + "nonStream": "https://api.kluster.ai/v1/chat/completions", + "stream": "https://api.kluster.ai/v1/chat/completions", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > lepton → url 1`] = ` +{ + "nonStream": "https://api.lepton.ai/api/v1/chat/completions", + "stream": "https://api.lepton.ai/api/v1/chat/completions", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > llm7 → url 1`] = ` +{ + "nonStream": "https://api.llm7.io/v1/chat/completions", + "stream": "https://api.llm7.io/v1/chat/completions", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > longcat → url 1`] = ` +{ + "nonStream": "https://api.longcat.chat/openai/v1/chat/completions", + "stream": "https://api.longcat.chat/openai/v1/chat/completions", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > mimo-free → url 1`] = ` +{ + "nonStream": "https://api.xiaomimimo.com/api/free-ai/openai/chat", + "stream": "https://api.xiaomimimo.com/api/free-ai/openai/chat", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > minimax → url 1`] = ` +{ + "nonStream": "https://api.minimax.io/anthropic/v1/messages?beta=true", + "stream": "https://api.minimax.io/anthropic/v1/messages?beta=true", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > minimax-cn → url 1`] = ` +{ + "nonStream": "https://api.minimaxi.com/anthropic/v1/messages", + "stream": "https://api.minimaxi.com/anthropic/v1/messages", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > mistral → url 1`] = ` +{ + "nonStream": "https://api.mistral.ai/v1/chat/completions", + "stream": "https://api.mistral.ai/v1/chat/completions", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > mmf → url 1`] = ` +{ + "nonStream": "https://api.xiaomimimo.com/api/free-ai/openai/chat", + "stream": "https://api.xiaomimimo.com/api/free-ai/openai/chat", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > modal → url 1`] = ` +{ + "nonStream": "https://api.modal.com/v1/chat/completions", + "stream": "https://api.modal.com/v1/chat/completions", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > morph → url 1`] = ` +{ + "nonStream": "https://api.morphllm.com/v1/chat/completions", + "stream": "https://api.morphllm.com/v1/chat/completions", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > nanobanana → url 1`] = ` +{ + "nonStream": "https://api.nanobananaapi.ai/v1/chat/completions", + "stream": "https://api.nanobananaapi.ai/v1/chat/completions", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > nebius → url 1`] = ` +{ + "nonStream": "https://api.studio.nebius.ai/v1/chat/completions", + "stream": "https://api.studio.nebius.ai/v1/chat/completions", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > nlpcloud → url 1`] = ` +{ + "nonStream": "https://api.nlpcloud.io/v1/gpu/chatbot", + "stream": "https://api.nlpcloud.io/v1/gpu/chatbot", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > nous-research → url 1`] = ` +{ + "nonStream": "https://inference-api.nousresearch.com/v1/chat/completions", + "stream": "https://inference-api.nousresearch.com/v1/chat/completions", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > novita → url 1`] = ` +{ + "nonStream": "https://api.novita.ai/v3/openai/chat/completions", + "stream": "https://api.novita.ai/v3/openai/chat/completions", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > nscale → url 1`] = ` +{ + "nonStream": "https://inference.api.nscale.com/v1/chat/completions", + "stream": "https://inference.api.nscale.com/v1/chat/completions", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > nvidia → url 1`] = ` +{ + "nonStream": "https://integrate.api.nvidia.com/v1/chat/completions", + "stream": "https://integrate.api.nvidia.com/v1/chat/completions", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > ollama → url 1`] = ` +{ + "nonStream": "https://ollama.com/api/chat", + "stream": "https://ollama.com/api/chat", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > ollama-local → url 1`] = ` +{ + "nonStream": "http://localhost:11434/api/chat", + "stream": "http://localhost:11434/api/chat", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > openai → url 1`] = ` +{ + "nonStream": "https://api.openai.com/v1/chat/completions", + "stream": "https://api.openai.com/v1/chat/completions", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > opencode → url 1`] = ` +{ + "nonStream": "https://opencode.ai", + "stream": "https://opencode.ai", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > opencode-go → url 1`] = ` +{ + "nonStream": "https://opencode.ai/zen/go/v1/chat/completions", + "stream": "https://opencode.ai/zen/go/v1/chat/completions", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > openrouter → url 1`] = ` +{ + "nonStream": "https://openrouter.ai/api/v1/chat/completions", + "stream": "https://openrouter.ai/api/v1/chat/completions", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > perplexity → url 1`] = ` +{ + "nonStream": "https://api.perplexity.ai/chat/completions", + "stream": "https://api.perplexity.ai/chat/completions", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > perplexity-web → url 1`] = ` +{ + "nonStream": "https://www.perplexity.ai/rest/sse/perplexity_ask", + "stream": "https://www.perplexity.ai/rest/sse/perplexity_ask", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > predibase → url 1`] = ` +{ + "nonStream": "https://serving.app.predibase.com/v1/chat/completions", + "stream": "https://serving.app.predibase.com/v1/chat/completions", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > publicai → url 1`] = ` +{ + "nonStream": "https://api.publicai.co/v1/chat/completions", + "stream": "https://api.publicai.co/v1/chat/completions", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > puter → url 1`] = ` +{ + "nonStream": "https://api.puter.com/puterai/openai/v1/chat/completions", + "stream": "https://api.puter.com/puterai/openai/v1/chat/completions", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > qoder → url 1`] = ` +{ + "nonStream": "https://api3.qoder.sh/algo/api/v2/service/pro/sse/agent_chat_generation", + "stream": "https://api3.qoder.sh/algo/api/v2/service/pro/sse/agent_chat_generation", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > qwen → url 1`] = ` +{ + "nonStream": "https://portal.qwen.ai/v1/chat/completions", + "stream": "https://portal.qwen.ai/v1/chat/completions", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > reka → url 1`] = ` +{ + "nonStream": "https://api.reka.ai/v1/chat/completions", + "stream": "https://api.reka.ai/v1/chat/completions", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > sambanova → url 1`] = ` +{ + "nonStream": "https://api.sambanova.ai/v1/chat/completions", + "stream": "https://api.sambanova.ai/v1/chat/completions", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > scaleway → url 1`] = ` +{ + "nonStream": "https://api.scaleway.ai/v1/chat/completions", + "stream": "https://api.scaleway.ai/v1/chat/completions", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > siliconflow → url 1`] = ` +{ + "nonStream": "https://api.siliconflow.com/v1/chat/completions", + "stream": "https://api.siliconflow.com/v1/chat/completions", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > together → url 1`] = ` +{ + "nonStream": "https://api.together.xyz/v1/chat/completions", + "stream": "https://api.together.xyz/v1/chat/completions", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > uncloseai → url 1`] = ` +{ + "nonStream": "https://hermes.ai.unturf.com/v1/chat/completions", + "stream": "https://hermes.ai.unturf.com/v1/chat/completions", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > vercel-ai-gateway → url 1`] = ` +{ + "nonStream": "https://ai-gateway.vercel.sh/v1/chat/completions", + "stream": "https://ai-gateway.vercel.sh/v1/chat/completions", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > vertex → url 1`] = ` +{ + "nonStream": "https://aiplatform.googleapis.com", + "stream": "https://aiplatform.googleapis.com", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > vertex-partner → url 1`] = ` +{ + "nonStream": "https://aiplatform.googleapis.com", + "stream": "https://aiplatform.googleapis.com", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > volcengine-ark → url 1`] = ` +{ + "nonStream": "https://ark.cn-beijing.volces.com/api/coding/v3/chat/completions", + "stream": "https://ark.cn-beijing.volces.com/api/coding/v3/chat/completions", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > xai → url 1`] = ` +{ + "nonStream": "https://api.x.ai/v1/chat/completions", + "stream": "https://api.x.ai/v1/chat/completions", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > xiaomi-mimo → url 1`] = ` +{ + "nonStream": "https://api.xiaomimimo.com/v1/chat/completions", + "stream": "https://api.xiaomimimo.com/v1/chat/completions", +} +`; + +exports[`GOLDEN provider.js buildProviderUrl (translate path) > xiaomi-tokenplan → url 1`] = ` +{ + "nonStream": "https://token-plan-sgp.xiaomimimo.com/v1/chat/completions", + "stream": "https://token-plan-sgp.xiaomimimo.com/v1/chat/completions", +} +`; + +exports[`GOLDEN provider.js getTargetFormat > all providers → format 1`] = ` +{ + "agentrouter": "claude", + "ai21": "openai", + "aimlapi": "openai", + "alicode": "openai", + "alicode-intl": "openai", + "anthropic": "claude", + "antigravity": "antigravity", + "assemblyai": "openai", + "azure": "openai", + "baseten": "openai", + "bazaarlink": "openai", + "blackbox": "openai", + "byteplus": "openai", + "bytez": "openai", + "cerebras": "openai", + "chutes": "openai", + "claude": "claude", + "cline": "openai", + "cloudflare-ai": "openai", + "codebuddy": "openai", + "codex": "openai-responses", + "cohere": "openai", + "commandcode": "commandcode", + "completions": "openai", + "cursor": "cursor", + "deepgram": "openai", + "deepinfra": "openai", + "deepseek": "openai", + "enally": "openai", + "fireworks": "openai", + "freetheai": "openai", + "gemini": "gemini", + "gemini-cli": "gemini-cli", + "github": "openai", + "gitlab": "openai", + "glhf": "openai", + "glm": "claude", + "glm-cn": "openai", + "grok-web": "grok-web", + "groq": "openai", + "hyperbolic": "openai", + "iflow": "openai", + "inference-net": "openai", + "kilocode": "openai", + "kimi": "claude", + "kimi-coding": "claude", + "kiro": "kiro", + "kluster": "openai", + "lepton": "openai", + "llm7": "openai", + "longcat": "openai", + "mimo-free": "openai", + "minimax": "claude", + "minimax-cn": "claude", + "mistral": "openai", + "mmf": "openai", + "modal": "openai", + "morph": "openai", + "nanobanana": "openai", + "nebius": "openai", + "nlpcloud": "openai", + "nous-research": "openai", + "novita": "openai", + "nscale": "openai", + "nvidia": "openai", + "ollama": "ollama", + "ollama-local": "ollama", + "openai": "openai", + "opencode": "openai", + "opencode-go": "openai", + "openrouter": "openai", + "perplexity": "openai", + "perplexity-web": "perplexity-web", + "predibase": "openai", + "publicai": "openai", + "puter": "openai", + "qoder": "openai", + "qwen": "openai", + "reka": "openai", + "sambanova": "openai", + "scaleway": "openai", + "siliconflow": "openai", + "together": "openai", + "uncloseai": "openai", + "vercel-ai-gateway": "openai", + "vertex": "vertex", + "vertex-partner": "openai", + "volcengine-ark": "openai", + "xai": "openai", + "xiaomi-mimo": "openai", + "xiaomi-tokenplan": "openai", +} +`; diff --git a/tests/translator/golden-provider-service.test.js b/tests/translator/golden-provider-service.test.js new file mode 100644 index 00000000..29dbfeae --- /dev/null +++ b/tests/translator/golden-provider-service.test.js @@ -0,0 +1,68 @@ +// A1 GOLDEN: lock OUTPUT của services/provider.js (translate route path) trên code CŨ. +// buildProviderUrl/buildProviderHeaders/getTargetFormat — đường SONG SONG với executor. +// Mục tiêu: trước khi hợp nhất 2 đường, chốt behavior translate-path hiện tại. +import { describe, it, expect } from "vitest"; +import { PROVIDERS } from "../../open-sse/config/providers.js"; +import { + buildProviderUrl, + buildProviderHeaders, + getTargetFormat, +} from "../../open-sse/services/provider.js"; + +const API_KEY_CRED = { apiKey: "sk-test-APIKEY", providerSpecificData: {} }; +const OAUTH_CRED = { accessToken: "tok-test-ACCESS", providerSpecificData: {} }; + +// Khử token + field động (github x-request-id uuid, kimi device-id) để snapshot ổn định. +function sanitize(headers) { + const out = {}; + for (const [k, v] of Object.entries(headers)) { + out[k] = typeof v === "string" + ? v.replace(/Bearer .+/, "Bearer ") + .replace(/sk-test-APIKEY|tok-test-ACCESS/g, "") + .replace(/kimi-\d{10,}/g, "kimi-") + .replace(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i, "") + : v; + } + return out; +} + +const providerIds = Object.keys(PROVIDERS).sort(); + +function safe(fn) { + try { return fn(); } catch (e) { return `THROW: ${e.message}`; } +} + +describe("GOLDEN provider.js buildProviderUrl (translate path)", () => { + for (const pid of providerIds) { + it(`${pid} → url`, () => { + const snap = { + stream: safe(() => buildProviderUrl(pid, "test-model", true, {})), + nonStream: safe(() => buildProviderUrl(pid, "test-model", false, {})), + }; + expect(snap).toMatchSnapshot(); + }); + } +}); + +describe("GOLDEN provider.js buildProviderHeaders (translate path)", () => { + for (const pid of providerIds) { + it(`${pid} → headers`, () => { + const cred = PROVIDERS[pid].noAuth ? {} : API_KEY_CRED; + const credOauth = PROVIDERS[pid].noAuth ? {} : OAUTH_CRED; + const snap = { + apiKey: safe(() => sanitize(buildProviderHeaders(pid, cred, true))), + oauth: safe(() => sanitize(buildProviderHeaders(pid, credOauth, true))), + nonStream: safe(() => sanitize(buildProviderHeaders(pid, cred, false))), + }; + expect(snap).toMatchSnapshot(); + }); + } +}); + +describe("GOLDEN provider.js getTargetFormat", () => { + it("all providers → format", () => { + const snap = {}; + for (const pid of providerIds) snap[pid] = safe(() => getTargetFormat(pid)); + expect(snap).toMatchSnapshot(); + }); +});