Skip to content

Independent Auditing of AI Agents. Run by human or the agent itself, to answer the most crucial question in the AI Agent Economy. Is the agent doing what is supposed to do? With iFixAi you can have this answer in less than 120 seconds.

Add MiniMax provider (#76)

Octopuscc85092aea2c
diff --git a/SECURITY.md b/SECURITY.md
index 9e0711a..b3f9ed3 100644
--- a/SECURITY.md
+++ b/SECURITY.md
@@ -40,6 +40,8 @@ The scrubber (`ifixai/providers/secrets.py::scrub_secrets`) is parametrically ve
| Provider | Credential shape matched | Redaction token |
|---|---|---|
| `openai` | `sk-[A-Za-z0-9_-]{20,}` | `***REDACTED_OPENAI_KEY***` |
+| `minimax` | `sk-cp-[A-Za-z0-9_-]+` | `***REDACTED_MINIMAX_KEY***` |
+| any (JWT-shaped bearer tokens, incl. `minimax`) | three-segment JWT beginning with `eyJ` | `***REDACTED_JWT***` |
| `atlascloud` | `(ak|apikey)-[A-Za-z0-9_-]{20,}` | `***REDACTED_ATLASCLOUD_KEY***` |
| `openrouter` | `sk-or-[A-Za-z0-9_-]{20,}` (matched before `openai`) | `***REDACTED_OPENROUTER_KEY***` |
| `anthropic` | `sk-ant-[A-Za-z0-9_-]{20,}`, `anthropic_[A-Za-z0-9_-]{20,}` | `***REDACTED_ANTHROPIC_KEY***` |
diff --git a/docs/testing-your-agent.md b/docs/testing-your-agent.md
index e8eaf1d..4042826 100644
--- a/docs/testing-your-agent.md
+++ b/docs/testing-your-agent.md
@@ -66,7 +66,7 @@ The scorecard adds a `warnings[]` note: declared, not measured at runtime. Field
different provider grades the SUT, so nothing scores itself:
- Default judge: any non-SUT provider key in your env, on that provider's default model.
-- Multiple keys: tiebreaker order `anthropic → openai → atlascloud → gemini → openrouter → azure → bedrock → huggingface`.
+- Multiple keys: tiebreaker order `anthropic → openai → atlascloud → minimax → gemini → openrouter → azure → bedrock → huggingface`.
- No non-SUT key: the run refuses unless you pass `--eval-mode self`.
- Override: `--judge-provider` / `--judge-api-key` / `--judge-model`. Pin these for
`openrouter` and `azure`: auto-routing can land SUT and judge on the same vendor.
@@ -114,6 +114,7 @@ the SUT key from the environment: pass `--api-key` / `-k`, or enter it when prom
| `anthropic` | `.[anthropic]` | `ANTHROPIC_API_KEY` | `--provider anthropic -k "$ANTHROPIC_API_KEY" --model claude-sonnet-4-6` |
| `openai` | `.[openai]` | `OPENAI_API_KEY` | `--provider openai -k "$OPENAI_API_KEY" --model gpt-4o` |
| `atlascloud` | `.[atlascloud]` | `ATLASCLOUD_API_KEY` or `ATLAS_CLOUD_API_KEY` | `--provider atlascloud -k "$ATLASCLOUD_API_KEY" --model qwen/qwen3.5-flash` |
+| `minimax` | none | `MINIMAX_API_KEY` | `--provider minimax -k "$MINIMAX_API_KEY" --model MiniMax-M3` |
| `openrouter` | `.[openrouter]` | `OPENROUTER_API_KEY` | `--provider openrouter -k "$OPENROUTER_API_KEY" --model openai/gpt-4o` plus explicit judge |
| `gemini` | `.[gemini]` | `GEMINI_API_KEY` or `GOOGLE_API_KEY` | `--provider gemini -k "$GEMINI_API_KEY"` |
| `azure` | `.[azure]` | `AZURE_OPENAI_API_KEY` | `--provider azure --endpoint https://YOUR_RESOURCE.openai.azure.com/ -k "$AZURE_OPENAI_API_KEY" --model YOUR_DEPLOYMENT_NAME` plus explicit judge |
diff --git a/ifixai/cli/init.py b/ifixai/cli/init.py
index 34d4275..5b001be 100644
--- a/ifixai/cli/init.py
+++ b/ifixai/cli/init.py
@@ -11,6 +11,7 @@ SMOKE_FIXTURE_PATH = Path(__file__).resolve().parent.parent / "fixtures" / "smok
PROVIDER_ENV_KEYS: dict[str, str] = {
"anthropic": "ANTHROPIC_API_KEY",
"openai": "OPENAI_API_KEY",
+ "minimax": "MINIMAX_API_KEY",
"openrouter": "OPENROUTER_API_KEY",
"gemini": "GEMINI_API_KEY",
"azure": "AZURE_OPENAI_API_KEY",
diff --git a/ifixai/cli/model_catalog.py b/ifixai/cli/model_catalog.py
index 474065c..a553189 100644
--- a/ifixai/cli/model_catalog.py
+++ b/ifixai/cli/model_catalog.py
@@ -2,6 +2,35 @@
from __future__ import annotations
+from ifixai.providers.minimax import DEFAULT_MODEL as MINIMAX_DEFAULT_MODEL
+from ifixai.providers.minimax import MODEL_METADATA as MINIMAX_MODEL_METADATA
+from ifixai.providers.minimax import MODEL_PRICING_TIERS as MINIMAX_MODEL_PRICING_TIERS
+
+
+def _minimax_pricing_summary(model_id: str) -> str:
+ tiers = MINIMAX_MODEL_PRICING_TIERS.get(model_id)
+ if not tiers:
+ pricing = MINIMAX_MODEL_METADATA[model_id]["pricing_usd_per_million_tokens"]
+ return f"${pricing['input']:.2f}/${pricing['output']:.2f}"
+
+ summaries = []
+ previous_limit = None
+ for tier in tiers:
+ pricing = tier["pricing_usd_per_million_tokens"]
+ limit = tier["max_input_tokens"]
+ if limit is not None:
+ range_label = f"up to {limit // 1000}k input"
+ previous_limit = limit
+ elif previous_limit is not None:
+ range_label = f"above {previous_limit // 1000}k input"
+ else:
+ range_label = "all input sizes"
+ summaries.append(
+ f"${pricing['input']:.2f}/${pricing['output']:.2f} {range_label}"
+ )
+ return "; ".join(summaries)
+
+
DEFAULT_MODEL: dict[str, str] = {
"openrouter": "openai/gpt-4o",
"openai": "gpt-4o",
@@ -10,6 +39,7 @@ DEFAULT_MODEL: dict[str, str] = {
"azure": "gpt-4o",
"bedrock": "anthropic.claude-3-5-sonnet-20241022-v2:0",
"huggingface": "meta-llama/Llama-3.3-70B-Instruct",
+ "minimax": MINIMAX_DEFAULT_MODEL,
}
MODEL_SUGGESTIONS: dict[str, list[tuple[str, str]]] = {
@@ -55,6 +85,17 @@ MODEL_SUGGESTIONS: dict[str, list[tuple[str, str]]] = {
("meta-llama/Llama-3.3-70B-Instruct", "Open-weights Llama 3.3"),
("mistralai/Mistral-7B-Instruct-v0.3", "Small, fast Mistral"),
],
+ "minimax": [
+ (
+ model_id,
+ f"{metadata['context_window']:,}-token context; "
+ f"{'/'.join(metadata['input_modalities'])} input; "
+ f"{'/'.join(metadata['thinking'])} thinking; "
+ f"{_minimax_pricing_summary(model_id)} "
+ "per 1M input/output tokens",
+ )
+ for model_id, metadata in MINIMAX_MODEL_METADATA.items()
+ ],
}
diff --git a/ifixai/cli/run.py b/ifixai/cli/run.py
index 3dcc0db..bdedcb6 100644
--- a/ifixai/cli/run.py
+++ b/ifixai/cli/run.py
@@ -132,6 +132,7 @@ PROVIDER_CHOICES = [
"mock",
"openai",
"atlascloud",
+ "minimax",
"gemini",
"anthropic",
"azure",
diff --git a/ifixai/cli/setup_cmd.py b/ifixai/cli/setup_cmd.py
index 9682979..9bd67be 100644
--- a/ifixai/cli/setup_cmd.py
+++ b/ifixai/cli/setup_cmd.py
@@ -16,6 +16,7 @@ from ifixai.cli.init import PROVIDER_ENV_KEYS, detect_available_providers
from ifixai.cli.model_catalog import default_model, suggestions
from ifixai.core.fixture_loader import list_fixture_names, load_fixture
from ifixai.harness.suites import suite_catalog
+from ifixai.providers.minimax import DEFAULT_BASE_URL, REGIONAL_ENDPOINTS
_PROVIDER_DESCRIPTIONS: dict[str, str] = {
"openrouter": "One key → many models (OpenAI, Anthropic, Google, Llama…)",
@@ -25,6 +26,7 @@ _PROVIDER_DESCRIPTIONS: dict[str, str] = {
"azure": "Azure OpenAI deployment",
"bedrock": "AWS Bedrock-hosted models",
"huggingface": "Hugging Face Inference endpoints",
+ "minimax": "MiniMax global and China text APIs",
"http": "Your real deployed agent's OpenAI-compatible HTTP endpoint (recommended)",
"langchain": "A LangChain-wrapped model",
"mock": "Built-in offline mock — no key, just to try the tool",
@@ -50,6 +52,7 @@ _ALL_PROVIDERS = [
"azure",
"bedrock",
"huggingface",
+ "minimax",
"http",
"langchain",
"mock",
@@ -57,6 +60,25 @@ _ALL_PROVIDERS = [
_CUSTOM_MODEL = "✏ Enter a custom model id…"
+_MINIMAX_ENDPOINTS: list[tuple[str, str]] = [
+ (
+ REGIONAL_ENDPOINTS["global_en"]["openai_base_url"],
+ "Global chat completions API (recommended — honours seed and JSON mode)",
+ ),
+ (
+ REGIONAL_ENDPOINTS["cn_zh"]["openai_base_url"],
+ "China chat completions API",
+ ),
+ (
+ REGIONAL_ENDPOINTS["global_en"]["anthropic_base_url"],
+ "Global messages API (no seed, no JSON mode)",
+ ),
+ (
+ REGIONAL_ENDPOINTS["cn_zh"]["anthropic_base_url"],
+ "China messages API (no seed, no JSON mode)",
+ ),
+]
+
def _pick_model(provider: str, *, role: str) -> str | None:
"""Model picker (default / suggestions / custom); None means provider default."""
@@ -129,7 +151,9 @@ def setup(ctx: click.Context) -> None:
)
else:
click.echo(
- click.style("No provider API keys detected in your environment.", fg="yellow")
+ click.style(
+ "No provider API keys detected in your environment.", fg="yellow"
+ )
)
# Surface the real-agent (http) path first: it's the highest-fidelity SUT.
@@ -166,6 +190,13 @@ def setup(ctx: click.Context) -> None:
).strip()
or None
)
+ elif provider == "minimax":
+ endpoint = ui.select(
+ "MiniMax endpoint:",
+ [value for value, _ in _MINIMAX_ENDPOINTS],
+ default=DEFAULT_BASE_URL,
+ descriptions=dict(_MINIMAX_ENDPOINTS),
+ )
if provider == "http":
grounding = "sut"
@@ -214,7 +245,9 @@ def setup(ctx: click.Context) -> None:
base = _PROVIDER_DESCRIPTIONS.get(p, "")
env = PROVIDER_ENV_KEYS.get(p)
if p == provider:
- judge_desc[p] = f"{base} — same vendor as the SUT; not an independent (citable) judge"
+ judge_desc[p] = (
+ f"{base} — same vendor as the SUT; not an independent (citable) judge"
+ )
elif p in available_names:
judge_desc[p] = f"{base} — key detected"
elif env:
@@ -272,7 +305,9 @@ def setup(ctx: click.Context) -> None:
)
elif len(judges) >= 2:
click.echo(
- click.style(f" Ensemble of {len(judges)} judges configured.", fg="cyan")
+ click.style(
+ f" Ensemble of {len(judges)} judges configured.", fg="cyan"
+ )
)
fixtures = list_fixture_names()
@@ -281,7 +316,8 @@ def setup(ctx: click.Context) -> None:
try:
fx = load_fixture(name)
fixture_desc[name] = fx.metadata.domain or fx.metadata.name or name
- except Exception: # noqa: BLE001 — best-effort environment probe; any failure falls back to the default
+ # Best-effort environment probe; any failure falls back to the default.
+ except Exception: # noqa: BLE001
fixture_desc[name] = name
fixture = ui.select(
"Fixture (the deployment profile to test against):",
diff --git a/ifixai/providers/minimax.py b/ifixai/providers/minimax.py
new file mode 100644
index 0000000..8b38cf0
--- /dev/null
+++ b/ifixai/providers/minimax.py
@@ -0,0 +1,342 @@
+import asyncio
+import json
+from typing import Any, Final, Literal, TypedDict
+
+import aiohttp
+
+from ifixai.core.types import ChatMessage, ProviderConfig
+from ifixai.providers.base import (
+ RETRYABLE_HTTP_STATUS_CODES,
+ ChatProvider,
+ ProviderAuthError,
+ ProviderConnectionError,
+ ProviderEmptyContentError,
+ ProviderOverloadedError,
+ ProviderRateLimitError,
+ ProviderResponseError,
+ ProviderTimeoutError,
+)
+from ifixai.providers.secrets import scrub_secrets
+
+
+class PricingMetadata(TypedDict):
+ input: float
+ output: float
+ cache_read: float
+ cache_write: float | None
+
+
+class ModelMetadata(TypedDict):
+ context_window: int
+ pricing_usd_per_million_tokens: PricingMetadata
+ input_modalities: list[str]
+ thinking: list[str]
+
+
+class PricingTier(TypedDict):
+ max_input_tokens: int | None
+ pricing_usd_per_million_tokens: PricingMetadata
+
+
+class RegionalEndpoint(TypedDict):
+ openai_base_url: str
+ anthropic_base_url: str
+ docs_root: str
+
+
+REGIONAL_ENDPOINTS: Final[dict[str, RegionalEndpoint]] = {
+ "global_en": {
+ "openai_base_url": "https://api.minimax.io/v1",
+ "anthropic_base_url": "https://api.minimax.io/anthropic",
+ "docs_root": "https://platform.minimax.io/docs",
+ },
+ "cn_zh": {
+ "openai_base_url": "https://api.minimaxi.com/v1",
+ "anthropic_base_url": "https://api.minimaxi.com/anthropic",
+ "docs_root": "https://platform.minimaxi.com/docs",
+ },
+}
+
+MODEL_METADATA: Final[dict[str, ModelMetadata]] = {
+ "MiniMax-M3": {
+ "context_window": 1000000,
+ "pricing_usd_per_million_tokens": {
+ "input": 0.6,
+ "output": 2.4,
+ "cache_read": 0.12,
+ "cache_write": None,
+ },
+ "input_modalities": ["text", "image", "video"],
+ "thinking": ["adaptive", "disabled"],
+ },
+ "MiniMax-M2.7": {
+ "context_window": 204800,
+ "pricing_usd_per_million_tokens": {
+ "input": 0.3,
+ "output": 1.2,
+ "cache_read": 0.06,
+ "cache_write": 0.375,
+ },
+ "input_modalities": ["text"],
+ "thinking": ["always_on"],
+ },
+}
+
+MODEL_PRICING_TIERS: Final[dict[str, list[PricingTier]]] = {
+ "MiniMax-M3": [
+ {
+ "max_input_tokens": 512000,
+ "pricing_usd_per_million_tokens": {
+ "input": 0.3,
+ "output": 1.2,
+ "cache_read": 0.06,
+ "cache_write": None,
+ },
+ },
+ {
+ "max_input_tokens": None,
+ "pricing_usd_per_million_tokens": {
+ "input": 0.6,
+ "output": 2.4,
+ "cache_read": 0.12,
+ "cache_write": None,
+ },
+ },
+ ],
+}
+
+DEFAULT_MODEL = "MiniMax-M3"
+DEFAULT_BASE_URL = REGIONAL_ENDPOINTS["global_en"]["openai_base_url"]
+DEFAULT_MAX_TOKENS = 4096
+ANTHROPIC_VERSION = "2023-06-01"
+
+APIStyle = Literal["messages", "chat_completions"]
+
+
+class MiniMaxRequest(TypedDict):
+ endpoint: str
+ url: str
+ api_style: APIStyle
+ headers: dict[str, str]
+ payload: dict[str, Any]
+
+
+def _api_style(endpoint: str) -> APIStyle:
+ normalized = endpoint.rstrip("/")
+ messages_endpoints = {
+ values["anthropic_base_url"].rstrip("/")
+ for values in REGIONAL_ENDPOINTS.values()
+ }
+ if normalized in messages_endpoints or "/anthropic" in normalized:
+ return "messages"
+ return "chat_completions"
+
+
+def _build_request(
+ messages: list[ChatMessage],
+ config: ProviderConfig,
+) -> MiniMaxRequest:
+ endpoint = (config.endpoint or DEFAULT_BASE_URL).rstrip("/")
+ api_style = _api_style(endpoint)
+ headers = {"Content-Type": "application/json"}
+ if config.api_key:
+ headers["Authorization"] = f"Bearer {config.api_key}"
+
+ model = config.model or DEFAULT_MODEL
+ if api_style == "messages":
+ headers["anthropic-version"] = ANTHROPIC_VERSION
+ system_text = "\n".join(
+ message.content for message in messages if message.role == "system"
+ )
+ payload: dict[str, Any] = {
+ "model": model,
+ "max_tokens": config.max_tokens or DEFAULT_MAX_TOKENS,
+ "messages": [
+ {"role": message.role, "content": message.content}
+ for message in messages
+ if message.role != "system"
+ ],
+ "temperature": config.temperature,
+ }
+ if system_text:
+ payload["system"] = system_text
+ url = f"{endpoint.removesuffix('/v1')}/v1/messages"
+ else:
+ payload = {
+ "model": model,
+ "messages": [
+ {"role": message.role, "content": message.content}
+ for message in messages
+ ],
+ "temperature": config.temperature,
+ }
+ if config.max_tokens is not None:
+ payload["max_tokens"] = config.max_tokens
+ if config.seed is not None:
+ payload["seed"] = config.seed
+ if config.json_output:
+ payload["response_format"] = {"type": "json_object"}
+ url = f"{endpoint}/chat/completions"
+
+ headers.update(config.extra_headers)
+ return {
+ "endpoint": endpoint,
+ "url": url,
+ "api_style": api_style,
+ "headers": headers,
+ "payload": payload,
+ }
+
+
+def _extract_response_text(
+ data: dict[str, Any],
+ api_style: APIStyle,
+ endpoint: str,
+) -> str:
+ if api_style == "messages":
+ blocks = data.get("content")
+ if not isinstance(blocks, list):
+ blocks = []
+ text_parts = [
+ block["text"]
+ for block in blocks
+ if isinstance(block, dict)
+ and block.get("type") == "text"
+ and isinstance(block.get("text"), str)
+ and block["text"]
+ ]
+ if text_parts:
+ return "\n".join(text_parts)
+ else:
+ choices = data.get("choices")
+ if isinstance(choices, list) and choices:
+ first = choices[0]
+ if isinstance(first, dict):
+ message = first.get("message")
+ if isinstance(message, dict):
+ content = message.get("content")
+ if isinstance(content, str) and content:
+ return content
+
+ raise ProviderEmptyContentError(
+ provider="minimax",
+ endpoint=endpoint,
+ details="Response did not contain text content",
+ )
+
+
+class MiniMaxProvider(ChatProvider):
+ def __init__(self) -> None:
+ self._session: aiohttp.ClientSession | None = None
+ self._session_lock = asyncio.Lock()
+
+ async def get_session(self) -> aiohttp.ClientSession:
+ if self._session is not None and not self._session.closed:
+ return self._session
+ async with self._session_lock:
+ if self._session is not None and not self._session.closed:
+ return self._session
+ self._session = aiohttp.ClientSession()
+ return self._session
+
+ async def aclose(self) -> None:
+ if self._session is not None and not self._session.closed:
+ await self._session.close()
+ self._session = None
+
+ async def send_message(
+ self,
+ messages: list[ChatMessage],
+ config: ProviderConfig,
+ ) -> str:
+ request = _build_request(messages, config)
+ timeout = aiohttp.ClientTimeout(total=config.timeout)
+ last_error: Exception | None = None
+
+ for attempt in range(config.max_retries + 1):
+ try:
+ return await self._send_request(request, timeout)
+ except (
+ ProviderConnectionError,
+ ProviderOverloadedError,
+ ProviderRateLimitError,
+ ProviderTimeoutError,
+ ) as exc:
+ last_error = exc
+ if attempt == config.max_retries:
+ raise
+ await asyncio.sleep(2**attempt)
+
+ raise last_error or ProviderConnectionError(
+ provider="minimax",
+ endpoint=request["endpoint"],
+ details="Max retries exhausted",
+ )
+
+ async def _send_request(
+ self,
+ request: MiniMaxRequest,
+ timeout: aiohttp.ClientTimeout,
+ ) -> str:
+ endpoint = request["endpoint"]
+ api_style = request["api_style"]
+ session = await self.get_session()
+ try:
+ async with session.post(
+ request["url"],
+ json=request["payload"],
+ headers=request["headers"],
+ timeout=timeout,
+ ) as response:
+ body = await response.text()
+ if response.status in {401, 403}:
+ raise ProviderAuthError(
+ provider="minimax",
+ endpoint=endpoint,
+ details=f"HTTP {response.status}: authentication failed",
+ )
+ if response.status == 429:
+ raise ProviderRateLimitError(
+ provider="minimax",
+ endpoint=endpoint,
+ details="HTTP 429: rate limited",
+ )
+ if response.status in RETRYABLE_HTTP_STATUS_CODES:
+ raise ProviderOverloadedError(
+ provider="minimax",
+ endpoint=endpoint,
+ details=f"HTTP {response.status}: {scrub_secrets(body[:500])}",
+ )
+ if response.status >= 400:
+ raise ProviderResponseError(
+ provider="minimax",
+ endpoint=endpoint,
+ details=f"HTTP {response.status}: {scrub_secrets(body[:500])}",
+ )
+ try:
+ data = json.loads(body)
+ except json.JSONDecodeError as exc:
+ raise ProviderResponseError(
+ provider="minimax",
+ endpoint=endpoint,
+ details="Response was not valid JSON",
+ ) from exc
+ if not isinstance(data, dict):
+ raise ProviderResponseError(
+ provider="minimax",
+ endpoint=endpoint,
+ details="Response JSON was not an object",
+ )
+ return _extract_response_text(data, api_style, endpoint)
+ except asyncio.TimeoutError as exc:
+ raise ProviderTimeoutError(
+ provider="minimax",
+ endpoint=endpoint,
+ details="Request timed out",
+ ) from exc
+ except aiohttp.ClientError as exc:
+ raise ProviderConnectionError(
+ provider="minimax",
+ endpoint=endpoint,
+ details=str(exc),
+ ) from exc
diff --git a/ifixai/providers/resolver.py b/ifixai/providers/resolver.py
index 57199cf..db3218e 100644
--- a/ifixai/providers/resolver.py
+++ b/ifixai/providers/resolver.py
@@ -7,6 +7,7 @@ from ifixai.providers.governance_fixture import GovernanceFixture
from ifixai.providers.governance_mixin import GovernanceMixin
from ifixai.providers.http import HttpProvider
from ifixai.providers.langchain import LangChainProvider
+from ifixai.providers.minimax import MiniMaxProvider
from ifixai.providers.mock_governance import MockGovernanceProvider
try:
@@ -60,6 +61,7 @@ REGISTERED_PROVIDERS: tuple[str, ...] = (
"mock",
"openai",
"atlascloud",
+ "minimax",
"openrouter",
"anthropic",
"gemini",
@@ -79,6 +81,7 @@ _PROVIDER_MAP: dict[str, type] = {
"http": HttpProvider,
"openai": OpenAIProvider,
"atlascloud": AtlasCloudProvider,
+ "minimax": MiniMaxProvider,
"openrouter": OpenRouterProvider,
"anthropic": AnthropicProvider,
"gemini": GeminiProvider,
@@ -151,6 +154,7 @@ def resolve_provider(provider: str | object) -> object:
_PROVIDER_CREDENTIAL_ENV_VARS: dict[str, tuple[str, ...]] = {
"openai": ("OPENAI_API_KEY",),
"atlascloud": ("ATLASCLOUD_API_KEY", "ATLAS_CLOUD_API_KEY"),
+ "minimax": ("MINIMAX_API_KEY",),
"anthropic": ("ANTHROPIC_API_KEY",),
"gemini": ("GEMINI_API_KEY", "GOOGLE_API_KEY"),
"azure": ("AZURE_OPENAI_API_KEY",),
@@ -169,6 +173,7 @@ _JUDGE_PREFERENCE_ORDER: tuple[str, ...] = (
"anthropic",
"openai",
"atlascloud",
+ "minimax",
"gemini",
"openrouter",
"azure",
diff --git a/ifixai/providers/secrets.py b/ifixai/providers/secrets.py
index e011edf..c86c01d 100644
--- a/ifixai/providers/secrets.py
+++ b/ifixai/providers/secrets.py
@@ -6,6 +6,7 @@ from typing import Any, Final
ENV_VAR_BY_PROVIDER: dict[str, str] = {
"anthropic": "ANTHROPIC_API_KEY",
"openai": "OPENAI_API_KEY",
+ "minimax": "MINIMAX_API_KEY",
"atlascloud": "ATLASCLOUD_API_KEY",
"gemini": "GEMINI_API_KEY",
"azure": "AZURE_OPENAI_API_KEY",
@@ -14,6 +15,7 @@ ENV_VAR_BY_PROVIDER: dict[str, str] = {
}
_SECRET_PATTERNS: Final[tuple[Pattern[str], ...]] = (
+ re.compile(r"^sk-cp-[A-Za-z0-9_-]+$"),
re.compile(r"^sk-or-[A-Za-z0-9_-]{20,}$"),
re.compile(r"^ak-[A-Za-z0-9_-]{20,}$"),
re.compile(r"^sk-ant-[A-Za-z0-9_-]{20,}$"),
@@ -26,6 +28,17 @@ _SECRET_PATTERNS: Final[tuple[Pattern[str], ...]] = (
)
_SCRUB_RULES: Final[tuple[tuple[Pattern[str], str], ...]] = (
+ (
+ re.compile(r"sk-cp-[A-Za-z0-9_-]+"),
+ "***REDACTED_MINIMAX_KEY***",
+ ),
+ (
+ re.compile(
+ r"(?<![A-Za-z0-9_-])eyJ[A-Za-z0-9_-]{10,}"
+ r"\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}(?![A-Za-z0-9_-])"
+ ),
+ "***REDACTED_JWT***",
+ ),
(
re.compile(r"sk-or-[A-Za-z0-9_-]{20,}"),
"***REDACTED_OPENROUTER_KEY***",
diff --git a/test_atlascloud_provider.py b/test_atlascloud_provider.py
deleted file mode 100644
index 14d0733..0000000
--- a/test_atlascloud_provider.py
+++ /dev/null
@@ -1,82 +0,0 @@
-import pytest
-
-from ifixai.core.types import ProviderConfig
-from ifixai.judge.config import JudgeConfig
-from ifixai.providers.atlascloud import (
- DEFAULT_BASE_URL,
- DEFAULT_MODEL,
- AtlasCloudProvider,
-)
-from ifixai.providers.resolver import (
- credential_env_vars,
- detect_available_credentials,
- resolve_credential,
- resolve_provider,
- select_cross_provider_judge,
-)
-from ifixai.providers.secrets import scrub_secrets
-from ifixai.reporting.scorecard import self_judge_bias_applies
-
-
-def test_atlascloud_resolves_and_reads_credentials() -> None:
- provider = resolve_provider("atlascloud")
-
- assert isinstance(provider, AtlasCloudProvider)
- assert credential_env_vars("atlascloud") == (
- "ATLASCLOUD_API_KEY",
- "ATLAS_CLOUD_API_KEY",
- )
- assert resolve_credential(
- "atlascloud",
- {"ATLASCLOUD_API_KEY": "apikey-test-value-for-atlascloud"},
- ) == "apikey-test-value-for-atlascloud"
- assert "atlascloud" in detect_available_credentials(
- {"ATLAS_CLOUD_API_KEY": "ak-test-value-for-atlascloud"}
- )
-
-
-def test_atlascloud_can_be_selected_as_independent_judge() -> None:
- assert select_cross_provider_judge("openai", ["openai", "atlascloud"]) == "atlascloud"
- assert select_cross_provider_judge("atlascloud", ["openai", "atlascloud"]) == "openai"
-
-
-async def test_atlascloud_client_uses_openai_compatible_defaults() -> None:
- provider = AtlasCloudProvider()
- config = ProviderConfig(provider="atlascloud", api_key="ak-test-value-for-atlascloud")
-
- try:
- client = await provider.get_client(config)
-
- assert str(client.base_url) == f"{DEFAULT_BASE_URL}/"
- assert provider._clients[
- (DEFAULT_BASE_URL, config.api_key, float(config.timeout), config.max_retries)
- ] is client
- assert DEFAULT_MODEL == "qwen/qwen3.5-flash"
- finally:
- await provider.aclose()
-
-
-def test_atlascloud_keys_are_scrubbed() -> None:
- assert (
- scrub_secrets("token ak-abcdefghijklmnopqrstuvwxyz")
- == "token ***REDACTED_ATLASCLOUD_KEY***"
- )
- assert scrub_secrets("break-glass-escalation-path") == "break-glass-escalation-path"
- assert (
- scrub_secrets("token apikey-abcdefghijklmnopqrstuvwxyz")
- == "token apikey-abcdefghijklmnopqrstuvwxyz"
- )
-
-
-def test_atlascloud_is_treated_as_aggregator_for_bias_detection() -> None:
- assert not self_judge_bias_applies(
- JudgeConfig(provider="atlascloud", model="anthropic/claude-sonnet-4-6"),
- "openai",
- "gpt-4o",
- )
- assert self_judge_bias_applies(
- JudgeConfig(provider="atlascloud", model="openai/gpt-4o"),
- "openai",
- "gpt-4o",
- )