diff --git a/src/renderer/src/settings/pages/model/__tests__/preset-brands.test.ts b/src/renderer/src/settings/pages/model/__tests__/preset-brands.test.ts index 6a63a77c..ecbaf48b 100644 --- a/src/renderer/src/settings/pages/model/__tests__/preset-brands.test.ts +++ b/src/renderer/src/settings/pages/model/__tests__/preset-brands.test.ts @@ -1,9 +1,9 @@ /** - * 49 个内置预设各自该显示**谁**的 logo —— 一张钉死的对照表。 + * 50 个内置预设各自该显示**谁**的 logo —— 一张钉死的对照表。 * * **为什么值得单独一个文件:** `brands.test.ts` 守的是规则表本身自洽 * (每个牌子有样本、顺序不打架),但它不知道「添加供应商」目录里到底摆着 - * 哪 49 个名字。而两张表是**分开演进**的:presets.ts 加一家、或者给某家改个 + * 哪 50 个名字。而两张表是**分开演进**的:presets.ts 加一家、或者给某家改个 * 更好听的名字,`brands.ts` 一个字都不用动就能悄悄错掉一个 logo。 * * ★★ 这不是假想。这张表第一次跑出来时,43 家里 **13 家没有图标、3 家挂着 @@ -24,8 +24,8 @@ import { resolveBrand, type Brand } from '../../../../components/brand/brands' /** * `null` = 我们**故意**不给它图标,退回首字母。 - * 六家都是 lobehub 根本没收字形的(逐个在 `@lobehub/icons-static-svg/icons/` - * 下找过):Requesty、Opper、API Route、OhMyGPT、LocalAI,以及 llama.cpp —— 最后这个是 ggerganov 的 + * 七家都是 lobehub 根本没收字形的(逐个在 `@lobehub/icons-static-svg/icons/` + * 下找过):Requesty、Opper、API Route、Cheaper Inference、OhMyGPT、LocalAI,以及 llama.cpp —— 最后这个是 ggerganov 的 * 独立项目,不是 Meta 的东西。 * * ★ 编一个「差不多的」图标比没有图标更糟:用户看见 Meta 的 ∞ 会以为 @@ -86,6 +86,7 @@ const EXPECTED: Readonly> = { opper: null, 'api-route': null, atlascloud: 'atlascloud', + cheaperinference: null, siliconflow: 'siliconcloud', 'siliconflow-intl': 'siliconcloud', together: 'together', @@ -128,10 +129,10 @@ describe('内置预设的品牌图标', () => { * 「null 只有这么几家」:某天规则表改窄了让一堆家一起掉进 null, * 这里会红,而界面上只会安静地多出几个字母。 */ - it('没有图标的就是这六家,不多不少', () => { + it('没有图标的就是这七家,不多不少', () => { const blank = PROVIDER_PRESETS.filter((p) => resolveBrand(p.name, p.id) === null).map( (p) => p.id ) - expect(blank).toEqual(['requesty', 'opper', 'api-route', 'ohmygpt', 'llamacpp', 'localai']) + expect(blank).toEqual(['requesty', 'opper', 'api-route', 'cheaperinference', 'ohmygpt', 'llamacpp', 'localai']) }) }) diff --git a/src/shared/domain/__tests__/presets.test.ts b/src/shared/domain/__tests__/presets.test.ts index 9a1b01a5..cff02a27 100644 --- a/src/shared/domain/__tests__/presets.test.ts +++ b/src/shared/domain/__tests__/presets.test.ts @@ -256,6 +256,7 @@ describe('预设表 × joinUpstreamUrl:拼出来的 URL 没有畸形', () => { ['openrouter', 'anthropic', 'https://openrouter.ai/api/v1/messages'], ['requesty', 'anthropic', 'https://router.requesty.ai/v1/messages'], ['atlascloud', 'anthropic', 'https://api.atlascloud.ai/v1/messages'], + ['cheaperinference', 'anthropic', 'https://api.cheaperinference.com/v1/messages'], ['opper', 'openai-chat', 'https://api.opper.ai/v3/compat/chat/completions'], ['opper', 'anthropic', 'https://api.opper.ai/v3/compat/v1/messages'], ['kimi-coding', 'anthropic', 'https://api.kimi.com/coding/v1/messages'], diff --git a/src/shared/domain/baseurl.ts b/src/shared/domain/baseurl.ts index 8799aa20..1e6102bd 100644 --- a/src/shared/domain/baseurl.ts +++ b/src/shared/domain/baseurl.ts @@ -46,7 +46,7 @@ export function joinUpstreamUrl(baseUrl: string, path: string): string { * * | 形状 | 厂商 | * |---|---| - * | `/v1` | OpenAI、Moonshot、MiniMax、混元、StepFun、百川、Mistral、xAI、Together、硅基流动、Requesty、Atlas Cloud | + * | `/v1` | OpenAI、Moonshot、MiniMax、混元、StepFun、百川、Mistral、xAI、Together、硅基流动、Requesty、Atlas Cloud、Cheaper Inference | * | 别的前缀 | Groq `/openai/v1`、Fireworks `/inference/v1`、**DeepInfra `/v1/openai`**、OpenRouter `/api/v1`、**智谱 `/api/paas/v4`**、**火山 `/api/v3`**、百炼 `/compatible-mode/v1`、**千帆 `/v2`**、Cohere `/compatibility/v1`、Opper `/v3/compat` | * | 尾斜杠 | **Gemini `/v1beta/openai/`** | * diff --git a/src/shared/domain/presets.ts b/src/shared/domain/presets.ts index 6d3bc281..1885577f 100644 --- a/src/shared/domain/presets.ts +++ b/src/shared/domain/presets.ts @@ -948,6 +948,24 @@ export const PROVIDER_PRESETS: readonly ProviderPreset[] = [ '同一个 key 也可走 OpenAI Responses 与 Anthropic 协议。', verification: 'documented' }, + { + id: 'cheaperinference', + name: 'Cheaper Inference', + category: 'aggregator', + endpoints: [ + oa('https://api.cheaperinference.com/v1', true), + resp('https://api.cheaperinference.com/v1', true), + anth('https://api.cheaperinference.com') + ], + docsUrl: 'https://cheaperinference.com/docs', + apiKeyUrl: 'https://cheaperinference.com/signup', + suggestedModels: ['gpt-5.4-mini', 'claude-sonnet-5', 'deepseek-v4-flash'], + notes: + '模型 ID 用不带厂商前缀的短名(如 gpt-5.4-mini、claude-sonnet-5),用模型列表返回的完整 ID 即可。' + + '模型列表要先填 key 才能拉。' + + '同一个 key 也可走 OpenAI Responses 与 Anthropic 协议。', + verification: 'probed' + }, { id: 'siliconflow', name: '硅基流动(国内)',