Files
CC-Switch/tests/config/therouterProviderPresets.test.ts
T
Jason 1684cb3233 feat(presets): migrate all aggregator and Bedrock presets to Claude Opus 4.7
- OpenClaw: replace opus-4-6 with opus-4-7 across 17 aggregator presets
  (id, name, primary, modelCatalog); AWS Bedrock entry rewritten to new
  SKU anthropic.claude-opus-4-7 (drops -v1 and dated suffix per official
  4.7 model card) and pricing corrected to $5/$25/$0.50/$6.25 during the
  SKU swap, aligning with schema.rs source of truth
- OpenCode: same replacement for 13 aggregators plus
  OPENCODE_PRESET_MODEL_VARIANTS entries for @ai-sdk/amazon-bedrock and
  @ai-sdk/anthropic, plus AWS Bedrock provider models map
- OpenRouter / TheRouter / GitHub Copilot in claudeProviderPresets use
  dot-style id; update to anthropic/claude-opus-4.7 (missed by 509d2250)
- omo: switch agent/category recommended to opus-4-7; replace key in
  OMO_BACKGROUND_TASK_PLACEHOLDER priority map
- hermes_config.rs: update doc comments and test fixtures to opus-4-7;
  Hermes ModelPanel placeholder and i18n defaultHint examples follow
- i18n unspecifiedHigh category description bumped to 'Claude Opus 4.7
  max variant' to match omo recommended
- Test fixtures updated: therouter preset assertion and opencode Bedrock
  variant lookup now check for opus-4-7
- Sonnet 4.6 / Haiku 4.5 untouched - no official 4.7 release for them
2026-04-21 11:57:06 +08:00

67 lines
2.9 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-4.6");
expect(env.ANTHROPIC_DEFAULT_HAIKU_MODEL).toBe(
"anthropic/claude-haiku-4.5",
);
expect(env.ANTHROPIC_DEFAULT_SONNET_MODEL).toBe(
"anthropic/claude-sonnet-4.6",
);
expect(env.ANTHROPIC_DEFAULT_OPUS_MODEL).toBe(
"anthropic/claude-opus-4.7",
);
});
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 = "therouter"');
expect(preset?.config).toContain('model = "openai/gpt-5.3-codex"');
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-2.5-pro");
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-2.5-pro");
});
});