diff --git a/docs/guides/user-guide.md b/docs/guides/user-guide.md index 44908aea4..ed656a50b 100644 --- a/docs/guides/user-guide.md +++ b/docs/guides/user-guide.md @@ -56,6 +56,8 @@ A service can provide multiple models within the same category. After entering i The service URL and Model ID must match your model service. Self-hosted service URLs typically include `/v1`; use the model name actually exposed by the service as the Model ID. For third-party services, follow the information provided by the service. +For MiniMax assistant chat, open **Settings → Model connections → Chat → Add service** and choose **MiniMax (China)** or **MiniMax (Global)**. The preset selects both `MiniMax-M4` and `MiniMax-M3.1-Flash` and fills `https://api.minimax.cn/v1` or `https://api.minimax.io/v1`. Enter the API key for that platform, test the models you want to use, then save and choose one in the Default Agent. **Auto** uses MiniMax’s default thinking level. [MiniMax OpenAI SDK guide](https://platform.minimax.io/docs/api-reference/text-openai-api) + Kimi assistant chat is billed in two separate ways, each with its own key and base URL, so pick the row that matches your account. **Moonshot Kimi Open Platform** is pay-per-token: enter a mainland key from the Moonshot open platform and the preset fills `https://api.moonshot.cn/v1`. **Moonshot Kimi Code subscription** draws on a Kimi Code Plan quota instead: enter the key issued with that subscription and the preset fills `https://api.kimi.com/coding/v1`. Keys are not interchangeable between the two. In both cases **Fetch models** lists the models that key can reach, such as `kimi-k3` and `kimi-k3.1-pro`. Neither preset covers the international endpoint; add that one as a custom OpenAI-compatible service with its own base URL. [Moonshot platform documentation](https://platform.kimi.com/docs), [Kimi Code provider configuration](https://moonshotai.github.io/kimi-cli/en/configuration/providers.html) For Qwen assistant chat, choose **Alibaba Cloud Model Studio (Beijing)** and enter a Beijing API key. The preset selects `qwen3.8-max`. You can keep the shared Beijing URL or enter your Beijing workspace's OpenAI-compatible Base URL ending in `/compatible-mode/v1`. [Alibaba Cloud endpoint guide](https://help.aliyun.com/en/model-studio/compatibility-of-openai-with-dashscope) diff --git a/docs/guides/user-guide.zh-CN.md b/docs/guides/user-guide.zh-CN.md index b246ba3b6..277a4096b 100644 --- a/docs/guides/user-guide.zh-CN.md +++ b/docs/guides/user-guide.zh-CN.md @@ -56,6 +56,8 @@ Antigravity 目前只在 macOS 上验证过;在 Linux 与 Windows 上,agy 服务地址和 Model ID 应与自己的模型服务一致。自部署服务的地址通常包含 `/v1`,Model ID 使用服务实际公开的模型名称;第三方服务按其提供的信息填写。 +使用 MiniMax 对话模型时,打开**设置 → 模型接入 → 对话 → 添加服务**,选择 **MiniMax(中国站)**或 **MiniMax(国际站)**。预设会选中 `MiniMax-M4` 和 `MiniMax-M3.1-Flash`,并填入对应的 `https://api.minimax.cn/v1` 或 `https://api.minimax.io/v1`。填写对应平台的 API Key,测试并保存需要的模型,然后在内置助手中选择使用。思考强度选**自动**时使用 MiniMax 的默认档位。[MiniMax OpenAI SDK 指南](https://platform.minimax.cn/docs/api-reference/text-openai-api) + Kimi 对话助手有两种计费方式,各自使用独立的 Key 和服务地址,按自己的账号选择对应预设。**月之暗面 Kimi 开放平台**按量计费:填写月之暗面开放平台的主大陆 API Key,预设会填入 `https://api.moonshot.cn/v1`。**月之暗面 Kimi Code 订阅**走 Kimi Code Plan 的套餐额度:填写该订阅发放的 Key,预设会填入 `https://api.kimi.com/coding/v1`。两种 Key 不能互换使用。两者都可点击“获取模型”列出该 Key 可用的模型,例如 `kimi-k3`、`kimi-k3.1-pro`。国际站端点不在这两个预设的覆盖范围内,请按自定义 OpenAI 兼容服务填写自己的地址。[月之暗面平台文档](https://platform.kimi.com/docs)、[Kimi Code 服务配置文档](https://moonshotai.github.io/kimi-cli/zh/configuration/providers.html) 使用千问对话助手时,选择 **阿里云百炼(北京)** 并填写北京地域的 API Key。预设会选中 `qwen3.8-max`。服务地址可保留默认的北京通用地址,也可填写以 `/compatible-mode/v1` 结尾的北京业务空间专属地址。[百炼 OpenAI 兼容接口指南](https://help.aliyun.com/zh/model-studio/compatibility-of-openai-with-dashscope) diff --git a/packages/core/src/opendirector/application/model_catalog.py b/packages/core/src/opendirector/application/model_catalog.py index bc801eea6..f1cebf19b 100644 --- a/packages/core/src/opendirector/application/model_catalog.py +++ b/packages/core/src/opendirector/application/model_catalog.py @@ -5,6 +5,7 @@ """ import asyncio import time +from urllib.parse import urlsplit from opendirector.domain.input_rules import input_rules from opendirector.domain.model_connection import connection_fields, model_fields @@ -16,6 +17,8 @@ _SAVED_KEY = '请填写该服务的 API Key;新地址不能复用原地址的密钥。' AGENT_TEST_TIMEOUT_SECONDS = 30 +MINIMAX_CHAT_TEST_HOSTS = {'api.minimax.cn', 'api.minimax.io'} +MINIMAX_CHAT_TEST_MODELS = {'MiniMax-M4', 'MiniMax-M3.1-Flash'} def _draft(kind, url, model_id, api_key, connection_type, protocol, auth_mode, proxy_mode, **extra): @@ -93,7 +96,10 @@ async def test_agent(self, url, model_id, api_key, config_id=None, *, connection config = await self._with_saved_key(config, config_id, 'agent', require_key=True, threaded=True) await asyncio.to_thread(self.availability.prepare, config) self.availability.require(config, requests_for(config, inputs={'text'})[0]) - payload = chat_payload(config, [{'role': 'user', 'content': 'Reply with OK only.'}], 'auto', max_tokens=1024) + uses_minimax = (config['modelId'] in MINIMAX_CHAT_TEST_MODELS + and urlsplit(config['url']).hostname in MINIMAX_CHAT_TEST_HOSTS) + thinking = 'low' if uses_minimax else 'auto' + payload = chat_payload(config, [{'role': 'user', 'content': 'Reply with OK only.'}], thinking, max_tokens=1024) started = time.monotonic() received = False try: diff --git a/src/canvas/providerPresets.ts b/src/canvas/providerPresets.ts index 56df029ac..b4276e7a3 100644 --- a/src/canvas/providerPresets.ts +++ b/src/canvas/providerPresets.ts @@ -6,6 +6,8 @@ import { getActiveLocale } from "../i18n/messages.ts"; const EN_NAMES: Record = { "智谱 BigModel 视频": "Zhipu BigModel video", "OpenAI 兼容": "OpenAI compatible", + "MiniMax(中国站)": "MiniMax (China)", + "MiniMax(国际站)": "MiniMax (Global)", "MiniMax 官方视频": "MiniMax official video", "智谱 BigModel": "Zhipu BigModel", "阿里云百炼(北京)": "Alibaba Cloud Model Studio (Beijing)", @@ -117,12 +119,24 @@ export const PROVIDER_PRESETS: ProviderPreset[] = [ { id: "minimax-agent", logoOrganization: "MiniMaxAI", - name: "MiniMax (minimax.cn)", + name: "MiniMax(中国站)", kinds: ["agent"], url: "https://api.minimax.cn/v1", protocol: "openai", connectionType: "api", authMode: "bearer", + modelsByKind: { agent: ["MiniMax-M4", "MiniMax-M3.1-Flash"] }, + }, + { + id: "minimax-agent-global", + logoOrganization: "MiniMaxAI", + name: "MiniMax(国际站)", + kinds: ["agent"], + url: "https://api.minimax.io/v1", + protocol: "openai", + connectionType: "api", + authMode: "bearer", + modelsByKind: { agent: ["MiniMax-M4", "MiniMax-M3.1-Flash"] }, }, { id: "minimax-image", diff --git a/tests/providerPresets.test.ts b/tests/providerPresets.test.ts index 39d5bcf8d..111c86f06 100644 --- a/tests/providerPresets.test.ts +++ b/tests/providerPresets.test.ts @@ -67,6 +67,31 @@ test("provider presets separate official protocol from self-hosted model names", assert.deepEqual(matchingConnections([{ ...model, providerId: "shared" }, { ...model, id: "two", providerId: "shared" }, { ...model, id: "three", providerId: "other" }], "video", { ...model, protocol: "minimax_video_v2", authMode: "bearer", apiKey: "" }).map((item) => item.id), ["one", "three"]); }); +test("MiniMax chat presets offer M4 and M3.1 Flash on both regional endpoints", () => { + const presets = [ + { id: "minimax-agent", url: "https://api.minimax.cn/v1", zh: "MiniMax(中国站)", en: "MiniMax (China)" }, + { id: "minimax-agent-global", url: "https://api.minimax.io/v1", zh: "MiniMax(国际站)", en: "MiniMax (Global)" }, + ]; + const previous = getActiveLocale(); + try { + for (const { id, url, zh, en } of presets) { + const preset = PROVIDER_PRESETS.find((item) => item.id === id); + assert.ok(preset); + assert.equal(preset.url, url); + assert.deepEqual(preset.kinds, ["agent"]); + assert.deepEqual(preset.modelsByKind, { agent: ["MiniMax-M4", "MiniMax-M3.1-Flash"] }); + assert.equal(preset.protocol, "openai"); + assert.equal(preset.authMode, "bearer"); + setActiveLocale("zh-CN"); + assert.equal(providerOptions("agent").find((item) => item.id === id)?.name, zh); + setActiveLocale("en-US"); + assert.equal(providerOptions("agent").find((item) => item.id === id)?.name, en); + } + } finally { + setActiveLocale(previous); + } +}); + test("Beijing Model Studio offers Qwen chat in both languages", () => { const preset = PROVIDER_PRESETS.find((item) => item.id === "bailian-beijing"); assert.ok(preset); diff --git a/tests/test_model_catalog.py b/tests/test_model_catalog.py index 3031d19c4..c6814a2b5 100644 --- a/tests/test_model_catalog.py +++ b/tests/test_model_catalog.py @@ -165,6 +165,17 @@ def test_agent_test_keeps_provider_payload_rules_and_times_out(tmp_path): assert caught.value.status == 504 +@pytest.mark.parametrize('region', ['cn', 'io']) +@pytest.mark.parametrize('model_id', ['MiniMax-M4', 'MiniMax-M3.1-Flash']) +def test_agent_connection_test_limits_minimax_thinking(tmp_path, region, model_id): + tester = Scripted([{'type': 'thinking'}, {'type': 'delta', 'text': 'OK'}]) + asyncio.run(ModelCatalog(ModelConfigs(tmp_path), tester).test_agent( + f'https://api.minimax.{region}/v1', model_id, 'fixture-key')) + _, payload = tester.calls[0] + assert payload['reasoning_effort'] == 'low' + assert payload['max_tokens'] == 1024 + + def test_capability_preset_does_not_probe_or_require_a_key(monkeypatch): calls, read = _reader({'outputs': []}) monkeypatch.setattr('opendirector.application.model_catalog.read_video_capabilities', read)