Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions open-sse/utils/noThinkingAlias.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* thinking-capable model into a no-thinking mode purely by *model selection*, the
* gateway exposes a synthetic catalog id:
*
* claude-3-omniroute-no-thinking/<provider>/<model>
* no-think/<provider>/<model>
*
* When such an id arrives on a request we strip the prefix back to the real
* `<provider>/<model>` and suppress reasoning (`thinking:{type:"disabled"}` for the
Expand All @@ -21,7 +21,7 @@
*/
import { getModelSpec } from "@/shared/constants/modelSpecs";

export const NO_THINKING_PREFIX = "claude-3-omniroute-no-thinking/";
export const NO_THINKING_PREFIX = "no-think/";

/** True when `modelId` carries the no-thinking gateway prefix. */
export function isNoThinkingAlias(modelId: unknown): modelId is string {
Expand Down
2 changes: 1 addition & 1 deletion src/shared/constants/modelSpecs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export interface ModelSpec {
// (2026-05-19): "Any request that tries to set a fixed thinking budget gets a 400 error."
adaptiveThinkingOnly?: boolean;
// Explicit operator override for the no-thinking gateway alias (Fase 8.1). When unset,
// the catalog auto-advertises a `claude-3-omniroute-no-thinking/…` variant for
// the catalog auto-advertises a `no-think/…` variant for
// Claude-family thinking-capable models that honor `disabled`. Set `true` to force the
// variant on for any other model, or `false` to suppress it. See open-sse/utils/noThinkingAlias.ts.
noThinkingAlias?: boolean;
Expand Down
2 changes: 1 addition & 1 deletion src/sse/handlers/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ export async function handleChat(
// Log request endpoint and model
const url = new URL(request.url);

// No-thinking gateway alias (Fase 8.1): `claude-3-omniroute-no-thinking/<provider>/<model>`
// No-thinking gateway alias (Fase 8.1): `no-think/<provider>/<model>`
// resolves back to the real model with reasoning suppressed in place, before any
// model resolution / combo routing sees it. Claude/Messages path forces
// `thinking:{type:"disabled"}`; OpenAI path drops the reasoning fields.
Expand Down
30 changes: 15 additions & 15 deletions tests/unit/no-thinking-alias.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ import {
// ── prefix predicates ────────────────────────────────────────────────────────

test("NO_THINKING_PREFIX is the documented gateway prefix", () => {
assert.equal(NO_THINKING_PREFIX, "claude-3-omniroute-no-thinking/");
assert.equal(NO_THINKING_PREFIX, "no-think/");
});

test("isNoThinkingAlias detects the prefix only", () => {
assert.equal(isNoThinkingAlias("claude-3-omniroute-no-thinking/anthropic/claude-opus-4-5"), true);
assert.equal(isNoThinkingAlias("no-think/anthropic/claude-opus-4-5"), true);
assert.equal(isNoThinkingAlias("anthropic/claude-opus-4-5"), false);
assert.equal(isNoThinkingAlias("claude-opus-4-5"), false);
// non-strings never match
Expand All @@ -28,7 +28,7 @@ test("isNoThinkingAlias detects the prefix only", () => {

test("stripNoThinkingAlias unwraps the prefix and passes plain ids through", () => {
assert.equal(
stripNoThinkingAlias("claude-3-omniroute-no-thinking/anthropic/claude-opus-4-5"),
stripNoThinkingAlias("no-think/anthropic/claude-opus-4-5"),
"anthropic/claude-opus-4-5"
);
assert.equal(stripNoThinkingAlias("claude-opus-4-5"), "claude-opus-4-5");
Expand All @@ -37,7 +37,7 @@ test("stripNoThinkingAlias unwraps the prefix and passes plain ids through", ()
test("toNoThinkingAlias round-trips with stripNoThinkingAlias", () => {
const real = "anthropic/claude-sonnet-4-6";
const alias = toNoThinkingAlias(real);
assert.equal(alias, "claude-3-omniroute-no-thinking/anthropic/claude-sonnet-4-6");
assert.equal(alias, "no-think/anthropic/claude-sonnet-4-6");
assert.equal(isNoThinkingAlias(alias), true);
assert.equal(stripNoThinkingAlias(alias), real);
});
Expand All @@ -46,7 +46,7 @@ test("toNoThinkingAlias round-trips with stripNoThinkingAlias", () => {

test("applyNoThinkingAlias rewrites the model and disables thinking (Claude format)", () => {
const body: Record<string, unknown> = {
model: "claude-3-omniroute-no-thinking/anthropic/claude-opus-4-5",
model: "no-think/anthropic/claude-opus-4-5",
thinking: { type: "enabled", budget_tokens: 8000 },
reasoning_effort: "high",
messages: [],
Expand All @@ -61,7 +61,7 @@ test("applyNoThinkingAlias rewrites the model and disables thinking (Claude form

test("applyNoThinkingAlias strips reasoning fields without a thinking block (OpenAI format)", () => {
const body: Record<string, unknown> = {
model: "claude-3-omniroute-no-thinking/openai/gpt-5.4",
model: "no-think/openai/gpt-5.4",
reasoning_effort: "high",
reasoning: { effort: "high" },
messages: [],
Expand Down Expand Up @@ -90,12 +90,12 @@ test("applyNoThinkingAlias is a no-op for plain models", () => {
});

test("applyNoThinkingAlias ignores a malformed prefix-only model", () => {
const body: Record<string, unknown> = { model: "claude-3-omniroute-no-thinking/" };
const body: Record<string, unknown> = { model: "no-think/" };
const res = applyNoThinkingAlias(body, { claudeFormat: true });
assert.equal(res.applied, false);
assert.equal(
body.model,
"claude-3-omniroute-no-thinking/",
"no-think/",
"left untouched when nothing follows the prefix"
);
});
Expand All @@ -118,7 +118,7 @@ test("shouldExposeNoThinkingAlias rejects models where suppression is meaningles
assert.equal(shouldExposeNoThinkingAlias(entry("my-combo", "combo")), false);
// never double-alias
assert.equal(
shouldExposeNoThinkingAlias(entry("claude-3-omniroute-no-thinking/anthropic/claude-opus-4-5")),
shouldExposeNoThinkingAlias(entry("no-think/anthropic/claude-opus-4-5")),
false
);
});
Expand All @@ -128,15 +128,15 @@ test("appendNoThinkingVariants adds one variant per eligible model and preserves
const out = appendNoThinkingVariants(models);
const ids = out.map((m) => m.id);
assert.ok(
ids.includes("claude-3-omniroute-no-thinking/claude-opus-4-5"),
ids.includes("no-think/claude-opus-4-5"),
"eligible model gets a variant"
);
assert.ok(
!ids.includes("claude-3-omniroute-no-thinking/gpt-4o"),
!ids.includes("no-think/gpt-4o"),
"non-thinking model has no variant"
);
assert.ok(
!ids.includes("claude-3-omniroute-no-thinking/claude-fable-5"),
!ids.includes("no-think/claude-fable-5"),
"reject-disabled model has no variant"
);
assert.equal(out.length, models.length + 1, "exactly one variant appended");
Expand All @@ -155,11 +155,11 @@ test("appendNoThinkingVariants normalizes alias prefix to canonical when aliasTo
const out = appendNoThinkingVariants(models, aliasToCanonical);
const ids = out.map((m) => m.id);
assert.ok(
ids.includes("claude-3-omniroute-no-thinking/claude/claude-opus-4-5"),
ids.includes("no-think/claude/claude-opus-4-5"),
"uses canonical prefix"
);
assert.ok(
!ids.includes("claude-3-omniroute-no-thinking/cc/claude-opus-4-5"),
!ids.includes("no-think/cc/claude-opus-4-5"),
"alias prefix not used"
);
});
Expand All @@ -169,7 +169,7 @@ test("appendNoThinkingVariants keeps alias prefix when no map is provided", () =
const out = appendNoThinkingVariants(models);
const ids = out.map((m) => m.id);
assert.ok(
ids.includes("claude-3-omniroute-no-thinking/cc/claude-opus-4-5"),
ids.includes("no-think/cc/claude-opus-4-5"),
"alias prefix preserved"
);
});
Loading