mirror of
https://github.com/farcasclaudiu/openclaw.git
synced 2026-06-28 17:01:53 +03:00
fix(providers): switch MiniMax API-key provider to anthropic-messages (#15297)
Merged via /review-pr -> /prepare-pr -> /merge-pr. Prepared head SHA: 0e7f84a2a103135221b73e2c3f300790206fc6f4 Co-authored-by: lailoo <20536249+lailoo@users.noreply.github.com> Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com> Reviewed-by: @gumadeiras
This commit is contained in:
@@ -57,6 +57,8 @@ Docs: https://docs.openclaw.ai
|
|||||||
- Process/Exec: avoid shell execution for `.exe` commands on Windows so env overrides work reliably in `runCommandWithTimeout`. Thanks @thewilloftheshadow.
|
- Process/Exec: avoid shell execution for `.exe` commands on Windows so env overrides work reliably in `runCommandWithTimeout`. Thanks @thewilloftheshadow.
|
||||||
- Web tools/web_fetch: prefer `text/markdown` responses for Cloudflare Markdown for Agents, add `cf-markdown` extraction for markdown bodies, and redact fetched URLs in `x-markdown-tokens` debug logs to avoid leaking raw paths/query params. (#15376) Thanks @Yaxuan42.
|
- Web tools/web_fetch: prefer `text/markdown` responses for Cloudflare Markdown for Agents, add `cf-markdown` extraction for markdown bodies, and redact fetched URLs in `x-markdown-tokens` debug logs to avoid leaking raw paths/query params. (#15376) Thanks @Yaxuan42.
|
||||||
- Config: keep legacy audio transcription migration strict by rejecting non-string/unsafe command tokens while still migrating valid custom script executables. (#5042) Thanks @shayan919293.
|
- Config: keep legacy audio transcription migration strict by rejecting non-string/unsafe command tokens while still migrating valid custom script executables. (#5042) Thanks @shayan919293.
|
||||||
|
- Status/Sessions: stop clamping derived `totalTokens` to context-window size, keep prompt-token snapshots wired through session accounting, and surface context usage as unknown when fresh snapshot data is missing to avoid false 100% reports. (#15114) Thanks @echoVic.
|
||||||
|
- Providers/MiniMax: switch implicit MiniMax API-key provider from `openai-completions` to `anthropic-messages` with the correct Anthropic-compatible base URL, fixing `invalid role: developer (2013)` errors on MiniMax M2.5. (#15275)
|
||||||
|
|
||||||
## 2026.2.12
|
## 2026.2.12
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
import { mkdtempSync } from "node:fs";
|
||||||
|
import { tmpdir } from "node:os";
|
||||||
|
import { join } from "node:path";
|
||||||
|
import { describe, expect, it } from "vitest";
|
||||||
|
import { resolveImplicitProviders } from "./models-config.providers.js";
|
||||||
|
|
||||||
|
describe("MiniMax implicit provider (#15275)", () => {
|
||||||
|
it("should use anthropic-messages API for API-key provider", async () => {
|
||||||
|
const agentDir = mkdtempSync(join(tmpdir(), "openclaw-test-"));
|
||||||
|
const previous = process.env.MINIMAX_API_KEY;
|
||||||
|
process.env.MINIMAX_API_KEY = "test-key";
|
||||||
|
|
||||||
|
try {
|
||||||
|
const providers = await resolveImplicitProviders({ agentDir });
|
||||||
|
expect(providers?.minimax).toBeDefined();
|
||||||
|
expect(providers?.minimax?.api).toBe("anthropic-messages");
|
||||||
|
expect(providers?.minimax?.baseUrl).toBe("https://api.minimax.io/anthropic");
|
||||||
|
} finally {
|
||||||
|
if (previous === undefined) {
|
||||||
|
delete process.env.MINIMAX_API_KEY;
|
||||||
|
} else {
|
||||||
|
process.env.MINIMAX_API_KEY = previous;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -32,7 +32,6 @@ import { discoverVeniceModels, VENICE_BASE_URL } from "./venice-models.js";
|
|||||||
type ModelsConfig = NonNullable<OpenClawConfig["models"]>;
|
type ModelsConfig = NonNullable<OpenClawConfig["models"]>;
|
||||||
export type ProviderConfig = NonNullable<ModelsConfig["providers"]>[string];
|
export type ProviderConfig = NonNullable<ModelsConfig["providers"]>[string];
|
||||||
|
|
||||||
const MINIMAX_API_BASE_URL = "https://api.minimax.chat/v1";
|
|
||||||
const MINIMAX_PORTAL_BASE_URL = "https://api.minimax.io/anthropic";
|
const MINIMAX_PORTAL_BASE_URL = "https://api.minimax.io/anthropic";
|
||||||
const MINIMAX_DEFAULT_MODEL_ID = "MiniMax-M2.1";
|
const MINIMAX_DEFAULT_MODEL_ID = "MiniMax-M2.1";
|
||||||
const MINIMAX_DEFAULT_VISION_MODEL_ID = "MiniMax-VL-01";
|
const MINIMAX_DEFAULT_VISION_MODEL_ID = "MiniMax-VL-01";
|
||||||
@@ -380,8 +379,8 @@ export function normalizeProviders(params: {
|
|||||||
|
|
||||||
function buildMinimaxProvider(): ProviderConfig {
|
function buildMinimaxProvider(): ProviderConfig {
|
||||||
return {
|
return {
|
||||||
baseUrl: MINIMAX_API_BASE_URL,
|
baseUrl: MINIMAX_PORTAL_BASE_URL,
|
||||||
api: "openai-completions",
|
api: "anthropic-messages",
|
||||||
models: [
|
models: [
|
||||||
{
|
{
|
||||||
id: MINIMAX_DEFAULT_MODEL_ID,
|
id: MINIMAX_DEFAULT_MODEL_ID,
|
||||||
|
|||||||
Reference in New Issue
Block a user