Files
OmniRoute/open-sse/executors/maxai/catalog.ts
Armin Anton” ∴ cabbbe410a feat(providers): add MaxAI — signed OpenAI-compatible provider (chat, tools, vision, image-gen, doc-RAG) (#11461)
MaxAI joins as a first-class signed provider: 13 chat models discovered live from /models/get_config plus 6 image models, routed through the standard /v1 endpoints with per-request X-Authorization signing, browserless onboarding, prompted tool-calling, vision input, image generation and document RAG.

Reconciled on merge — worth reading, because the branch forked 227 commits back and 77 files conflicted. Only five carried MaxAI content; the rest was drift from the older release line and took the tip's side, taking the diff from 113 files to 37 (then 93 as counted against the current base).

- executors/index.ts: the tip has since refactored the executor map to lazy dynamic imports, so MaxAI is registered in that shape rather than the branch's static import.
- imageRegistry.ts: kept only the maxai block. The branch still carried microsoft-designer-web, which #11754 retired.
- models/route.ts: the conflicting hunk was an unrelated Vertex/Anthropic URL change, not MaxAI — tip's side.
- volcengine agent-plan/coding-plan registries: git auto-merged both sides and produced a duplicated supportsVision key, which TypeScript rejects (TS1117). Removed.

One real integration break that only the combined state shows: the MaxAI entry declared no serviceKinds, which #11392 made required a few hours ago. Provider validation threw at load time and check:provider-consistency crashed outright. Declared ["llm"] — the image kinds derive from imageRegistry, per the convention in that PR's backfill.

Every count was measured rather than taken from the branch, and each would have been wrong: reserved prefixes are 402, not the 397 the branch computed from its stale 395 base; providers are 353, not 354. PROVIDER_REFERENCE.md regenerated, the count updated across README/AGENTS.md/llm.txt and its 42 mirrors, package.json and 6 SVGs — every changed line in those files is a digit substitution and nothing else, verified by masking digits and comparing the removed and added sets (90 lines, identical). The executor-map golden snapshot was regenerated: keyCount 133 -> 134.

The branch's file-size-baseline.json predates #12411's ratchet re-tightening, so it was discarded rather than merged — taking it would have silently undone that. The three files this PR grows (proxyFetch.ts +20 for the Windows/firefox_150 TLS profile, imageGeneration.ts +12, models/route.ts +48) were entered against the current baseline under one _rebaseline annotation; no other cap moves.

Verified: typecheck:core clean, check:provider-consistency OK (269 REGISTRY entries, 353 canonical providers), check:docs-counts exit 0, check-file-size OK, check:cycles OK, and 79/79 across the MaxAI suites plus 21/21 reserved-prefix and 2/2 executor-map-golden.

Thanks @arminanton — the provider work itself is thorough; it was the 227 commits of base that needed the attention.
2026-09-02 01:55:42 -03:00

77 lines
3.1 KiB
TypeScript

/**
* MaxAI model catalog + provider-enum mapping. Ported from the MaxAI v3 client
* (catalog/context_windows.py, tools/provider_enum.py). All 13 chat models are
* PAID (the free `mistral-7b-instruct-free` is a window-lookup fallback only and
* is not offered). Context windows are the MaxAI-reported values.
*/
import type { RegistryModel } from "../../config/providers/shared.ts";
interface MaxaiModelSpec {
id: string;
name: string;
contextLength: number;
supportsReasoning?: boolean;
/**
* Vision-capable (accepts image_url input). Sourced from MaxAI's live
* `/models/get_config` `capabilities.vision` (verified 2026-08); the executor
* forwards image parts inline in message_content for these. Live discovery
* (services/maxaiModels.ts) overrides this from the catalog at runtime; this
* static flag keeps the offline registry in agreement.
*/
supportsVision?: boolean;
}
/** The 13 offered paid chat models (group order: FAST, SMART, REASONING). */
export const MAXAI_MODELS: MaxaiModelSpec[] = [
// FAST
{ id: "gpt-5.6-luna", name: "GPT-5.6 Luna", contextLength: 1_050_000, supportsVision: true },
{ id: "claude-haiku-4-5", name: "Claude Haiku 4.5", contextLength: 200_000, supportsVision: true },
{ id: "gemini-3-1-flash-lite", name: "Gemini 3.1 Flash Lite", contextLength: 1_000_000, supportsVision: true },
{ id: "grok-4-1-fast-non-reasoning", name: "Grok 4.1 Fast", contextLength: 2_000_000 },
{ id: "llama-3.3-70b", name: "Llama 3.3 70B", contextLength: 128_000 },
{ id: "deepseek-v3.2", name: "DeepSeek V3.2", contextLength: 128_000 },
// SMART
{ id: "gpt-5.6", name: "GPT-5.6", contextLength: 1_050_000, supportsVision: true },
{ id: "claude-5-sonnet", name: "Claude 5 Sonnet", contextLength: 1_000_000 },
{
id: "grok-4-1-fast-reasoning",
name: "Grok 4.1 Fast (Reasoning)",
contextLength: 2_000_000,
supportsReasoning: true,
},
// REASONING
{
id: "gpt-5.6-thinking",
name: "GPT-5.6 Thinking",
contextLength: 1_050_000,
supportsReasoning: true,
supportsVision: true,
},
{
id: "gemini-3.1-pro-preview",
name: "Gemini 3.1 Pro Preview",
contextLength: 1_000_000,
supportsReasoning: true,
supportsVision: true,
},
{ id: "grok-4.5", name: "Grok 4.5", contextLength: 500_000, supportsReasoning: true },
{ id: "deepseek-r1", name: "DeepSeek R1", contextLength: 128_000, supportsReasoning: true },
];
/** RegistryModel[] form for the provider registry entry. */
export const MAXAI_REGISTRY_MODELS: RegistryModel[] = MAXAI_MODELS.map((m) => ({
id: m.id,
name: m.name,
contextLength: m.contextLength,
toolCalling: true, // prompted tool-calling (no native API, but supported via the tool protocol)
...(m.supportsReasoning ? { supportsReasoning: true } : {}),
...(m.supportsVision ? { supportsVision: true } : {}),
}));
/** Default context window for an unknown model. */
export const MAXAI_DEFAULT_CONTEXT = 128_000;
export function maxaiContextWindow(modelId: string): number {
return MAXAI_MODELS.find((m) => m.id === modelId)?.contextLength ?? MAXAI_DEFAULT_CONTEXT;
}