Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.
TypeScript cross-platformelectronffmpegopen-sourceproduct-demorustscreen-capturescreen-recorderscreen-recordingscreen-studioscreencastspeech-to-texttypescriptvideo-editingvideo-editorwaylandwgpuwhisper
fix(llm): find MiniMax's model slugs, fix its empty responses and wire thinking on/off
Etienne Lescot3d0e8d0e96a7
diff --git a/electron/ai-edition/agent-provider-capabilities.ts b/electron/ai-edition/agent-provider-capabilities.tsindex 99cdd59f7..b3b1996ae 100644--- a/electron/ai-edition/agent-provider-capabilities.ts+++ b/electron/ai-edition/agent-provider-capabilities.ts@@ -21,6 +21,7 @@ import { normalizeProviderId, type ReasoningEffort } from "./provider-registry";export type ReasoningStrategy =| "openai-responses"| "anthropic-thinking"+ | "minimax-thinking"| "openrouter-reasoning"| "google-thinking"| "custom-openai-account"@@ -116,13 +117,14 @@ export function getReasoningCapability(provider: string, model?: string): Reason};}if (id === "minimax" || id === "minimax-token-plan") {- // MiniMax ships its own reasoning tiers behind its anthropic-compatible- // endpoint. Map effort to its `reasoning_effort` field rather than the- // Anthropic thinking block (the proxy translates the rest).+ // MiniMax's thinking block is binary — `{type: "adaptive"}` (on) or+ // `{type: "disabled"}` (off, ignored on M2.x which is always-on) — not+ // the OpenAI `reasoning.effort` field, and no budget_tokens tiers like+ // native Anthropic.return {supported: true,- strategy: "openai-responses",- efforts: OPENAI_REASONING_EFFORTS,+ strategy: "minimax-thinking",+ efforts: ANTHROPIC_REASONING_EFFORTS,defaultEffort: "medium",};}@@ -174,6 +176,12 @@ export function getReasoningCallOptions(},};}+ case "minimax-thinking":+ return {+ strategy: cap.strategy,+ effort,+ requestBodyPatch: { thinking: { type: "adaptive" } },+ };case "openrouter-reasoning":return {strategy: cap.strategy,diff --git a/electron/ai-edition/chat-service.ts b/electron/ai-edition/chat-service.tsindex 85a545727..14372c4b5 100644--- a/electron/ai-edition/chat-service.ts+++ b/electron/ai-edition/chat-service.ts@@ -357,9 +357,14 @@ export async function runChat(});if (!result.text) {+ // ponytail: surface the deep-agent's diagnostic so the user can see+ // *why* the model produced no text (e.g. MiniMax streaming only+ // thinking blocks, or a non-text content shape that our extractor+ // missed). Falls back to the generic message when the agent didn't+ // provide a reason.return {success: false,- error: "Empty response from model.",+ error: result.reason ?? "Empty response from model.",};}diff --git a/electron/ai-edition/deep-agent/agent-provider-capabilities.ts b/electron/ai-edition/deep-agent/agent-provider-capabilities.tsindex 9fe65377b..21467db95 100644--- a/electron/ai-edition/deep-agent/agent-provider-capabilities.ts+++ b/electron/ai-edition/deep-agent/agent-provider-capabilities.ts@@ -24,6 +24,7 @@ export interface ReasoningCapability {| "custom-openai-account"| "openai-responses"| "anthropic-thinking"+ | "minimax-thinking"| "openrouter-reasoning"| "google-thinking";}@@ -76,10 +77,7 @@ export function getReasoningCapability(provider: string, model?: string): Reasonstrategy: "openai-responses",};}- if (- def?.id === "anthropic" &&- (normalizedModel.startsWith("MiniMax-M3") || isAnthropicReasoningModel(normalizedModel))- ) {+ if (def?.id === "anthropic" && isAnthropicReasoningModel(normalizedModel)) {return {supported: true,efforts: ANTHROPIC_REASONING_EFFORTS,@@ -87,6 +85,18 @@ export function getReasoningCapability(provider: string, model?: string): Reasonstrategy: "anthropic-thinking",};}+ if (provider === "minimax" || provider === "minimax-token-plan") {+ // MiniMax's thinking block is binary — `{type: "adaptive"}` (on) or+ // `{type: "disabled"}` (off, ignored on M2.x which is always-on) — no+ // budget_tokens tiers like native Anthropic. Any non-"none" effort+ // just turns it on; see buildLangChainReasoningOptions below.+ return {+ supported: true,+ efforts: ANTHROPIC_REASONING_EFFORTS,+ defaultEffort: "medium",+ strategy: "minimax-thinking",+ };+ }if (provider === "openrouter" && isOpenRouterReasoningModel(normalizedModel)) {return {supported: true,@@ -137,6 +147,10 @@ export function buildLangChainReasoningOptions(};case "anthropic-thinking":return buildAnthropicReasoningOptions(model, normalizedEffort);+ case "minimax-thinking":+ // No "none" case needed — normalizedEffort === "none" already+ // short-circuits to {} above, which omits `thinking` (= off).+ return { thinking: { type: "adaptive" } };case "openrouter-reasoning":return {modelKwargs: {diff --git a/electron/ai-edition/deep-agent/chat-model.ts b/electron/ai-edition/deep-agent/chat-model.tsindex a3591dc53..eb900e8a3 100644--- a/electron/ai-edition/deep-agent/chat-model.ts+++ b/electron/ai-edition/deep-agent/chat-model.ts@@ -50,7 +50,7 @@ export async function createOpenScreenChatModel(config.provider === "minimax" ||config.provider === "minimax-token-plan") {- return createLocalProviderChatModel(config);+ return createLocalProviderChatModel(config, reasoningOptions);}if (config.provider === "anthropic") {@@ -100,6 +100,7 @@ export async function createOpenScreenChatModel(async function createLocalProviderChatModel(config: OpenScreenChatModelConfig,+ reasoningOptions: ReturnType<typeof buildLangChainReasoningOptions>,): Promise<BaseChatModel> {switch (config.provider) {case "openai-oauth":@@ -128,12 +129,15 @@ async function createLocalProviderChatModel(}case "minimax":case "minimax-token-plan":- // ponytail: MiniMax is Anthropic-API-shaped. The provider-registry- // already gives us the corrected base URL (`/anthropic/v1`).+ // ponytail: MiniMax is Anthropic-API-shaped. ChatAnthropic wraps+ // @anthropic-ai/sdk, which appends `/v1/messages` itself, so the+ // base URL here must be the bare `/anthropic` origin (matching+ // provider-registry.ts's baseUrl) — not `/anthropic/v1`.return new ChatAnthropic({apiKey: config.apiKey,model: config.model,- anthropicApiUrl: config.baseUrl ?? "https://api.minimax.io/anthropic/v1",+ anthropicApiUrl: config.baseUrl ?? "https://api.minimax.io/anthropic",+ ...(reasoningOptions.thinking ? { thinking: reasoningOptions.thinking as never } : {}),});default:// ponytail: providers that should already have been handled by thediff --git a/electron/ai-edition/deep-agent/service.ts b/electron/ai-edition/deep-agent/service.tsindex a4aa9d57f..f3571485d 100644--- a/electron/ai-edition/deep-agent/service.ts+++ b/electron/ai-edition/deep-agent/service.ts@@ -194,6 +194,11 @@ export interface InvokeResult {text: string;document: AxcutDocument;mutated: boolean;+ /** Set when the stream finished without producing a final text (e.g. all+ * chunks had empty `content`, or the provider returned no+ * `content_block_delta` events). Carries a short diagnostic describing+ * what the LangChain layer actually saw. */+ reason?: string;}export async function invokeOpenScreenAgent(args: InvokeArgs): Promise<InvokeResult> {@@ -217,6 +222,11 @@ export async function invokeOpenScreenAgent(args: InvokeArgs): Promise<InvokeResconst messages = [...history, { role: "user" as const, content: userMessage }];+ // ponytail: declared outside the try block so the catch handler can+ // include any chunks we already saw in the diagnostic when the stream+ // throws partway through.+ let chatModelChunks: unknown[] = [];+try {// ponytail: streamEvents (legacy mode, no `version: "v3"`) returns the// same on_chat_model_stream / on_tool_start / on_tool_end / on_chain_end@@ -229,6 +239,7 @@ export async function invokeOpenScreenAgent(args: InvokeArgs): Promise<InvokeRes).streamEvents({ messages }, undefined);let finalText = "";+ const nonChatEvents: Array<{ event: string; name: string }> = [];for await (const event of stream) {const eventType = typeof event.event === "string" ? event.event : "";@@ -237,6 +248,7 @@ export async function invokeOpenScreenAgent(args: InvokeArgs): Promise<InvokeResif (eventType === "on_chat_model_stream") {const chunk = data?.chunk as Record<string, unknown> | undefined;+ if (chunk) chatModelChunks.push(chunk);const content = chunk?.content;const delta = extractDelta(content);if (delta) {@@ -250,22 +262,56 @@ export async function invokeOpenScreenAgent(args: InvokeArgs): Promise<InvokeRessink.toolEnd(name, true);} else if (eventType === "on_tool_error") {sink.toolEnd(name, false, extractError(data));+ } else if (eventType) {+ nonChatEvents.push({ event: eventType, name });}}const mutated = JSON.stringify(holder.current) !== initialDocumentJSON;if (!finalText.trim()) {- sink.error("Empty response from model.");- return { text: "", document: holder.current, mutated };+ // ponytail: surface the upstream payload so we can see why MiniMax+ // (or any other anthropic-shaped provider) is producing no text.+ // The chat-model chunks are the post-parse LangChain views of+ // each SSE event; their `content`/`additional_kwargs`/+ // `response_metadata` fields tell us whether the issue is in the+ // wire format, the parser, or our `extractDelta` shape. Capped at+ // 1 chunk + a 1kB slice to keep the toast readable.+ const lastChunk = chatModelChunks[chatModelChunks.length - 1];+ const sample = lastChunk+ ? JSON.stringify(lastChunk).slice(0, 1024)+ : "(no on_chat_model_stream events)";+ const reason =+ `Empty response from model (provider=${model.provider}, ` ++ `model=${model.model}, chat_model_chunks=${chatModelChunks.length}, ` ++ `other_events=${nonChatEvents.length}:${nonChatEvents+ .slice(0, 5)+ .map((e) => e.event)+ .join(",")}). Last chunk: ${sample}`;+ sink.error(reason);+ return { text: "", document: holder.current, mutated, reason };}return { text: finalText.trim(), document: holder.current, mutated };} catch (err) {- const message = err instanceof Error ? err.message : String(err);- sink.error(message);+ // ponytail: surface the LangChain/HTTP error (with name + truncated+ // stack) so we can tell whether the stream threw (e.g. MiniMax+ // returning a non-Anthropic JSON envelope that the SDK rejects) or+ // completed with empty content. Mirrors the diagnostic shape used in+ // the success-but-empty path above.+ const e = err instanceof Error ? err : new Error(String(err));+ const stackHead = (e.stack ?? "").split("\n").slice(0, 3).join(" | ");+ const reason = `Empty response from model (provider=${model.provider}, ` ++ `model=${model.model}, error=${e.name}: ${e.message}` ++ (stackHead ? ` stack=${stackHead}` : "") ++ `). Last chunk: ${(chatModelChunks[chatModelChunks.length - 1]+ ? JSON.stringify(chatModelChunks[chatModelChunks.length - 1])+ : "(no on_chat_model_stream events)"+ ).slice(0, 1024)}`;+ sink.error(reason);return {text: "",document: holder.current,mutated: JSON.stringify(holder.current) !== initialDocumentJSON,+ reason,};}}diff --git a/electron/ai-edition/llm-call.ts b/electron/ai-edition/llm-call.tsindex 77bdb78d1..a1b7be901 100644--- a/electron/ai-edition/llm-call.ts+++ b/electron/ai-edition/llm-call.ts@@ -227,7 +227,19 @@ async function streamOpenAiCompatible(signal: opts.signal,});if (!res.ok || !res.body) {- return { success: false, error: `Upstream ${res.status} ${res.statusText}` };+ // ponytail: include a sample of the upstream body so callers can see+ // whether MiniMax (or any other anthropic-shaped provider) is+ // returning a non-streaming error JSON even when stream:true was sent.+ let bodySample = "";+ if (res.body) {+ try {+ bodySample = (await new Response(res.body).text()).slice(0, 1024);+ } catch {+ /* ignore */+ }+ }+ const suffix = bodySample ? ` body=${bodySample}` : "";+ return { success: false, error: `Upstream ${res.status} ${res.statusText}${suffix}` };}const toolCalls: OpenAiToolCall[] = [];@@ -284,7 +296,7 @@ async function streamAnthropic(cb: LlmStreamCallbacks,): Promise<CallLlmResult> {const def = getProviderDefinition(opts.provider) ?? getProviderDefinition("anthropic");- const baseUrl = (opts.baseUrl || def?.baseUrl || "https://api.anthropic.com/v1").replace(+ const baseUrl = (opts.baseUrl || def?.baseUrl || "https://api.anthropic.com").replace(/\/+$/,"",);@@ -317,11 +329,9 @@ async function streamAnthropic(body.output_config = reasoning.requestBodyPatch.outputConfig;}}- // MiniMax rides this same Anthropic-shaped wire path but takes its- // reasoning knob as a plain extraBody field (see agent-provider-capabilities.ts).if (reasoning.extraBody) Object.assign(body, reasoning.extraBody);- const res = await fetch(`${baseUrl}/messages`, {+ const res = await fetch(`${baseUrl}/v1/messages`, {method: "POST",headers: {"Content-Type": "application/json",@@ -332,14 +342,30 @@ async function streamAnthropic(signal: opts.signal,});if (!res.ok || !res.body) {- return { success: false, error: `Upstream ${res.status} ${res.statusText}` };+ // ponytail: include a sample of the upstream body so callers can see+ // whether MiniMax (or any other anthropic-shaped provider) is+ // returning a non-streaming error JSON even when stream:true was sent.+ let bodySample = "";+ if (res.body) {+ try {+ bodySample = (await new Response(res.body).text()).slice(0, 1024);+ } catch {+ /* ignore */+ }+ }+ const suffix = bodySample ? ` body=${bodySample}` : "";+ return { success: false, error: `Upstream ${res.status} ${res.statusText}${suffix}` };}let text = "";const toolCalls: LlmToolCall[] = [];const inFlight = new Map<string, { name: string; args: string; index: number }>();+ const eventTypes = new Set<string>();+ let lastEventSample: Record<string, unknown> | undefined;for await (const event of parseAnthropicEvents(res.body)) {+ eventTypes.add(event.type);+ lastEventSample = event as Record<string, unknown>;if (event.type === "content_block_start") {const block = (event.content_block ?? {}) as Record<string, unknown>;if (block.type === "tool_use") {@@ -379,7 +405,18 @@ async function streamAnthropic(}if (!text && toolCalls.length === 0) {- return { success: false, error: "Empty response from Anthropic." };+ // ponytail: include the event types that arrived + a sample of the+ // last one so the caller can tell whether the SSE stream was+ // genuinely empty, used a different event vocabulary, or carried+ // a non-text payload (e.g. thinking blocks, refusals).+ const types = Array.from(eventTypes).join(",");+ const lastSample = lastEventSample+ ? JSON.stringify(lastEventSample).slice(0, 1024)+ : "(no events parsed)";+ return {+ success: false,+ error: `Empty response from Anthropic. events=[${types}] last=${lastSample}`,+ };}return {success: true,diff --git a/electron/ai-edition/llm-provider-auth.test.ts b/electron/ai-edition/llm-provider-auth.test.tsindex bb5e25b6b..19b406c66 100644--- a/electron/ai-edition/llm-provider-auth.test.ts+++ b/electron/ai-edition/llm-provider-auth.test.ts@@ -8,6 +8,7 @@ import {exchangeGithubCopilotRuntimeToken,listGithubCopilotModels,listOpenAiAccountModels,+ probeMiniMaxModels,} from "./llm-provider-auth";const ORIGINAL_FETCH = globalThis.fetch;@@ -274,3 +275,122 @@ describe("listGithubCopilotModels", () => {expect(models).toEqual(["claude-3.5-sonnet", "gpt-3.5-turbo", "gpt-4o"]);});});++/**+ * `probeMiniMaxModels` issues a parallel POST to the OpenAI-compat sibling of+ * the Anthropic base URL. The Anthropic base used to be `…/anthropic` and was+ * later corrected to `…/anthropic/v1` (see provider-registry.ts and+ * `76d823f fix(ai-edition): correct MiniMax base URL to /anthropic/v1`).+ * The earlier URL-construction only handled the no-`/v1` shape, so the+ * registry default produced the malformed `…/anthropic/v1/v1/chat/completions`+ * and every probe 404'd, returning an empty list with no surfaced error.+ *+ * These tests pin the URL construction across both shapes and assert the+ * filtering + error-surfacing behavior.+ */+describe("probeMiniMaxModels", () => {+ /**+ * Per-model mock: `globalThis.fetch` is called once per candidate model in+ * parallel. The impl decodes the request body to find the model name and+ * returns the matching entry from `byModel` (or the default). The default+ * is `ok: false` so tests that only populate a few models see those as+ * the only reachable ones.+ */+ function mockProbeFetch(+ byModel: Record<string, { ok: boolean; status?: number; body?: unknown }>,+ defaultResponse: { ok: boolean; status?: number; body?: unknown } = {+ ok: false,+ status: 404,+ body: { error: "not_found" },+ },+ ) {+ vi.spyOn(globalThis, "fetch").mockImplementation(async (_input, init) => {+ const body = JSON.parse(String((init as RequestInit | undefined)?.body ?? "{}")) as {+ model?: string;+ };+ const entry = (body.model && byModel[body.model]) || defaultResponse;+ const status = entry.status ?? (entry.ok ? 200 : 500);+ return new Response(JSON.stringify(entry.body ?? {}), {+ status,+ headers: { "Content-Type": "application/json" },+ });+ });+ }++ function captureProbeUrls(): string[] {+ const calls = (+ globalThis.fetch as unknown as { mock: { calls: [string, RequestInit | undefined][] } }+ ).mock.calls;+ return calls.map(([url]) => url);+ }++ it("strips /anthropic/v1 from the registry baseUrl and probes /v1/chat/completions at the origin", async () => {+ mockProbeFetch({ "MiniMax-M3": { ok: true } });++ const models = await probeMiniMaxModels("sk-test", "https://api.minimax.io/anthropic/v1");++ expect(models).toEqual(["MiniMax-M3"]);+ const urls = captureProbeUrls();+ expect(urls.length).toBeGreaterThan(0);+ for (const url of urls) {+ expect(url).toBe("https://api.minimax.io/v1/chat/completions");+ }+ });++ it("also handles the legacy /anthropic-only baseUrl (docs URL)", async () => {+ mockProbeFetch({ "MiniMax-M3": { ok: true } });++ const models = await probeMiniMaxModels("sk-test", "https://api.minimax.io/anthropic");++ expect(models).toEqual(["MiniMax-M3"]);+ for (const url of captureProbeUrls()) {+ expect(url).toBe("https://api.minimax.io/v1/chat/completions");+ }+ });++ it("tolerates trailing slashes on either baseUrl shape", async () => {+ mockProbeFetch({ "MiniMax-M3": { ok: true } });++ await probeMiniMaxModels("sk-test", "https://api.minimax.io/anthropic/v1/");+ for (const url of captureProbeUrls()) {+ expect(url).toBe("https://api.minimax.io/v1/chat/completions");+ }++ mockProbeFetch({ "MiniMax-M3": { ok: true } });+ await probeMiniMaxModels("sk-test", "https://api.minimax.io/anthropic/");+ for (const url of captureProbeUrls()) {+ expect(url).toBe("https://api.minimax.io/v1/chat/completions");+ }+ });++ it("falls back to the hard-coded default baseUrl when none is supplied", async () => {+ mockProbeFetch({ "MiniMax-M3": { ok: true } });++ const models = await probeMiniMaxModels("sk-test");++ expect(models).toEqual(["MiniMax-M3"]);+ for (const url of captureProbeUrls()) {+ expect(url).toBe("https://api.minimax.io/v1/chat/completions");+ }+ });++ it("returns only the candidate slugs that respond ok", async () => {+ mockProbeFetch({+ "MiniMax-M3": { ok: true },+ "MiniMax-M2.7": { ok: true },+ "MiniMax-M2.5": { ok: false, status: 403 },+ "MiniMax-M2.1": { ok: false, status: 404 },+ });++ const models = await probeMiniMaxModels("sk-test", "https://api.minimax.io/anthropic/v1");+ expect(models).toEqual(["MiniMax-M3", "MiniMax-M2.7"]);+ });++ it("throws with the origin and a status hint when no candidate is reachable", async () => {+ mockProbeFetch({}, { ok: false, status: 404, body: { error: "not_found" } });++ await expect(+ probeMiniMaxModels("sk-test", "https://api.minimax.io/anthropic/v1"),+ ).rejects.toThrow(/https:\/\/api\.minimax\.io .*HTTP 404/);+ });+});diff --git a/electron/ai-edition/llm-provider-auth.ts b/electron/ai-edition/llm-provider-auth.tsindex 13e999152..5cf30698b 100644--- a/electron/ai-edition/llm-provider-auth.ts+++ b/electron/ai-edition/llm-provider-auth.ts@@ -487,10 +487,15 @@ const MINIMAX_DISCOVERY_CANDIDATE_MODELS = [*/export async function probeMiniMaxModels(apiKey: string, baseUrl?: string): Promise<string[]> {const resolvedBaseUrl = baseUrl || "https://api.minimax.io/anthropic";- const discoveryUrl = resolvedBaseUrl.endsWith("/anthropic")- ? resolvedBaseUrl.replace(/\/anthropic\/?$/, "/v1/chat/completions")- : `${resolvedBaseUrl.replace(/\/$/, "")}/v1/chat/completions`;-+ // `baseUrl` is the Anthropic-shaped sibling — either the docs URL+ // (`/anthropic`) or the real one (`/anthropic/v1`). The OpenAI-compat+ // `/v1/chat/completions` path lives at the origin, not under `/anthropic`,+ // so strip that segment (and an optional trailing `/v\d+`) before appending+ // the probe path. Strips a trailing slash too, to keep the URL tidy.+ const origin = resolvedBaseUrl.replace(/\/anthropic(\/v\d+)?\/?$/, "").replace(/\/$/, "");+ const discoveryUrl = `${origin}/v1/chat/completions`;++ let firstFailure: { status: number; model: string } | undefined;const checks = await Promise.all(MINIMAX_DISCOVERY_CANDIDATE_MODELS.map(async (model) => {try {@@ -503,15 +508,34 @@ export async function probeMiniMaxModels(apiKey: string, baseUrl?: string): Prommax_tokens: 1,}),});- return response.ok ? model : undefined;- } catch {+ if (response.ok) return model;+ if (!firstFailure) firstFailure = { status: response.status, model };+ return undefined;+ } catch (error) {+ if (!firstFailure) {+ firstFailure = {+ status: 0,+ model: `${model} (${error instanceof Error ? error.message : String(error)})`,+ };+ }return undefined;}}),);- return checks.filter((model): model is (typeof MINIMAX_DISCOVERY_CANDIDATE_MODELS)[number] =>- Boolean(model),+ const reachable = checks.filter(+ (model): model is (typeof MINIMAX_DISCOVERY_CANDIDATE_MODELS)[number] => Boolean(model),);+ if (reachable.length === 0 && firstFailure) {+ // All probes failed — surface the first failure so the UI can show a+ // meaningful reason instead of a silent empty list. A status of 0+ // indicates a network-level error (DNS, TLS, refused, …).+ const reason =+ firstFailure.status === 0+ ? `network error probing ${firstFailure.model}`+ : `HTTP ${firstFailure.status} probing ${firstFailure.model}`;+ throw new Error(`No MiniMax models reachable at ${origin} (${reason})`);+ }+ return reachable;}async function safeErrorDetail(response: Response): Promise<string | undefined> {diff --git a/electron/ai-edition/provider-registry.ts b/electron/ai-edition/provider-registry.tsindex 8fc1bc24a..262e9d712 100644--- a/electron/ai-edition/provider-registry.ts+++ b/electron/ai-edition/provider-registry.ts@@ -114,10 +114,12 @@ export const PROVIDER_DEFINITIONS: ProviderDefinition[] = [supportsReasoningEffort: true,wireProtocol: "anthropic",// ponytail: docs (platform.minimax.io) tell you to set ANTHROPIC_BASE_URL- // to https://api.minimax.io/anthropic — but the real `/messages` path- // is /anthropic/v1/messages, and `/anthropic/messages` returns a 404- // from the upstream gateway. Empirically verified against the live API.- baseUrl: "https://api.minimax.io/anthropic/v1",+ // to https://api.minimax.io/anthropic, with the real `/messages` path+ // at /anthropic/v1/messages — same convention as api.anthropic.com.+ // Every consumer of this baseUrl (the raw-fetch path in llm-call.ts+ // and the @anthropic-ai/sdk-backed ChatAnthropic in chat-model.ts)+ // appends `/v1/messages` itself, so this must NOT include `/v1`.+ baseUrl: "https://api.minimax.io/anthropic",envKeys: ["MINIMAX_API_KEY"],setupHint: "Use MINIMAX_API_KEY or paste a MiniMax API key.",},@@ -128,7 +130,7 @@ export const PROVIDER_DEFINITIONS: ProviderDefinition[] = [authKind: "api-key",supportsReasoningEffort: true,wireProtocol: "anthropic",- baseUrl: "https://api.minimax.io/anthropic/v1",+ baseUrl: "https://api.minimax.io/anthropic",envKeys: ["MINIMAX_TOKEN_PLAN_API_KEY"],setupHint: "Use MINIMAX_TOKEN_PLAN_API_KEY or paste a MiniMax token-plan API key.",},@@ -154,6 +156,42 @@ export const REASONING_EFFORT_OPTIONS = [] as const;export type ReasoningEffort = (typeof REASONING_EFFORT_OPTIONS)[number];+/**+ * Effort options to show in the provider settings dropdown for a given+ * provider. Most providers accept the full graduated scale, but MiniMax's+ * `thinking` block is binary (on/off, see agent-provider-capabilities.ts) —+ * showing all six tiers would imply a granularity it doesn't have, since+ * "minimal" through "xhigh" all wire up identically.+ */+export function getReasoningEffortOptions(providerId: string): readonly ReasoningEffort[] {+ if (providerId === "minimax" || providerId === "minimax-token-plan") {+ return ["none", "medium"];+ }+ return REASONING_EFFORT_OPTIONS;+}++/**+ * Display label per effort value. SSOT for both the provider-settings+ * dropdown (ProviderSettings.tsx) and the in-chat quick-pick popover+ * (LeftPanel.tsx) — MiniMax overrides "medium" to "On" since its `thinking`+ * block is binary, not a graduated tier (see getReasoningEffortOptions).+ */+export function getReasoningEffortLabel(providerId: string, effort: ReasoningEffort): string {+ if ((providerId === "minimax" || providerId === "minimax-token-plan") && effort === "medium") {+ return "On";+ }+ return REASONING_EFFORT_LABELS[effort];+}++export const REASONING_EFFORT_LABELS: Record<ReasoningEffort, string> = {+ none: "None",+ minimal: "Minimal",+ low: "Low",+ medium: "Medium",+ high: "High",+ xhigh: "Extra high",+};+/*** Coerce free-form provider strings (including historical aliases and the* legacy `yagr` ids) to a known registry entry. Mirrors axcut'sdiff --git a/src/components/ai-edition/LeftPanel.tsx b/src/components/ai-edition/LeftPanel.tsxindex 7caf8b831..88ad4f7c4 100644--- a/src/components/ai-edition/LeftPanel.tsx+++ b/src/components/ai-edition/LeftPanel.tsx@@ -13,8 +13,9 @@ import type {AxcutTimelineOperation,} from "@/native/contracts";import {+ getReasoningEffortLabel,+ getReasoningEffortOptions,PROVIDER_DEFINITIONS,- REASONING_EFFORT_OPTIONS,type ReasoningEffort,} from "../../../electron/ai-edition/provider-registry";import { computeBudget } from "./chatBudget";@@ -22,15 +23,6 @@ import { ChatHistoryModal, SourceTranscriptModal } from "./Modals";import styles from "./NewEditorShell.module.css";import { ProviderSettings } from "./ProviderSettings";-const REASONING_EFFORT_LABELS: Record<ReasoningEffort, string> = {- none: "None",- minimal: "Minimal",- low: "Low",- medium: "Medium",- high: "High",- xhigh: "Extra high",-};-export type LeftTab = "chat" | "media";const THUMB_PALETTE = ["thumbRed", "thumbGreen", "thumbAmber", "thumbCyan"] as const;@@ -913,9 +905,10 @@ function ChatStripPanel() {);const currentReasoningEffort: ReasoningEffort =(llmConfig?.reasoningEffort as ReasoningEffort | undefined) ?? "medium";- const reasoningLabel = providerSupportsReasoning- ? REASONING_EFFORT_LABELS[currentReasoningEffort]- : null;+ const reasoningLabel =+ providerSupportsReasoning && llmConfig+ ? getReasoningEffortLabel(llmConfig.provider, currentReasoningEffort)+ : null;const selectReasoningEffort = useCallback(async (effort: ReasoningEffort) => {@@ -1622,7 +1615,7 @@ function ChatStripPanel() {zIndex: 1000,}}>- {REASONING_EFFORT_OPTIONS.map((option) => (+ {getReasoningEffortOptions(llmConfig?.provider ?? "").map((option) => (<buttontype="button"key={option}@@ -1645,7 +1638,7 @@ function ChatStripPanel() {fontSize: 12.5,}}>- {REASONING_EFFORT_LABELS[option]}+ {getReasoningEffortLabel(llmConfig?.provider ?? "", option)}{option === currentReasoningEffort ? <Check size={12} /> : null}</button>))}diff --git a/src/components/ai-edition/ProviderSettings.tsx b/src/components/ai-edition/ProviderSettings.tsxindex db3f68423..9b871ef81 100644--- a/src/components/ai-edition/ProviderSettings.tsx+++ b/src/components/ai-edition/ProviderSettings.tsx@@ -40,9 +40,10 @@ import type {AiEditionLlmSnapshot,} from "@/native/contracts";import {+ getReasoningEffortLabel,+ getReasoningEffortOptions,PROVIDER_DEFINITIONS,type ProviderDefinition,- REASONING_EFFORT_OPTIONS,} from "../../../electron/ai-edition/provider-registry";import { ModalShell } from "./Modals";import styles from "./NewEditorShell.module.css";@@ -581,9 +582,9 @@ function ProviderForm({}disabled={busy}>- {REASONING_EFFORT_OPTIONS.map((r: string) => (+ {getReasoningEffortOptions(def.id).map((r) => (<option key={r} value={r}>- {r}+ {getReasoningEffortLabel(def.id, r)}</option>))}</select>