From 9e5d0329bf3ac2eb83e3d7896d147f9eba0f1fc6 Mon Sep 17 00:00:00 2001 From: Rongkun Yan <2493404415@qq.com> Date: Tue, 23 Jun 2026 05:29:05 +0800 Subject: [PATCH] feat: add ModelScope API support (#3773) Co-authored-by: Steven Enamakel --- app/src-tauri/Cargo.lock | 1 + .../panels/__tests__/builtinCloudProviders.test.ts | 2 ++ .../settings/panels/builtinCloudProviders.ts | 8 ++++++++ docs/inference-provider-catalog.md | 3 ++- src/openhuman/config/schema/cloud_providers.rs | 12 ++++++++++++ 5 files changed, 25 insertions(+), 1 deletion(-) diff --git a/app/src-tauri/Cargo.lock b/app/src-tauri/Cargo.lock index a61aef3de..1d4876c2e 100644 --- a/app/src-tauri/Cargo.lock +++ b/app/src-tauri/Cargo.lock @@ -5401,6 +5401,7 @@ dependencies = [ "image", "keyring", "lettre", + "libc", "log", "mail-parser", "motosan-ai-oauth", diff --git a/app/src/components/settings/panels/__tests__/builtinCloudProviders.test.ts b/app/src/components/settings/panels/__tests__/builtinCloudProviders.test.ts index 21f493063..6fce51b1d 100644 --- a/app/src/components/settings/panels/__tests__/builtinCloudProviders.test.ts +++ b/app/src/components/settings/panels/__tests__/builtinCloudProviders.test.ts @@ -17,6 +17,7 @@ describe('builtinCloudProviders', () => { ['deepseek', 'https://api.deepseek.com/v1', 'bearer'], ['minimax', 'https://api.minimax.io/v1', 'bearer'], ['sumopod', 'https://ai.sumopod.com/v1', 'bearer'], + ['modelscope', 'https://api-inference.modelscope.cn/v1', 'bearer'], ] as const)('maps %s to its endpoint and auth style', (slug, endpoint, authStyle) => { expect(defaultEndpointForBuiltinCloudProvider(slug)).toBe(endpoint); expect(authStyleForBuiltinCloudProvider(slug)).toBe(authStyle); @@ -43,6 +44,7 @@ describe('builtinCloudProviders', () => { 'venice', 'vercel-ai-gateway', 'sumopod', + 'modelscope', ]) ); }); diff --git a/app/src/components/settings/panels/builtinCloudProviders.ts b/app/src/components/settings/panels/builtinCloudProviders.ts index 6f9a7aafc..3fb212cb6 100644 --- a/app/src/components/settings/panels/builtinCloudProviders.ts +++ b/app/src/components/settings/panels/builtinCloudProviders.ts @@ -216,6 +216,14 @@ export const BUILTIN_CLOUD_PROVIDERS: BuiltinCloudProvider[] = [ tone: TONE.amber, keyPlaceholder: 'sk-...', }, + { + slug: 'modelscope', + label: 'ModelScope', + endpoint: 'https://api-inference.modelscope.cn/v1', + authStyle: 'bearer', + tone: TONE.indigo, + keyPlaceholder: 'ms-...', + }, ]; // NOTE: Claude Code CLI is intentionally NOT a builtin chip. It is a diff --git a/docs/inference-provider-catalog.md b/docs/inference-provider-catalog.md index 612164232..e28cc1331 100644 --- a/docs/inference-provider-catalog.md +++ b/docs/inference-provider-catalog.md @@ -25,7 +25,7 @@ through a custom provider entry; this table is the first-class chip catalog. | `huggingface` | Hugging Face | `https://router.huggingface.co/v1` | bearer | Shipped | | `nvidia` | NVIDIA | `https://integrate.api.nvidia.com/v1` | bearer | Shipped | | `zai` | Z.AI | `https://api.z.ai/api/paas/v4` | bearer | Shipped | -| `minimax` | MiniMax | `https://api.minimax.io/anthropic` | anthropic | Shipped | +| `minimax` | MiniMax | `https://api.minimax.io/v1` | bearer | Shipped | | `stepfun` | StepFun | `https://api.stepfun.ai/step_plan/v1` | bearer | Shipped | | `kilocode` | Kilo Code | `https://api.kilo.ai/api/gateway` | bearer | Shipped | | `deepinfra` | DeepInfra | `https://api.deepinfra.com/v1/openai` | bearer | Shipped | @@ -33,6 +33,7 @@ through a custom provider entry; this table is the first-class chip catalog. | `venice` | Venice | `https://api.venice.ai/api/v1` | bearer | Shipped | | `vercel-ai-gateway` | Vercel AI Gateway | `https://ai-gateway.vercel.sh/v1` | bearer | Shipped | | `sumopod` | SumoPod | `https://ai.sumopod.com/v1` | bearer | Shipped | +| `modelscope` | ModelScope | `https://api-inference.modelscope.cn/v1` | bearer | Shipped | API keys are stored through the auth-profile store under `provider:`; they are not read from environment variables by the desktop Settings flow. diff --git a/src/openhuman/config/schema/cloud_providers.rs b/src/openhuman/config/schema/cloud_providers.rs index 2bbef52bd..1170d3146 100644 --- a/src/openhuman/config/schema/cloud_providers.rs +++ b/src/openhuman/config/schema/cloud_providers.rs @@ -185,6 +185,12 @@ pub const BUILTIN_CLOUD_PROVIDERS: &[BuiltinCloudProvider] = &[ endpoint: "https://ai.sumopod.com/v1", auth_style: AuthStyle::Bearer, }, + BuiltinCloudProvider { + slug: "modelscope", + label: "ModelScope", + endpoint: "https://api-inference.modelscope.cn/v1", + auth_style: AuthStyle::Bearer, + }, ]; fn builtin_cloud_provider(type_str: &str) -> Option<&'static BuiltinCloudProvider> { @@ -524,6 +530,12 @@ mod tests { "https://ai.sumopod.com/v1", AuthStyle::Bearer, ), + ( + "modelscope", + "ModelScope", + "https://api-inference.modelscope.cn/v1", + AuthStyle::Bearer, + ), ] { let mut entry = CloudProviderCreds { id: format!("p_{slug}"),