Compare commits

...

5 Commits

Author SHA1 Message Date
diegosouzapw
f52b60d846 fix(sse): re-align stream-readiness-policy tests with minimax's openai format
PR #9463 switched minimax/minimax-cn from claude to openai format so images
work. The stream-readiness bump for Claude-format replicas is keyed off the
registry's format field (single source of truth), so minimax legitimately
falls out of that group now. Swap the "Claude-format replica" test fixtures
to agentrouter (still format: "claude") and add explicit coverage that
minimax no longer gets the claude_format_heavy_reasoning bump.
2026-08-05 19:59:32 -03:00
Diego Rodrigues de Sa e Souza
aebd481607 Merge branch 'release/v3.8.50' into fix/minimax-openai-vision 2026-08-05 16:23:59 -03:00
Diego Rodrigues de Sa e Souza
12c64667a9 Merge branch 'release/v3.8.50' into fix/minimax-openai-vision 2026-08-05 13:21:17 -03:00
Diego Rodrigues de Sa e Souza
a316c8db52 Merge branch 'release/v3.8.50' into fix/minimax-openai-vision 2026-08-05 12:00:19 -03:00
diegosouzapw
25cf9d9065 fix(providers): switch minimax from claude to openai format so images work
The Anthropic-compatible /anthropic/v1/messages endpoint rejects image
input with 403. MiniMax's OpenAI-compatible /v1/chat/completions endpoint
supports image_url natively for MiniMax-M3.

- minimax + minimax-cn: format claude→openai, baseUrl→/v1/chat/completions
- Remove Anthropic-Version header + ?beta=true suffix (not needed for openai)
- Remove minimax/minimax-cn from ?beta=true executor case
- Update cache-control tests (openai format uses different caching path)
- Fix reasoning-split test names (no longer claude format)

TDD: 2 registry tests assert format=openai (red→green).
Refs: Hermes Agent #15715, MiniMax OpenAI-compatible API docs.
2026-08-04 18:25:58 -03:00
7 changed files with 60 additions and 27 deletions

View File

