mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-10-25 17:22:27 +08:00
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.
86 lines
3.1 KiB
TypeScript
86 lines
3.1 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import {
|
|
OPENCODE_PRESET_MODEL_VARIANTS,
|
|
opencodeProviderPresets,
|
|
} from "@/config/opencodeProviderPresets";
|
|
import { openclawProviderPresets } from "@/config/openclawProviderPresets";
|
|
|
|
describe("TheRouter OpenCode and OpenClaw presets", () => {
|
|
it("uses OpenAI-compatible config for OpenCode", () => {
|
|
const preset = opencodeProviderPresets.find(
|
|
(item) => item.name === "TheRouter",
|
|
);
|
|
const models = preset?.settingsConfig.models ?? {};
|
|
|
|
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?.settingsConfig.npm).toBe("@ai-sdk/openai-compatible");
|
|
expect(preset?.settingsConfig.options?.baseURL).toBe(
|
|
"https://api.therouter.ai/v1",
|
|
);
|
|
expect(preset?.settingsConfig.options?.setCacheKey).toBe(true);
|
|
expect(models).toHaveProperty("openai/gpt-6.1-sol");
|
|
expect(models).toHaveProperty("anthropic/claude-sonnet-5-5");
|
|
expect(models).toHaveProperty("google/gemini-3.8-flash");
|
|
expect(models["google/gemini-3.8-flash"]?.name).toBe("Gemini 3.8 Flash");
|
|
});
|
|
|
|
it("uses OpenAI completions config for OpenClaw", () => {
|
|
const preset = openclawProviderPresets.find(
|
|
(item) => item.name === "TheRouter",
|
|
);
|
|
const openClawModels = preset?.settingsConfig.models ?? [];
|
|
const modelIds = openClawModels.map((model) => model.id);
|
|
|
|
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?.settingsConfig.baseUrl).toBe("https://api.therouter.ai/v1");
|
|
expect(preset?.settingsConfig.api).toBe("openai-completions");
|
|
expect(modelIds).toEqual(
|
|
expect.arrayContaining([
|
|
"anthropic/claude-sonnet-5-5",
|
|
"openai/gpt-6.1-sol",
|
|
"openai/gpt-6-astra",
|
|
"google/gemini-3.8-flash",
|
|
]),
|
|
);
|
|
expect(
|
|
openClawModels.find((model) => model.id === "google/gemini-3.8-flash"),
|
|
).toMatchObject({
|
|
name: "Gemini 3.8 Flash",
|
|
cost: { input: 1.5, output: 9, cacheRead: 0.15 },
|
|
});
|
|
expect(preset?.suggestedDefaults?.model).toEqual({
|
|
primary: "therouter/anthropic/claude-sonnet-5-5",
|
|
fallbacks: [
|
|
"therouter/openai/gpt-6-astra",
|
|
"therouter/google/gemini-3.8-flash",
|
|
],
|
|
});
|
|
});
|
|
|
|
it("keeps Google OpenCode preset model ids unique", () => {
|
|
const googleModels = OPENCODE_PRESET_MODEL_VARIANTS["@ai-sdk/google"];
|
|
const ids = googleModels.map((model) => model.id);
|
|
const geminiFlashModels = googleModels.filter(
|
|
(model) => model.id === "gemini-3.6-flash",
|
|
);
|
|
|
|
expect(new Set(ids).size).toBe(ids.length);
|
|
expect(geminiFlashModels).toHaveLength(1);
|
|
expect(geminiFlashModels[0]).toMatchObject({
|
|
name: "Gemini 3.6 Flash",
|
|
variants: {
|
|
minimal: expect.any(Object),
|
|
low: expect.any(Object),
|
|
medium: expect.any(Object),
|
|
high: expect.any(Object),
|
|
},
|
|
});
|
|
});
|
|
});
|