Files
cc-switch/tests/config/therouterProviderPresets.test.ts
T
Jason 50a9d103d3 chore(presets): refresh preset models to the latest vendor lineups
Move first-party, sponsor and relay presets to current model IDs so a
pasted Key works without editing the model list.

- Claude: opus/sonnet 5 -> 5.5, haiku 4.5 -> 5.5, fable 5 -> 5.1
- GPT: gpt-5.6-sol / gpt-6-sol -> gpt-6.1-sol; add gpt-6-astra/luna
- Gemini 3.6 Flash -> 3.8 Flash, 3.1 Pro preview -> 4 Argon;
  Grok 4.5 -> 4.7; GLM 5.1/5.2 -> 5.3 (+5.3 Flash);
  DeepSeek V4 Flash -> V4.1 Flash; Doubao 2.1 Pro 260628 -> 260915;
  StepFun Step Plan -> step-5-preview; add Kimi K3.1 Pro, Qwen3.8 Max,
  MiniMax M3.1 Flash where the site serves them
- Drop retired models: NVIDIA moonshotai/kimi-k3 (EOL 2026-10-15,
  now kimi-k2.6 without unverified Codex reasoning levels),
  MiMo V2.5 / V2.5 Pro, Claude Sonnet 4.5, MiniMax M2.7 on Tencent
  Token Plan Enterprise Pro
- Relay presets follow each site's own ID spelling and catalog;
  DIT.ai, BuyToken and hao.ai are left as configured from their docs;
  Soshow, SiliconFlow CN, OpenCode Zen and the Ark rolling alias stay
- MoArk Codex keeps the tested Kimi-K2.7-Code; K3.1 Pro and Qwen3.8
  Max stay out of its Codex catalog until their levels are verified

Tests updated to the new IDs; cross-app invariants unchanged.
2026-10-24 22:56:15 +08:00

70 lines
3.1 KiB
TypeScript

import { describe, expect, it } from "vitest";
import { providerPresets } from "@/config/claudeProviderPresets";
import { codexProviderPresets } from "@/config/codexProviderPresets";
import { geminiProviderPresets } from "@/config/geminiProviderPresets";
describe("TheRouter provider presets", () => {
it("uses the Anthropic-compatible root endpoint for Claude", () => {
const preset = providerPresets.find((item) => item.name === "TheRouter");
expect(preset).toBeDefined();
expect(preset?.websiteUrl).toBe("https://therouter.ai");
expect(preset?.apiKeyUrl).toBe("https://dashboard.therouter.ai");
expect(preset?.category).toBe("aggregator");
expect(preset?.endpointCandidates).toEqual(["https://api.therouter.ai"]);
const env = (preset?.settingsConfig as { env: Record<string, string> }).env;
expect(env.ANTHROPIC_BASE_URL).toBe("https://api.therouter.ai");
expect(env.ANTHROPIC_AUTH_TOKEN).toBe("");
expect(env.ANTHROPIC_API_KEY).toBe("");
expect(env.ANTHROPIC_MODEL).toBe("anthropic/claude-sonnet-5-5");
expect(env.ANTHROPIC_DEFAULT_HAIKU_MODEL).toBe(
"anthropic/claude-haiku-5-5",
);
expect(env.ANTHROPIC_DEFAULT_SONNET_MODEL).toBe(
"anthropic/claude-sonnet-5-5",
);
expect(env.ANTHROPIC_DEFAULT_OPUS_MODEL).toBe("anthropic/claude-opus-5-5");
});
it("uses the OpenAI-compatible v1 endpoint for Codex", () => {
const preset = codexProviderPresets.find(
(item) => item.name === "TheRouter",
);
expect(preset).toBeDefined();
expect(preset?.websiteUrl).toBe("https://therouter.ai");
expect(preset?.apiKeyUrl).toBe("https://dashboard.therouter.ai");
expect(preset?.category).toBe("aggregator");
expect(preset?.endpointCandidates).toEqual(["https://api.therouter.ai/v1"]);
expect(preset?.auth).toEqual({ OPENAI_API_KEY: "" });
expect(preset?.config).toContain('model_provider = "custom"');
expect(preset?.config).toContain("[model_providers.custom]");
expect(preset?.config).toContain('name = "therouter"');
expect(preset?.config).toContain('model = "openai/gpt-6.1-sol"');
expect(preset?.config).not.toContain("goals = true");
expect(preset?.config).toContain(
'base_url = "https://api.therouter.ai/v1"',
);
expect(preset?.config).toContain('wire_api = "responses"');
});
it("uses the Gemini-native root endpoint for Gemini", () => {
const preset = geminiProviderPresets.find(
(item) => item.name === "TheRouter",
);
expect(preset).toBeDefined();
expect(preset?.websiteUrl).toBe("https://therouter.ai");
expect(preset?.apiKeyUrl).toBe("https://dashboard.therouter.ai");
expect(preset?.category).toBe("aggregator");
expect(preset?.endpointCandidates).toEqual(["https://api.therouter.ai"]);
expect(preset?.baseURL).toBe("https://api.therouter.ai");
expect(preset?.model).toBe("gemini-3.8-flash");
const env = (preset?.settingsConfig as { env: Record<string, string> }).env;
expect(env.GOOGLE_GEMINI_BASE_URL).toBe("https://api.therouter.ai");
expect(env.GEMINI_MODEL).toBe("gemini-3.8-flash");
});
});