// Provider display order — mirrors `PROVIDERS` in ui/login.tsx so the
// /model selector and login selector sort models identically.
export const MODELS = [
    // ── Anthropic ──────────────────────────────────────────
    {
        id: "claude-opus-4-8",
        name: "Claude Opus 4.8",
        provider: "anthropic",
        contextWindow: 1_000_000,
        maxOutputTokens: 128_000,
        supportsThinking: true,
        supportsImages: true,
        supportsVideo: false,
        costTier: "high",
        maxThinkingLevel: "max",
    },
    {
        id: "claude-sonnet-4-6",
        name: "Claude Sonnet 4.6",
        provider: "anthropic",
        contextWindow: 1_000_000,
        maxOutputTokens: 64_000,
        supportsThinking: true,
        supportsImages: true,
        supportsVideo: false,
        costTier: "medium",
        maxThinkingLevel: "max",
    },
    {
        id: "claude-haiku-4-5-20251001",
        name: "Claude Haiku 4.5",
        provider: "anthropic",
        contextWindow: 200_000,
        maxOutputTokens: 64_000,
        supportsThinking: true,
        supportsImages: true,
        supportsVideo: false,
        costTier: "low",
        maxThinkingLevel: "high",
    },
    // ── OpenAI (Codex) ─────────────────────────────────────
    {
        id: "gpt-5.5",
        name: "GPT-5.5",
        provider: "openai",
        contextWindow: 1_050_000,
        codexContextWindow: 272_000,
        maxOutputTokens: 128_000,
        supportsThinking: true,
        supportsImages: true,
        supportsVideo: false,
        costTier: "high",
        maxThinkingLevel: "xhigh",
    },
    {
        id: "gpt-5.4",
        name: "GPT-5.4",
        provider: "openai",
        contextWindow: 1_050_000,
        codexContextWindow: 272_000,
        maxOutputTokens: 128_000,
        supportsThinking: true,
        supportsImages: true,
        supportsVideo: false,
        costTier: "high",
        maxThinkingLevel: "xhigh",
    },
    {
        id: "gpt-5.4-mini",
        name: "GPT-5.4 Mini",
        provider: "openai",
        contextWindow: 400_000,
        maxOutputTokens: 128_000,
        supportsThinking: true,
        supportsImages: true,
        supportsVideo: false,
        costTier: "low",
        maxThinkingLevel: "xhigh",
    },
    {
        id: "gpt-5.3-codex",
        name: "GPT-5.3 Codex",
        provider: "openai",
        contextWindow: 400_000,
        maxOutputTokens: 128_000,
        supportsThinking: true,
        supportsImages: true,
        supportsVideo: false,
        costTier: "high",
        maxThinkingLevel: "xhigh",
    },
    // ── Gemini ─────────────────────────────────────────────
    {
        id: "gemini-3.1-flash-lite-preview",
        name: "Gemini 3.1 Flash Lite Preview",
        provider: "gemini",
        contextWindow: 1_048_576,
        maxOutputTokens: 65_536,
        supportsThinking: true,
        supportsImages: true,
        supportsVideo: true,
        maxVideoBytes: 20 * 1024 * 1024,
        costTier: "low",
        maxThinkingLevel: "high",
    },
    {
        id: "gemini-3.5-flash",
        name: "Gemini 3.5 Flash",
        provider: "gemini",
        contextWindow: 1_048_576,
        maxOutputTokens: 65_536,
        supportsThinking: true,
        supportsImages: true,
        supportsVideo: true,
        maxVideoBytes: 20 * 1024 * 1024,
        costTier: "low",
        maxThinkingLevel: "high",
    },
    // ── Moonshot (Kimi) ────────────────────────────────────
    {
        id: "kimi-k2.6",
        name: "Kimi K2.6",
        provider: "moonshot",
        contextWindow: 262_144,
        maxOutputTokens: 262_144,
        supportsThinking: true,
        supportsImages: true,
        supportsVideo: true,
        maxVideoBytes: 100 * 1024 * 1024,
        costTier: "medium",
        maxThinkingLevel: "high",
    },
    // ── Z.AI (GLM) ─────────────────────────────────────────
    {
        id: "glm-5.1",
        name: "GLM-5.1",
        provider: "glm",
        contextWindow: 204_800,
        maxOutputTokens: 131_072,
        supportsThinking: true,
        supportsImages: false,
        supportsVideo: false,
        costTier: "medium",
        maxThinkingLevel: "high",
    },
    {
        id: "glm-4.7",
        name: "GLM-4.7",
        provider: "glm",
        contextWindow: 200_000,
        maxOutputTokens: 131_072,
        supportsThinking: true,
        supportsImages: false,
        supportsVideo: false,
        costTier: "low",
        maxThinkingLevel: "high",
    },
    {
        id: "glm-4.7-flash",
        name: "GLM-4.7 Flash",
        provider: "glm",
        contextWindow: 200_000,
        maxOutputTokens: 131_072,
        supportsThinking: true,
        supportsImages: false,
        supportsVideo: false,
        costTier: "low",
        maxThinkingLevel: "high",
    },
    // ── MiniMax ────────────────────────────────────────────
    {
        id: "MiniMax-M3",
        name: "MiniMax M3",
        provider: "minimax",
        contextWindow: 1_000_000,
        maxOutputTokens: 131_072,
        supportsThinking: true,
        supportsImages: true,
        supportsVideo: true,
        maxVideoBytes: 50 * 1024 * 1024,
        costTier: "medium",
        maxThinkingLevel: "high",
    },
    // ── Xiaomi (MiMo) ──────────────────────────────────────
    // Pro series: text-only coding/agentic flagship. The legacy mimo-v2-pro
    // auto-routes to v2.5 on 2026-06-01 and is fully deprecated by 2026-06-30.
    {
        id: "mimo-v2.5-pro",
        name: "MiMo-V2.5-Pro",
        provider: "xiaomi",
        contextWindow: 1_000_000,
        maxOutputTokens: 131_072,
        supportsThinking: true,
        supportsImages: false,
        supportsVideo: false,
        costTier: "medium",
        maxThinkingLevel: "high",
    },
    // Omni series: native full-modal understanding (image + audio + video).
    // Video/image ride the OpenAI-compatible transport as base64 data URLs
    // (`video_url`/`image_url`), which the shared transform already emits.
    {
        id: "mimo-v2.5",
        name: "MiMo-V2.5",
        provider: "xiaomi",
        contextWindow: 1_000_000,
        maxOutputTokens: 131_072,
        supportsThinking: true,
        // MiMo-V2.5 is natively omnimodal (image/audio/video understanding).
        supportsImages: true,
        supportsVideo: true,
        maxVideoBytes: 36 * 1024 * 1024,
        costTier: "low",
        maxThinkingLevel: "high",
    },
    // ── DeepSeek ───────────────────────────────────────────
    {
        id: "deepseek-v4-pro",
        name: "DeepSeek V4 Pro",
        provider: "deepseek",
        contextWindow: 1_048_576,
        maxOutputTokens: 384_000,
        supportsThinking: true,
        supportsImages: false,
        supportsVideo: false,
        costTier: "high",
        // DeepSeek V4 maps `xhigh` → its internal `max` tier.
        maxThinkingLevel: "xhigh",
    },
    {
        id: "deepseek-v4-flash",
        name: "DeepSeek V4 Flash",
        provider: "deepseek",
        contextWindow: 1_048_576,
        maxOutputTokens: 384_000,
        supportsThinking: true,
        supportsImages: false,
        supportsVideo: false,
        costTier: "low",
        maxThinkingLevel: "xhigh",
    },
    // ── OpenRouter ─────────────────────────────────────────
    {
        id: "qwen/qwen3.6-plus",
        name: "Qwen3.6-Plus",
        provider: "openrouter",
        contextWindow: 1_000_000,
        maxOutputTokens: 65_536,
        supportsThinking: true,
        supportsImages: false,
        supportsVideo: false,
        costTier: "medium",
        maxThinkingLevel: "high",
    },
];
export function getModel(id) {
    return MODELS.find((m) => m.id === id);
}
export function getModelsForProvider(provider) {
    return MODELS.filter((m) => m.provider === provider);
}
/** Default video payload cap (bytes) when a video model doesn't declare one. */
export const DEFAULT_MAX_VIDEO_BYTES = 20 * 1024 * 1024;
/**
 * Max video payload (bytes) the given model's transport accepts before the clip
 * must be compressed. Returns `undefined` for models without video support, so
 * callers can skip the native-video path entirely.
 */
