Skip to content

Never stop coding. Free MIT AI gateway: one endpoint, 375 providers (150+ free), 1,400+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 900+ contributors

1.2 KB
Raw Blame
import {
  STANDARD_REASONING_EFFORTS,
  EXTENDED_REASONING_EFFORTS,
} from "@omniroute/open-sse/config/reasoningEfforts.ts";
import { codexModelFamilySupportsExtendedEffort } from "./codexExtendedEffort";

export { STANDARD_REASONING_EFFORTS, EXTENDED_REASONING_EFFORTS };

type ExtendedReasoningEffort = (typeof EXTENDED_REASONING_EFFORTS)[number];

/**
 * The rules editor accepts provider-prefixed ids (`codex/`, `cx/`, `openai/` #14961, and
 * `github/`, `opencode-zen/`… #14059); the alias-set lookup shared with the Codex executor
 * (#14720) matches bare ids, so strip any single provider namespace here — the same way the
 * routing policy resolves `modelIdForRegistry`.
 */
export function supportsExtendedCodexEffort(
  model: string,
  effort: ExtendedReasoningEffort
): boolean {
  return codexModelFamilySupportsExtendedEffort(model.trim().replace(/^[^/]+\//, ""), effort);
}

export function getReasoningRoutingTargetEffortOptions(
  model: string,
  currentTargetEffort: string
): string[] {
  return [
    ...STANDARD_REASONING_EFFORTS,
    ...EXTENDED_REASONING_EFFORTS.filter(
      (effort) => supportsExtendedCodexEffort(model, effort) || currentTargetEffort === effort
    ),
  ];
}