@@ -1,17 +1,14 @@
import type { RegistryEntry } from "../../../shared.ts";
import { getAnthropicCompatHeaders, ANTHROPIC_VERSION_HEADER } from "../../../shared.ts";
export const minimax_cnProvider: RegistryEntry = {
id: "minimax-cn",
alias: "minimax-cn", // unique alias (was colliding with minimax)
format: "claude",
format: "openai",
executor: "default",
baseUrl: "https://api.minimaxi.com/anthropic/v1/messages",
baseUrl: "https://api.minimaxi.com/v1/chat/completions",
modelsUrl: "https://api.minimaxi.com/v1/models",
urlSuffix: "?beta=true",
authType: "apikey",
authHeader: "bearer",
headers: getAnthropicCompatHeaders(),
models: [
// Keep parity with minimax to ensure model discovery works for minimax-cn connections.
// #3110: MiniMax M3 — frontier coding model with 1M context

View File

@@ -1,17 +1,14 @@
import type { RegistryEntry } from "../../shared.ts";
import { getAnthropicCompatHeaders, ANTHROPIC_VERSION_HEADER } from "../../shared.ts";
export const minimaxProvider: RegistryEntry = {
id: "minimax",
alias: "minimax",
format: "claude",
format: "openai",
executor: "default",
baseUrl: "https://api.minimax.io/anthropic/v1/messages",
baseUrl: "https://api.minimax.io/v1/chat/completions",
modelsUrl: "https://api.minimax.io/v1/models",
urlSuffix: "?beta=true",
authType: "apikey",
authHeader: "bearer",
headers: getAnthropicCompatHeaders(),
models: [
// T12/T28: MiniMax default upgraded from M2.5 to M2.7
// #3110: MiniMax M3 — frontier coding model with 1M context

View File

@@ -289,8 +289,6 @@ export class DefaultExecutor extends BaseExecutor {
case "glm":
case "glmt":
case "kimi-coding":
case "minimax":
case "minimax-cn":
return `${this.config.baseUrl}?beta=true`;
case "agentrouter":
return this.usesClaudeCodeProtocol(credentials)

View File

@@ -17,8 +17,10 @@ describe("Cache Control Policy - Claude Protocol Providers", () => {
// These should be detected via targetFormat
assert.equal(providerSupportsCaching("bailian-coding-plan", "claude"), true);
assert.equal(providerSupportsCaching("glm", "claude"), true);
assert.equal(providerSupportsCaching("minimax", "claude"), true);
assert.equal(providerSupportsCaching("minimax-cn", "claude"), true);
// minimax/minimax-cn use openai format (#3110 / image 403 fix);
// caching support for their OpenAI-compatible endpoint is TBD
assert.equal(providerSupportsCaching("minimax", "openai"), false);
assert.equal(providerSupportsCaching("minimax-cn", "openai"), false);
assert.equal(providerSupportsCaching("kimi-coding", "claude"), true);
// #3955 — OpenAI / Codex use automatic prefix caching (no cache_control needed).
@@ -66,15 +68,17 @@ describe("Cache Control Policy - Claude Protocol Providers", () => {
true
);
// minimax now uses openai format — caching behavior may differ;
// cache_control preservation depends on whether it joins CACHING_PROVIDERS
assert.equal(
shouldPreserveCacheControl({
userAgent: claudeCodeUA,
isCombo: false,
targetProvider: "minimax",
targetFormat: "claude",
targetFormat: "openai",
settings: { alwaysPreserveClientCache: "auto" },
}),
true
false
);
});

View File

@@ -73,6 +73,26 @@ describe("MiniMax M3 model registration (#3110)", () => {
assert.equal(m3.contextLength, 1_048_576);
});
it("minimax uses openai format (not claude) so images work via /v1/chat/completions", () => {
const entry = REGISTRY.minimax;
assert.ok(entry, "minimax registry entry must exist");
assert.equal(
entry.format,
"openai",
"minimax must use openai format — the Anthropic-compatible /anthropic/v1/messages endpoint rejects images with 403; images work on the OpenAI-compatible /v1/chat/completions endpoint. See Hermes Agent #15715."
);
});
it("minimax-cn uses openai format (not claude) so images work via /v1/chat/completions", () => {
const entry = REGISTRY["minimax-cn"];
assert.ok(entry, "minimax-cn registry entry must exist");
assert.equal(
entry.format,
"openai",
"minimax-cn must use openai format — parity with minimax; the Anthropic endpoint on api.minimaxi.com also rejects images."
);
});
it("nvidia provider does NOT list minimaxai/minimax-m3 (removed in #3329 — 404 upstream)", () => {
const entry = REGISTRY.nvidia;
assert.ok(entry, "nvidia registry entry must exist");

View File

@@ -137,12 +137,12 @@ describe("responseSanitizer/reasoning — MiniMax M3 textual reasoning-tag route
});
describe("responseSanitizer/reasoning — MiniMax M3 fix regression guards", () => {
it("direct minimax tier (claude format) stays unaffected", () => {
it("direct minimax tier (openai format) stays unaffected for textual reasoning tags", () => {
assert.equal(isTextualReasoningTagNativeRoute("minimax", "minimax-m3"), false);
assert.equal(shouldParseTextualReasoningTags("minimax", "MiniMax-M3"), false);
});
it("direct minimax-cn tier (claude format) stays unaffected", () => {
it("direct minimax-cn tier (openai format) stays unaffected for textual reasoning tags", () => {
assert.equal(isTextualReasoningTagNativeRoute("minimax-cn", "minimax-m3"), false);
assert.equal(shouldParseTextualReasoningTags("minimax-cn", "MiniMax-M3"), false);
});

View File

@@ -145,14 +145,14 @@ test("preserves zero timeout so readiness checks can be disabled", () => {
assert.deepEqual(result.reasons, ["disabled"]);
});
test("bumps small requests to third-party Claude-format replicas (Minimax M3, ZAI, bailian, agentrouter) — guards against #3825-class false 504s on long reasoning warm-ups", () => {
// Provider registry lists Minimax with `format: "claude"` — the readiness budget
test("bumps small requests to third-party Claude-format replicas (agentrouter, ZAI, bailian) — guards against #3825-class false 504s on long reasoning warm-ups", () => {
// Provider registry lists agentrouter with `format: "claude"` — the readiness budget
// must fire UNCONDITIONALLY for those replicas, like the codex_gpt_5_5_high
// bump, because their reasoning warm-ups routinely exceed the default 80s window.
const result = resolveStreamReadinessTimeout({
baseTimeoutMs: 80_000,
provider: "minimax",
model: "MiniMax-M3",
provider: "agentrouter",
model: "claude-opus-4-8",
body: { messages: items(3), tools: tools(2) },
});
@@ -163,6 +163,23 @@ test("bumps small requests to third-party Claude-format replicas (Minimax M3, ZA
);
});
test("does NOT bump Minimax (M3) — #3110 moved it from claude to openai format so images work, and the readiness bump is keyed off the registry's `format: \"claude\"` field", () => {
// Minimax's replica quirk (long reasoning warm-up) hasn't changed, but this
// policy intentionally keys off the translator format, not the provider
// name — the registry is the single source of truth (see isClaudeFormatReasoningProvider
// doc comment). Now that minimax routes through the OpenAI translator, it no
// longer matches, mirroring the OpenAI/non-Claude exclusion below.
const result = resolveStreamReadinessTimeout({
baseTimeoutMs: 80_000,
provider: "minimax",
model: "MiniMax-M3",
body: { messages: items(3), tools: tools(2) },
});
assert.equal(result.timeoutMs, 80_000);
assert.ok(!result.reasons.includes("claude_format_heavy_reasoning"));
});
test("bumps ZAI (claude-format replica) readiness budget the same way", () => {
const result = resolveStreamReadinessTimeout({
baseTimeoutMs: 80_000,
@@ -213,13 +230,13 @@ test("does NOT double-bump when codex-high reasoning and Claude-format replica b
// Claude-format providers later, the readiness bump must not stack.
const result = resolveStreamReadinessTimeout({
baseTimeoutMs: 80_000,
provider: "minimax",
model: "MiniMax-M3-high",
provider: "agentrouter",
model: "claude-opus-4-8-high",
body: { messages: items(3), tools: tools(2), reasoning_effort: "high" },
});
// Should be bumped by exactly one reason — claude_format_heavy_reasoning —
// because minimax is not a codex provider, the codex_* path never fires.
// because agentrouter is not a codex provider, the codex_* path never fires.
assert.equal(result.timeoutMs, 110_000);
assert.ok(result.reasons.includes("claude_format_heavy_reasoning"));
assert.ok(!result.reasons.includes("codex_gpt_5_5_high_reasoning"));
@@ -229,8 +246,8 @@ test("caps Claude-format replica bump at the configured maxTimeoutMs", () => {
const result = resolveStreamReadinessTimeout({
baseTimeoutMs: 80_000,
maxTimeoutMs: 100_000,
provider: "minimax",
model: "MiniMax-M3",
provider: "agentrouter",
model: "claude-opus-4-8",
body: { messages: items(500), tools: tools(20), instructions: "x".repeat(800_000) },
});