export function getVideoByteLimit(modelId) {
    const model = getModel(modelId);
    if (!model?.supportsVideo)
        return undefined;
    return model.maxVideoBytes ?? DEFAULT_MAX_VIDEO_BYTES;
}
export function getDefaultModel(provider) {
    if (provider === "xiaomi")
        return MODELS.find((m) => m.id === "mimo-v2.5-pro");
    if (provider === "openai")
        return MODELS.find((m) => m.id === "gpt-5.5");
    if (provider === "gemini")
        return MODELS.find((m) => m.id === "gemini-3.1-flash-lite-preview");
    if (provider === "glm")
        return MODELS.find((m) => m.id === "glm-5.1");
    if (provider === "moonshot")
        return MODELS.find((m) => m.id === "kimi-k2.6");
    if (provider === "minimax")
        return MODELS.find((m) => m.id === "MiniMax-M3");
    if (provider === "deepseek")
        return MODELS.find((m) => m.id === "deepseek-v4-pro");
    if (provider === "openrouter")
        return MODELS.find((m) => m.id === "qwen/qwen3.6-plus");
    return MODELS.find((m) => m.id === "claude-sonnet-4-6");
}
export function usesOpenAICodexTransport(options) {
    return options?.provider === "openai" && Boolean(options.accountId);
}
export function getContextWindow(modelId, options) {
    const model = getModel(modelId);
    if (!model)
        return 200_000;
    if (usesOpenAICodexTransport(options) && model.codexContextWindow) {
        return model.codexContextWindow;
    }
    return model.contextWindow;
}
/**
 * The strongest thinking level the given model genuinely uses. Falls back to
 * `"high"` for unknown models since every provider we ship accepts it.
 */
export function getMaxThinkingLevel(modelId) {
    return getModel(modelId)?.maxThinkingLevel ?? "high";
}
/**
 * Get the model to use for compaction summarization.
 * - Anthropic: always Sonnet 4.6
 * - OpenAI: cheapest (Codex Mini)
 * - Gemini: use the current model
 * - GLM: GLM-4.7 Flash (cheap alternative)
 * - Moonshot: use the current model (no cheap alternative)
 */
export function getSummaryModel(provider, currentModelId) {
    if (provider === "anthropic") {
        return MODELS.find((m) => m.id === "claude-sonnet-4-6");
    }
    if (provider === "openai" || provider === "glm" || provider === "deepseek") {
        const low = getModelsForProvider(provider).find((m) => m.costTier === "low");
        if (low)
            return low;
    }
    // Moonshot or fallback: use current model
    return getModel(currentModelId) ?? getDefaultModel(provider);
}
//# sourceMappingURL=model-registry.js.map