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

1022 B
Raw Blame
import test from "node:test";
import assert from "node:assert/strict";

import { mapRawModelToModelV2 } from "../src/index.ts";

test("mapRawModelToModelV2: bare combo ids stay unprefixed (#10345)", () => {
  const combo = mapRawModelToModelV2(
    {
      id: "gpt-5.6-sol",
      owned_by: "combo",
      context_length: 272000,
      max_output_tokens: 8192,
    },
    { providerId: "omniroute", baseURL: "https://or.example.com/v1" }
  );
  assert.equal(combo.id, "gpt-5.6-sol");
  assert.equal(combo.providerID, "omniroute");

  const slashed = mapRawModelToModelV2(
    {
      id: "cx/gpt-5.6-sol",
      owned_by: "combo",
      context_length: 272000,
    },
    { providerId: "omniroute", baseURL: "https://or.example.com/v1" }
  );
  assert.equal(slashed.id, "cx/gpt-5.6-sol");

  const ordinary = mapRawModelToModelV2(
    { id: "claude-primary", context_length: 200000 },
    { providerId: "omniroute", baseURL: "https://or.example.com/v1" }
  );
  assert.equal(ordinary.id, "omniroute/claude-primary");
});