Compare commits

..

3 Commits

Author SHA1 Message Date
diegosouzapw
2a48a0a823 Merge remote-tracking branch 'origin/release/v3.8.55' into fix/codeql-redos-compression
# Conflicts:
#	open-sse/services/compression/engines/headroom/gcf/scalar.ts
#	open-sse/services/compression/engines/rtk/rawOutput.ts
2026-11-21 00:25:29 -03:00
diegosouzapw
c13cee2357 chore(changelog): prefix the fragment with PR #20825 2026-11-20 18:33:25 -03:00
diegosouzapw
eca9826d29 fix(security): bound regex work in compression engines (CodeQL #1301, #1302, #1349)
- headroom GCF needsQuote: inline-array regex excludes '[' from the bracket body (same .test verdict, linear on '[' runs).
- RTK raw-output: cut the tool_use command to 256 chars before the slug replaces.
- CCR grep: reject patterns with more than one unbounded quantifier and run the scan under a 1000 ms vm timeout.
2026-11-20 18:31:14 -03:00
918 changed files with 2856 additions and 44106 deletions

View File

@@ -891,19 +891,6 @@ ALLOW_API_KEY_REVEAL=false
# Default: https://api.getnadir.com
# OMNIROUTE_NADIR_BASE_URL=https://api.getnadir.com
# Opt-in for the `decision` auto-combo router strategy (feature flag; a dashboard DB
# override wins). While off, decision combos read no credential, make no call and route
# with the rules strategy.
# Used by: open-sse/services/autoCombo/decisionStrategy.ts
# Default: false
# COMBO_DECISION_ROUTER_ENABLED=false
# Key for the `decision` router's network deciders (systemone, http), used when the
# combo's config.decision.connectionId is unset (and, for systemone, no typesafe
# connection is in scope). A combo never stores a key. Sensitive.
# Used by: open-sse/services/decision/credentials.ts
# OMNIROUTE_DECISION_API_KEY=
# Weekly window for per-API-key USD usage limits.
# Used by: src/lib/usage/apiKeyUsageLimits.ts (request enforcement, key usage-limit
# status, @@om-usage). Values: provider | calendar | Default: provider
@@ -2626,13 +2613,6 @@ APP_LOG_TO_FILE=true
# Used by: src/lib/healthzLag.ts (event-loop stall sampler). Disabled by default;
# logs sizes and inflight count only, never bodies or heap snapshots.
# OMNIROUTE_EVENT_LOOP_STALL_THRESHOLD_MS=0 stops that sampler, and this diagnostic with it.
# Optional response header for troubleshooting Codex OAuth plan eligibility.
# OFF by default: when enabled, API callers can see the recognized subscription tier
# of the selected Codex connection in X-OmniRoute-Selected-Connection-Plan.
# Do not enable on public/multi-tenant gateways if this account metadata is private.
# Arbitrary/unrecognized plan values and non-Codex requests never get this header.
# OMNIROUTE_CODEX_PLAN_RESPONSE_HEADER=0
# OMNIROUTE_HEAP_DIAGNOSTICS_ENABLED=0
# Heap-use threshold in MiB for the opt-in diagnostic (default: 900).
# A high-heap log is rate-limited to once per 60 seconds.

View File

@@ -22,11 +22,7 @@ name: omni-queue
# • Both jobs run in the `omni-queue` environment, which holds the App's credentials and the
# owner's OMNI_QUEUE_LAND_TOKEN and admits the default branch only, by its exact name: a
# workflow on a candidate branch cannot read them. The App writes omni-queue/land, the status release rulesets
# require, so its private key is the root of trust. The land token reaches the tick only
# (the landing with landing.actor "owner"; the comments, label removals and issues with
# config voice "owner"). The owner's merge-commit signing key (OMNI_QUEUE_SIGNING_KEY,
# config landing.signing "ssh") reaches one step of the tick, which writes it to a 0600 file
# under RUNNER_TEMP; the job's last step removes it, whatever happened.
# require, so its private key is the root of trust. The land token reaches the tick only.
# • action=bless (the explicit emergency exit): the tick writes omni-queue/land on ONE commit
# for a hotfix, sync-back or base repair, after checking that both the dispatcher
# (github.actor) and whoever triggered the run (github.triggering_actor, the re-runner of a
@@ -239,35 +235,10 @@ jobs:
echo "name=${login}"
echo "email=${id}+${login}@users.noreply.github.com"
} >> "$GITHUB_OUTPUT"
# config.landing.signing "ssh": the owner's SSH signing key, for the queue's merge commits
# (scripts/merge-queue/compose.mjs reads it at compose.signingKeyPath(RUNNER_TEMP) and hands
# git the path as per-command configuration, never as an argument). The key exists only in
# this step's environment and in a file only the runner user can read; it is never
# printed. Without the secret nothing is written and a tick that is asked to sign composes
# unsigned, with one `error` event per batch. This step never fails the job: a key it
# cannot write is the same case (signing never blocks the queue).
- name: Write the merge-commit signing key
env:
OMNI_QUEUE_SIGNING_KEY: ${{ secrets.OMNI_QUEUE_SIGNING_KEY }}
run: |
set -uo pipefail
if [ -z "${OMNI_QUEUE_SIGNING_KEY:-}" ]; then
echo "no merge-commit signing key in the environment: nothing written"
exit 0
fi
umask 077
if ! { mkdir -p "$RUNNER_TEMP/omni-queue-signing" \
&& chmod 700 "$RUNNER_TEMP/omni-queue-signing" \
&& printf '%s\n' "$OMNI_QUEUE_SIGNING_KEY" > "$RUNNER_TEMP/omni-queue-signing/signing-key" \
&& chmod 600 "$RUNNER_TEMP/omni-queue-signing/signing-key"; }; then
rm -rf "$RUNNER_TEMP/omni-queue-signing"
echo "::warning::the merge-commit signing key could not be written: merge commits stay unsigned"
fi
# Inputs travel through env and are assembled into an argv array: no expression is ever
# expanded inside the script body. Scheduled, workflow_run and pull_request_target ticks
# pass no base (the tick discovers the bases with work). The owner's land token is used
# by the landing itself when config.landing.actor is "owner", and by the queue's comments,
# label removals and issues when config.voice is "owner" (never printed).
# only by the landing itself when config.landing.actor is "owner" (never printed).
# GITHUB_ACTOR and GITHUB_TRIGGERING_ACTOR are the runner's own default variables, named
# here because a bless is checked against both: the original dispatcher, whose inputs a
# re-run keeps, and whoever triggered this run (the re-runner of a re-run).
@@ -294,8 +265,3 @@ jobs:
if [ -n "${INPUT_SHA:-}" ]; then args+=(--sha "$INPUT_SHA"); fi
fi
node scripts/merge-queue/tick.mjs "${args[@]}"
# Last step, whatever happened before it (failure, cancellation): the signing key leaves
# the runner. Needs no secret; nothing to remove is not an error.
- name: Remove the merge-commit signing key
if: always()
run: rm -rf "$RUNNER_TEMP/omni-queue-signing"

View File

@@ -20,7 +20,6 @@ jobs:
steps:
- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5
with:
ref: ${{ github.sha }}
persist-credentials: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7
with:
@@ -29,13 +28,17 @@ jobs:
- uses: ./.github/actions/npm-ci-retry
with:
cache: "false"
- name: Validate and retain the live gate inventory
run: node scripts/quality/release-acceptance/run-shadow.mjs "$RUNNER_TEMP/release-acceptance-shadow"
- name: Emit shadow acceptance report
run: |
node scripts/quality/validate-release-acceptance.mjs \
--plan tests/fixtures/release-acceptance/plan-lint.json \
--manifests tests/fixtures/release-acceptance/shadow-manifests \
--out release-acceptance-report.json
continue-on-error: true
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
if: always()
with:
name: release-acceptance-report
path: ${{ runner.temp }}/release-acceptance-shadow/
if-no-files-found: error
path: release-acceptance-report.json
if-no-files-found: ignore
retention-days: 30

View File

@@ -101,37 +101,35 @@ server reads it, not only in the shell that runs `opencode models`.
## Options
| Key | Default | Notes |
| --------------------------------------- | ---------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `providerId` | `"omniroute"` | Provider id and integration id; models publish under `<providerId>/...` |
| `baseURL` | required | OmniRoute gateway root (no `/v1` suffix needed) |
| `apiKey` | connected credential, then `OMNIROUTE_API_KEY` | Chat key for `/v1/*` — see [Credentials](#credentials) |
| `managementReadToken` | option, then `OMNIROUTE_MANAGEMENT_API_KEY`, then `apiKey` | Management key for `/api/*` (combos, providers, enrichment) — usually **not** the same key |
| `displayName` | `"OmniRoute"` | Provider display name |
| `timeoutMs` | `10000` | Per-endpoint fetch timeout |
| `modelCacheTtlMs` | `300000` | Catalog cache TTL and background refresh period (minimum 60000 ms): the served catalog follows the gateway within this window, with no service restart; disk snapshot warms cold starts |
| `timeouts` | per-endpoint override | `{ models, combos, enrichment }` in ms; falls back to `timeoutMs` (`autoCombos` still parses but is ignored — the virtual-entries route is no longer requested) |
| `enrichment` | `true` | Fetch names + pricing (`/api/pricing*`, `/api/free-tier/summary`) |
| `providerTag` | `true` | Toggle the trailing editor parenthesis: `Provider - Model (Editor)`. The provider (the route that serves the model: Openrouter, Opencode-go, Nvidia for `nvidia/...` ids) is always shown; the editor (who made the model: MoonshotAI, Meta, DeepSeek) appears only in the parenthesis. Example: `Openrouter - MoonshotAI: Kimi K 3.1 Pro` -> `Openrouter - Kimi K 3.1 Pro (MoonshotAI)`. The parenthesis is omitted when the editor shares the provider's name. Set `false` to drop it. |
| `geminiSanitization` | `true` | Strip `$schema`/`additionalProperties` from tool schemas sent to Gemini models (`$ref` tools are forwarded untouched) |
| `usableOnly` | `false` | Filter to healthy provisioned providers (`/api/providers`) |
| `combosSource` | `"api"` | Combo source. `"api"` reads `/api/combos` and publishes a combo only when every member passes the filters; `"models"` skips that request and publishes the combo rows `/v1/models` serves. Any preset, `usableOnly`, `providersAllow` or visible/hidden list keeps `"api"` |
| `freeOnly` / `toolsOnly` / `visionOnly` | `false` / `false` / `false` | Filter to free-tier / tool-calling / image-input models; combos with a filtered member are dropped, never partial. Presets filter the pool before the default view ranks it, and a combo publishes only when every resolved member passes (dropped when a member fails or none resolves) |
| `freeSignals` | `["declared"]` | Extra signals that admit a model under `freeOnly`: `priced`, `named`, `provider-named` (see below) |
| `freeProviders` | none | Provider prefixes counted as free by `provider-named` |
| `showcasePerOwner` | `10` | Default-view entries kept per provider |
| `freshPerOwner` | `10` | Default-view fresh entries kept per provider |
| `freshWindowDays` | `90` | Freshness window in days for the fresh branch |
| `usageMemory` | `true` | Restore statically dropped entries named by 30-day usage analytics (needs a management token; inert without one) |
| `visibleModels` / `hiddenModels` | `[]` | Exact (`cc/keep-me`), suffix (`keep-me`), or branch (`prefix/*`) entries ; deny wins ; `"*"` publishes the full catalog and skips narrowing |
| `providersAllow` | `[]` | Provider allowlist by flat name, or branch claim (`prefix/*`) for exhaustive mode ; a branch claim names a branch, a flat entry names a provider prefix |
| `combos` | `true` | Set to `false` to hide every combo (no `/api/combos` request, no combo rows from `/v1/models`) ; models are unchanged |
| `apiFormat.allowAnthropic` | `false` | Route allowlisted ids to the Anthropic API block |
| `apiFormat.anthropicModels` | `[]` | Full model ids routed to Anthropic |
| `apiFormat.anthropicPrefixes` | v1 defaults | Deprecated, warns once — prefer `anthropicModels` |
| `modelOrder` | `provider → name → recency → id` | Ordered list of `{ key, direction }` pairs that sorts the published catalog; each entry is `{ key, direction?: "asc" \| "desc" }`. Keys: `provider` (upstream owner), `name` (display name), `recency` (release date), `free` (zero-cost first), `price` (input, then output cost), `context` (window size). Omitted `direction` uses the key's default — `asc` for `provider`, `name`, `free`, `price`; `desc` for `recency`, `context`. A missing release date or context window sorts last in either direction; an entry whose cost is all zero counts as free; `id` always breaks the final tie. Unknown key or direction fails the plugin load, naming the value and the supported set. **Default changed:** without this option the catalog used to publish in raw API arrival order and now publishes as `provider → name → recency → id`. An explicit `[]` equals the default. |
| `telemetry` | `false` | Opt-in; marks inference requests through the host SDK hook when enabled |
| `logLevel` / `startupDebug` | `warn` / `false` | Logger verbosity |
| Key | Default | Notes |
| --------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `providerId` | `"omniroute"` | Provider id and integration id; models publish under `<providerId>/...` |
| `baseURL` | required | OmniRoute gateway root (no `/v1` suffix needed) |
| `apiKey` | connected credential, then `OMNIROUTE_API_KEY` | Chat key for `/v1/*` — see [Credentials](#credentials) |
| `managementReadToken` | option, then `OMNIROUTE_MANAGEMENT_API_KEY`, then `apiKey` | Management key for `/api/*` (combos, providers, enrichment) — usually **not** the same key |
| `displayName` | `"OmniRoute"` | Provider display name |
| `timeoutMs` | `10000` | Per-endpoint fetch timeout |
| `modelCacheTtlMs` | `300000` | Catalog cache TTL and background refresh period (minimum 60000 ms): the served catalog follows the gateway within this window, with no service restart; disk snapshot warms cold starts |
| `timeouts` | per-endpoint override | `{ models, combos, enrichment }` in ms; falls back to `timeoutMs` (`autoCombos` still parses but is ignored — the virtual-entries route is no longer requested) |
| `enrichment` | `true` | Fetch names + pricing (`/api/pricing*`, `/api/free-tier/summary`) |
| `providerTag` | `true` | Toggle the trailing editor parenthesis: `Provider - Model (Editor)`. The provider (the route that serves the model: Openrouter, Opencode-go, Nvidia for `nvidia/...` ids) is always shown; the editor (who made the model: MoonshotAI, Meta, DeepSeek) appears only in the parenthesis. Example: `Openrouter - MoonshotAI: Kimi K 3.1 Pro` -> `Openrouter - Kimi K 3.1 Pro (MoonshotAI)`. The parenthesis is omitted when the editor shares the provider's name. Set `false` to drop it. |
| `geminiSanitization` | `true` | Strip `$schema`/`additionalProperties` from tool schemas sent to Gemini models (`$ref` tools are forwarded untouched) |
| `usableOnly` | `false` | Filter to healthy provisioned providers (`/api/providers`) |
| `combosSource` | `"api"` | Combo source. `"api"` reads `/api/combos` and publishes a combo only when every member passes the filters; `"models"` skips that request and publishes the combo rows `/v1/models` serves. Any preset, `usableOnly`, `providersAllow` or visible/hidden list keeps `"api"` |
| `freeOnly` / `toolsOnly` / `visionOnly` | `false` / `false` / `false` | Filter to free-tier / tool-calling / image-input models; combos with a filtered member are dropped, never partial. Presets filter the pool before the default view ranks it, and a combo publishes only when every resolved member passes (dropped when a member fails or none resolves) |
| `freeSignals` | `["declared"]` | Extra signals that admit a model under `freeOnly`: `priced`, `named`, `provider-named` (see below) |
| `freeProviders` | none | Provider prefixes counted as free by `provider-named` |
| `showcasePerOwner` | `10` | Default-view entries kept per provider |
| `freshPerOwner` | `10` | Default-view fresh entries kept per provider |
| `freshWindowDays` | `90` | Freshness window in days for the fresh branch |
| `usageMemory` | `true` | Restore statically dropped entries named by 30-day usage analytics (needs a management token; inert without one) |
| `visibleModels` / `hiddenModels` | `[]` | Exact (`cc/keep-me`), suffix (`keep-me`), or branch (`prefix/*`) entries ; deny wins ; `"*"` publishes the full catalog and skips narrowing |
| `providersAllow` | `[]` | Provider allowlist by flat name, or branch claim (`prefix/*`) for exhaustive mode ; a branch claim names a branch, a flat entry names a provider prefix |
| `combos` | `true` | Set to `false` to hide every combo (no `/api/combos` request, no combo rows from `/v1/models`) ; models are unchanged |
| `apiFormat.allowAnthropic` | `false` | Route allowlisted ids to the Anthropic API block |
| `apiFormat.anthropicModels` | `[]` | Full model ids routed to Anthropic |
| `apiFormat.anthropicPrefixes` | v1 defaults | Deprecated, warns once — prefer `anthropicModels` |
| `logLevel` / `startupDebug` | `warn` / `false` | Logger verbosity |
`toolsOnly` is off by default, so the full catalog is published. Set
`toolsOnly: true` to hide models without tool calling from the host picker —

View File

@@ -1,198 +0,0 @@
/**
* Configurable catalog ordering.
*
* `buildProviderPayload` historically published models in raw `Map` insertion
* order (arrival order from the API), which the host surfaced as-is. This
* module gives the operator an ordered list of criteria — each with a
* direction — to apply to the published catalog. Without a setting the default
* chain is `provider → name → recency → id`.
*
* It reproduces the `ownerKeyOf` (owner group) and `compareByRecency`
* (release date, newest first, unknown = oldest) semantics from
* `catalog-freshness.ts`; they are re-implemented here (not imported) because
* that file is shared with the stacked freshness work and speaks the raw entry
* shape, whereas the sort runs over the legacy shape held in the `collected`
* map. An equivalence test pins the shared sample against `compareByRecency`.
*/
import type { LegacyModel } from "./legacy-model.js";
/** Sortable criteria, in the closed set the options schema accepts. */
export const CATALOG_ORDER_KEYS = [
"provider",
"name",
"recency",
"free",
"price",
"context",
] as const;
export type CatalogOrderKey = (typeof CATALOG_ORDER_KEYS)[number];
/** Direction values; `asc` = ascending, `desc` = descending. */
export const CATALOG_ORDER_DIRECTIONS = ["asc", "desc"] as const;
export type CatalogOrderDirection = (typeof CATALOG_ORDER_DIRECTIONS)[number];
/** One criterion in the ordered list. `direction` may be omitted. */
export interface CatalogOrderSpec {
key: CatalogOrderKey;
direction?: CatalogOrderDirection;
}
/**
* Default chain applied when no `modelOrder` is set. `id` is the final tie
* breaker and is never a user-selectable key.
*/
export const DEFAULT_CATALOG_ORDER: readonly CatalogOrderSpec[] = [
{ key: "provider" },
{ key: "name" },
{ key: "recency" },
];
/** Default direction per key when `direction` is omitted. */
export function defaultDirectionFor(key: CatalogOrderKey): CatalogOrderDirection {
switch (key) {
case "name":
case "provider":
case "free":
case "price":
return "asc";
case "recency":
case "context":
return "desc";
}
}
/**
* The sortable projection of one collected entry. Every field that can be
* missing in the raw data is a sentinel (`NaN` / false) so the comparator can
* rank "absent" last in either direction without crashing.
*/
export interface CatalogOrderEntry {
/** Full collected key, `X/<provider>/<model>…`; final tie breaker (asc). */
id: string;
/**
* Upstream owner = the prefix of the host-visible id (before the first
* `/`), i.e. the same extraction as `ownerKeyOf`. NOT the plugin prefix
* (`X`), which is identical for every entry and would leave the criterion
* inert.
*/
provider: string;
name: string;
/** `Date.parse(release_date)`; absent/unparseable → `NaN` (= oldest). */
releaseDateMs: number;
/** True when every cost component is present and zero. */
free: boolean;
/** `cost.input`; absent/non-finite → `NaN`. */
priceInput: number;
/** `cost.output`; absent/non-finite → `NaN`. */
priceOutput: number;
/** `limit.context`; absent/non-finite → `NaN`. */
context: number;
}
function num(value: unknown): number {
return typeof value === "number" && Number.isFinite(value) ? value : NaN;
}
/**
* Project a collected `(key, legacy)` pair into a sortable entry. The `key`
* is `X/<provider>/<model>…`; the host-visible id is everything after the
* first `/`, and its owner prefix is the `provider` criterion.
*/
export function toOrderEntry(key: string, legacy: LegacyModel): CatalogOrderEntry {
const slash = key.indexOf("/");
const bareId = slash > 0 ? key.slice(slash + 1) : legacy.id;
const ownerSlash = bareId.indexOf("/");
const provider = ownerSlash > 0 ? bareId.slice(0, ownerSlash) : bareId;
const cost = legacy.cost ?? ({} as LegacyModel["cost"]);
const priceInput = num(cost.input);
const priceOutput = num(cost.output);
const cacheRead = num(cost.cache?.read);
const cacheWrite = num(cost.cache?.write);
const free = priceInput === 0 && priceOutput === 0 && cacheRead === 0 && cacheWrite === 0;
// The upstream map projects an absent context window to 0; only a finite,
// strictly positive value is a real window. Anything else is absent, so the
// entry ranks last on the `context` criterion in both directions.
const rawContext = num(legacy.limit?.context);
const context = rawContext > 0 ? rawContext : NaN;
return {
id: key,
provider,
name: legacy.name ?? "",
releaseDateMs: typeof legacy.release_date === "string" ? Date.parse(legacy.release_date) : NaN,
free,
priceInput,
priceOutput,
context,
};
}
/** Normalized text compare, case/punctuation-insensitive, natural numeric. */
function compareText(a: string, b: string): number {
const na = a.normalize("NFC").toLowerCase();
const nb = b.normalize("NFC").toLowerCase();
return na.localeCompare(nb, "en", { sensitivity: "base", numeric: true });
}
/**
* Compare two values for one criterion with a given direction. An absent
* value (NaN) always ranks last regardless of direction; two absent values are
* equal so the next criterion breaks the tie.
*/
function compareValue(a: number, b: number, direction: CatalogOrderDirection): number {
const aAbs = Number.isNaN(a);
const bAbs = Number.isNaN(b);
if (aAbs && bAbs) return 0;
if (aAbs) return 1; // absent always last
if (bAbs) return -1;
const diff = a - b;
if (diff === 0) return 0;
return direction === "asc" ? (diff < 0 ? -1 : 1) : diff < 0 ? 1 : -1;
}
/**
* Build a comparator for the ordered criterion list. Criteria are applied in
* written order; on equality it falls through to the next, and the final tie
* is broken by `id` ascending (normalized).
*/
export function catalogOrderComparator(
specs: readonly CatalogOrderSpec[]
): (a: CatalogOrderEntry, b: CatalogOrderEntry) => number {
const resolved: Array<{ key: CatalogOrderKey; dir: CatalogOrderDirection }> = specs.map(
(spec) => ({ key: spec.key, dir: spec.direction ?? defaultDirectionFor(spec.key) })
);
return (a, b) => {
for (const { key, dir } of resolved) {
let cmp: number;
switch (key) {
case "provider":
cmp = compareText(a.provider, b.provider);
break;
case "name":
cmp = compareText(a.name, b.name);
break;
case "recency":
cmp = compareValue(a.releaseDateMs, b.releaseDateMs, dir);
break;
case "free":
// free (0) vs paid (1): asc = free first, desc = paid first.
cmp = compareValue(a.free ? 0 : 1, b.free ? 0 : 1, dir);
break;
case "price":
cmp =
compareValue(a.priceInput, b.priceInput, dir) ||
compareValue(a.priceOutput, b.priceOutput, dir);
break;
case "context":
cmp = compareValue(a.context, b.context, dir);
break;
}
if (cmp !== 0) return cmp;
}
return compareText(a.id, b.id);
};
}

View File

@@ -8,13 +8,6 @@ import {
type ProviderResolve,
} from "./provider-filter.js";
import type { LegacyModel } from "./legacy-model.js";
import {
catalogOrderComparator,
DEFAULT_CATALOG_ORDER,
toOrderEntry,
type CatalogOrderEntry,
type CatalogOrderSpec,
} from "./catalog-order.js";
import { isUserComboRow, usesModelsComboSource, type CombosSource } from "./combos-source.js";
import {
comboLookupName,
@@ -57,7 +50,6 @@ import {
mapComboToModelV2,
mapRawModelToModelV2,
usableProviderAliasSet,
withInferredFreeLabel,
} from "./shared/index.js";
import {
compileModelListFilter,
@@ -136,11 +128,6 @@ export interface ResolvedOptions extends FreeOptions {
toolsOnly?: boolean;
visionOnly?: boolean;
enrichment?: OmniRouteEnrichmentMap | boolean;
/**
* Ordered catalog sort criteria; each with an optional direction. Absent or
* empty applies the default chain `provider → name → recency → id`.
*/
modelOrder?: readonly CatalogOrderSpec[];
/**
* Per-provider showcase size. Absent means the catalog default
* (`SHOWCASE_PER_OWNER`); direct callers keep working without it.
@@ -747,7 +734,7 @@ async function publishCombos(
} satisfies CapabilityPresetFlags)
)
continue;
if (comboInferred) mapped.name = withInferredFreeLabel(mapped.name, INFERRED_FREE_LABEL);
if (comboInferred) mapped.name += INFERRED_FREE_LABEL;
const mid = mapped.id.startsWith(X + "/") ? mapped.id.slice(X.length + 1) : mapped.id;
const key = X + "/" + mid;
if (publishedKeys.has(key)) {
@@ -1001,7 +988,7 @@ export async function collectCatalog(
)
continue;
afterPresets += 1;
if (inferred) mapped.name = withInferredFreeLabel(mapped.name, INFERRED_FREE_LABEL);
if (inferred) mapped.name += INFERRED_FREE_LABEL;
const mid = mapped.id.startsWith(X + "/") ? mapped.id.slice(X.length + 1) : mapped.id;
const key = X + "/" + mid;
collected.set(key, mapped);
@@ -1054,7 +1041,7 @@ export async function collectCatalog(
} satisfies CapabilityPresetFlags)
)
continue;
if (restoreInferred) mapped.name = withInferredFreeLabel(mapped.name, INFERRED_FREE_LABEL);
if (restoreInferred) mapped.name += INFERRED_FREE_LABEL;
const mid = mapped.id.startsWith(X + "/") ? mapped.id.slice(X.length + 1) : mapped.id;
const key = X + "/" + mid;
collected.set(key, mapped);
@@ -1158,14 +1145,7 @@ export function buildProviderPayload(
integrationID: X,
} as unknown as StableProviderInfo;
const models: StableModelInfo[] = [];
const specs =
opts.modelOrder && opts.modelOrder.length > 0 ? opts.modelOrder : DEFAULT_CATALOG_ORDER;
const ordered: Array<{ key: string; legacy: LegacyModel; entry: CatalogOrderEntry }> = [
...collected.entries,
].map(([key, legacy]) => ({ key, legacy, entry: toOrderEntry(key, legacy) }));
const compare = catalogOrderComparator(specs);
ordered.sort((a, b) => compare(a.entry, b.entry));
for (const { key, legacy } of ordered) {
for (const [key, legacy] of collected.entries) {
const slash = key.indexOf("/");
const bareId = slash > 0 ? key.slice(slash + 1) : legacy.id;
models.push(legacyToStable(X, bareId, legacy, opts.apiKey, opts.baseURL));

View File

@@ -35,7 +35,6 @@ import {
parsePluginOptions,
resolveTimeouts,
toResolvedOptions,
warnOnIgnoredFreeSignals,
} from "./options.js";
/**
@@ -103,7 +102,6 @@ export default Plugin.define({
`[omniroute-plugin] [WARN] host log probe failed, keeping console output: ${err instanceof Error ? err.message : String(err)}`
);
}
warnOnIgnoredFreeSignals(ctx.options, parsed, (message) => log.warn(message));
log.info(`[omniroute-v2] init providerId=${X}`);
// The inference key stands in below when no management token is set, and
// gateways usually reject that stand-in with 401/403. Say so once here,

View File

@@ -60,7 +60,7 @@ export interface LegacyModel {
limit: {
context: number;
input?: number;
output?: number;
output: number;
};
status: "alpha" | "beta" | "deprecated" | "active";
options: {

View File

@@ -2,29 +2,9 @@ import { z } from "zod";
import { DEFAULT_MODEL_CACHE_TTL_MS } from "./cache.js";
import type { ResolvedOptions } from "./catalog.js";
import {
CATALOG_ORDER_DIRECTIONS,
CATALOG_ORDER_KEYS,
type CatalogOrderSpec,
} from "./catalog-order.js";
import { DEFAULT_FREE_SIGNALS, FREE_SIGNALS } from "./shared/free-signals.js";
import { isHttpUrl } from "./shared/models-map.js";
const catalogOrderSpecSchema = z
.object({
key: z.enum(CATALOG_ORDER_KEYS, {
error: (issue) =>
`invalid modelOrder key ${JSON.stringify(issue.input)}: expected one of ${CATALOG_ORDER_KEYS.join(" | ")}`,
}),
direction: z
.enum(CATALOG_ORDER_DIRECTIONS, {
error: (issue) =>
`invalid modelOrder direction ${JSON.stringify(issue.input)}: expected one of ${CATALOG_ORDER_DIRECTIONS.join(" | ")}`,
})
.optional(),
})
.strict();
const apiFormatSchema = z
.object({
allowAnthropic: z.boolean().optional(),
@@ -102,11 +82,6 @@ const pluginOptionsSchema = z
// declarations bound for a Gemini model. On by default — leaving them in
// fails the whole request with 400 INVALID_ARGUMENT.
geminiSanitization: z.boolean().default(true),
// Ordered list of catalog sort criteria; each carries an optional
// direction. Absent applies the default chain (provider, name, recency);
// an empty list means the same. An unknown key or direction is rejected
// at load, naming the offending value and the supported set.
modelOrder: z.array(catalogOrderSpecSchema).optional(),
// Toggle for the trailing editor parenthesis. The provider (the route that
// serves the model: Openrouter, Opencode-go, Nvidia for `nvidia/...` ids)
// is always shown; the editor (who made the model: MoonshotAI, Meta,
@@ -219,30 +194,9 @@ export function toResolvedOptions(parsed: PluginOptions): ResolvedOptions {
freshWindowDays: parsed.freshWindowDays,
usageMemory: parsed.usageMemory,
enrichment: parsed.enrichment,
modelOrder: parsed.modelOrder,
};
}
/**
* Warn at startup when `freeSignals` is supplied without `freeOnly`. The extra
* signals only matter under `freeOnly`, so with it off they are accepted by the
* schema but ignored: tell the operator instead of failing silently. Pure —
* the caller owns the sink, so tests can observe the message without booting
* the plugin. The published catalog is never changed by this notice.
*/
export function warnOnIgnoredFreeSignals(
raw: unknown,
parsed: PluginOptions,
warn: (message: string) => void
): void {
if (raw === null || typeof raw !== "object") return;
if (!("freeSignals" in raw)) return;
if (parsed.freeOnly === true) return;
warn(
"freeSignals is set but freeOnly is false; the extra signals are ignored and the published catalog is unchanged."
);
}
/**
* The host reads the plugin id from the module, before any option is known, so
* it cannot carry the configured provider id. Publishing two gateways from one

View File

@@ -125,7 +125,7 @@ export function inferFreeSignal(id: string, ctx: FreeSignalContext): boolean {
return false;
}
export const INFERRED_FREE_LABEL = "🆓? ";
export const INFERRED_FREE_LABEL = " (free, inferred)";
export interface FreeOptions {
freeOnly?: boolean;

View File

@@ -328,7 +328,7 @@ export function mapRawModelToModelV2(
limit: {
context: typeof raw.context_length === "number" ? raw.context_length : 0,
...(typeof raw.max_input_tokens === "number" ? { input: raw.max_input_tokens } : {}),
...(typeof raw.max_output_tokens === "number" ? { output: raw.max_output_tokens } : {}),
output: typeof raw.max_output_tokens === "number" ? raw.max_output_tokens : 0,
},
...(variants ? { variants } : {}),
status: "active",

View File

@@ -167,13 +167,12 @@ export function formatFreeBudget(params: {
creditTokens?: number;
}): string {
const { freeType, monthlyTokens = 0, creditTokens = 0 } = params;
const quota = "(usage-based quota)";
switch (freeType) {
case "recurring-daily":
return monthlyTokens > 0 ? `${fmtTokens(monthlyTokens)} tokens/day` : quota;
return `${fmtTokens(monthlyTokens)} tokens/day`;
case "recurring-monthly":
return monthlyTokens > 0 ? `${fmtTokens(monthlyTokens)} tokens/month` : quota;
return `${fmtTokens(monthlyTokens)} tokens/month`;
case "recurring-credit":
return `${fmtTokens(creditTokens)} credits`;
case "recurring-uncapped":
@@ -254,14 +253,6 @@ export interface ModelDisplayNameParams {
function stripFreeMarkers(text: string): { text: string; wasFree: boolean } {
let cleaned = text.trim();
let wasFree = false;
// An upstream free glyph may sit anywhere in the model name — parenthesised
// at the end (`QwQ 32B (🆓)`) or inside a variant tag (`FP8 Fast 🆓 ~150`).
// Remove it wherever it appears so the plugin prefix stays the only one.
const withoutGlyph = cleaned.replace(/\s{0,8}\(🆓\)\s{0,8}|\s{0,8}🆓\s{0,8}/g, " ");
if (withoutGlyph.length !== cleaned.length) {
wasFree = true;
cleaned = withoutGlyph.trim();
}
const withoutPrefix = cleaned.replace(/^\[free\]\s{0,8}/i, "");
if (withoutPrefix.length !== cleaned.length) {
wasFree = true;
@@ -281,21 +272,6 @@ function stripFreeMarkers(text: string): { text: string; wasFree: boolean } {
return { text: cleaned.length > 0 ? cleaned : text.trim(), wasFree };
}
/**
* Apply the inferred-free marker as a single leading label. An upstream `Free`
* in the name can leave a full `🆓 ` prefix on the built name, and older rows
* carried a trailing ` (free, inferred)` suffix; both are removed so exactly
* one marker remains, at the head. `label` is passed in by the caller (never
* imported here) to keep the free-signals -> naming dependency acyclic.
*/
export function withInferredFreeLabel(name: string, label: string): string {
let cleaned = name.trim();
cleaned = cleaned.replace(/^🆓\??\s{0,8}/, "");
cleaned = cleaned.replace(/\s{0,8}\(free,\s*inferred\)\s{0,8}$/i, "").trim();
if (cleaned.startsWith(label)) return cleaned;
return `${label}${cleaned}`;
}
/**
* Build the display name for one entry.
*

View File

@@ -1,356 +0,0 @@
import { describe, it } from "node:test";
import assert from "node:assert/strict";
import { readFileSync } from "node:fs";
import { buildProviderPayload, collectCatalog, type CollectedCatalog } from "../src/catalog.js";
import { parsePluginOptions } from "../src/options.js";
import { compareByRecency } from "../src/catalog-freshness.js";
import {
catalogOrderComparator,
DEFAULT_CATALOG_ORDER,
toOrderEntry,
type CatalogOrderEntry,
type CatalogOrderSpec,
} from "../src/catalog-order.js";
import type { LegacyModel } from "../src/legacy-model.js";
import type { OmniRouteRawModelEntry } from "../src/shared/models-map.js";
const baseOpts = {
providerId: "omniroute",
baseURL: "https://gw.example.com",
apiKey: "k",
timeoutMs: 1000,
modelCacheTtlMs: 300000,
usableOnly: false,
};
type Raw = OmniRouteRawModelEntry;
/** Publish through the production reader (collectCatalog) and return the payload. */
async function publish(
rawModels: Raw[],
opts: Record<string, unknown> = {},
enrichment: Map<string, unknown> = new Map()
): Promise<{ collected: CollectedCatalog; payload: { info: unknown; models: unknown[] } }> {
const all = { ...baseOpts, ...opts };
const collected = await collectCatalog(all as never, {
fetcher: async () => rawModels,
combosFetcher: async () => [],
enrichmentFetcher: async () => enrichment,
});
const payload = buildProviderPayload(collected, all as never);
return { collected, payload };
}
function ids(payload: { models: unknown[] }): string[] {
return payload.models.map((m) => String((m as { id: string }).id));
}
describe("published catalog order", () => {
it("defaults to provider, then name, then newest release date, then id — and is deterministic", async () => {
const raw: Raw[] = [
{ id: "zz/zeta-9", release_date: "2026-01-05T00:00:00Z" },
{ id: "ac/alpha-2", release_date: "2026-01-09T00:00:00Z" },
{ id: "ac/alpha-1", release_date: "2026-01-02T00:00:00Z" },
];
const { collected, payload } = await publish(raw);
assert.deepEqual(ids(payload), ["ac/alpha-1", "ac/alpha-2", "zz/zeta-9"]);
// Two projections of the same collected map agree, including on a
// same-name tie resolved by recency (newest first).
const again = buildProviderPayload(collected, { ...baseOpts } as never);
assert.deepEqual(ids(again), ids(payload));
const tied = await publish(
[
{ id: "ac/b1", release_date: "2026-01-02T00:00:00Z" },
{ id: "ac/b2", release_date: "2026-01-09T00:00:00Z" },
],
{},
new Map([
["ac/b1", { name: "Same" }],
["ac/b2", { name: "Same" }],
])
);
// The published set never keeps two equal display names: the catalog
// disambiguates the collision with a route suffix ("… (ac/b1)",
// "… (ac/b2)"), so the pair is ordered by those names.
assert.deepEqual(ids(tied.payload), ["ac/b1", "ac/b2"]);
// On an equal display name the default chain resolves recency-descending
// before the id: "ac/b2" is newer, so it leads despite the larger id.
const older = {
...toOrderEntry("omniroute/ac/b1", noCostLegacy()),
name: "Same",
releaseDateMs: Date.parse("2026-01-02T00:00:00Z"),
};
const newer = {
...toOrderEntry("omniroute/ac/b2", noCostLegacy()),
name: "Same",
releaseDateMs: Date.parse("2026-01-09T00:00:00Z"),
};
const byDefault = catalogOrderComparator(DEFAULT_CATALOG_ORDER);
assert.equal(byDefault(newer, older) < 0, true);
assert.equal(byDefault(older, newer) > 0, true);
});
it("sorts by name with a fixed, case- and number-aware collation", async () => {
const raw: Raw[] = [
{ id: "ac/model-10" },
{ id: "ac/MODEL-C" },
{ id: "ac/model-2" },
{ id: "ac/model-1" },
];
const { payload } = await publish(raw, { modelOrder: [{ key: "name" } as CatalogOrderSpec] });
assert.deepEqual(ids(payload), ["ac/model-1", "ac/model-2", "ac/model-10", "ac/MODEL-C"]);
});
it("sorts by recency, newest first by default, oldest first on asc — matching the freshness recency order", async () => {
const raw: Raw[] = [
{ id: "ac/mar", release_date: "2026-03-01T00:00:00Z" },
{ id: "ac/jan", release_date: "2026-01-15T00:00:00Z" },
{ id: "ac/dec", release_date: "2025-12-01T00:00:00Z" },
];
const desc = await publish(raw, { modelOrder: [{ key: "recency" }] });
assert.deepEqual(ids(desc.payload), ["ac/mar", "ac/jan", "ac/dec"]);
const asc = await publish(raw, { modelOrder: [{ key: "recency", direction: "asc" }] });
assert.deepEqual(ids(asc.payload), ["ac/dec", "ac/jan", "ac/mar"]);
// Same dates, same newest-first order as the shared freshness comparator.
const expected = [...raw].sort(compareByRecency).map((m) => m.id);
assert.deepEqual(ids(desc.payload), expected);
});
it("sorts by free: zero-cost models first on asc, paid first on desc", async () => {
const raw: Raw[] = [{ id: "ac/paid" }, { id: "ac/free" }];
const enrichment = new Map([["ac/paid", { pricing: { input: 1, output: 2 } }]]);
const asc = await publish(raw, { modelOrder: [{ key: "free" }] }, enrichment);
assert.deepEqual(ids(asc.payload), ["ac/free", "ac/paid"]);
const desc = await publish(
raw,
{ modelOrder: [{ key: "free", direction: "desc" }] },
enrichment
);
assert.deepEqual(ids(desc.payload), ["ac/paid", "ac/free"]);
});
it("sorts by price: cheaper first on input, then output; absent cost never counts as zero", async () => {
const raw: Raw[] = [{ id: "ac/pricy" }, { id: "ac/mid" }, { id: "ac/cheap" }];
const enrichment = new Map([
["ac/cheap", { pricing: { input: 0.1, output: 0.2 } }],
["ac/mid", { pricing: { input: 0.1, output: 0.5 } }],
["ac/pricy", { pricing: { input: 0.9, output: 0.2 } }],
]);
const asc = await publish(raw, { modelOrder: [{ key: "price" }] }, enrichment);
assert.deepEqual(ids(asc.payload), ["ac/cheap", "ac/mid", "ac/pricy"]);
const desc = await publish(
raw,
{ modelOrder: [{ key: "price", direction: "desc" }] },
enrichment
);
assert.deepEqual(ids(desc.payload), ["ac/pricy", "ac/mid", "ac/cheap"]);
// A legacy entry with no cost block at all: absent prices rank last in
// both directions, they are never compared as zero.
const noCost = {
id: "ac/no-cost",
name: "no cost",
capabilities: {
temperature: true,
reasoning: false,
attachment: false,
toolcall: false,
input: { text: true, audio: false, image: false, video: false, pdf: false },
output: { text: true, audio: false, image: false, video: false, pdf: false },
interleaved: false,
},
limit: { context: 8192, output: 1024 },
status: "active" as const,
options: {},
headers: {},
release_date: "2026-01-01T00:00:00Z",
providerID: "ac",
api: { id: "ac/no-cost", url: "https://gw.example.com/v1", npm: "@ai-sdk/openai-compatible" },
} as unknown as LegacyModel;
const priced = {
...noCost,
cost: { input: 0.1, output: 0.2, cache: { read: 0, write: 0 } },
} as LegacyModel;
const absent = toOrderEntry("omniroute/ac/no-cost", noCost);
const present = toOrderEntry("omniroute/ac/priced", priced);
assert.ok(Number.isNaN(absent.priceInput));
assert.ok(absent.free === false, "an entry without a cost block is not free");
const cmpAsc = catalogOrderComparator([{ key: "price" }]);
assert.ok(cmpAsc(absent, present) > 0, "absent price ranks last on asc");
const cmpDesc = catalogOrderComparator([{ key: "price", direction: "desc" }]);
assert.ok(cmpDesc(absent, present) > 0, "absent price ranks last on desc");
});
it("sorts by context window: largest first by default, smallest first on asc", async () => {
const raw: Raw[] = [
{ id: "ac/small", context_length: 8192 },
{ id: "ac/big", context_length: 131072 },
{ id: "ac/mid", context_length: 32768 },
];
const desc = await publish(raw, { modelOrder: [{ key: "context" }] });
assert.deepEqual(ids(desc.payload), ["ac/big", "ac/mid", "ac/small"]);
const asc = await publish(raw, { modelOrder: [{ key: "context", direction: "asc" }] });
assert.deepEqual(ids(asc.payload), ["ac/small", "ac/mid", "ac/big"]);
// An entry without a window ranks last in both directions.
const withNone = await publish([{ id: "ac/none" }, { id: "ac/small", context_length: 8192 }], {
modelOrder: [{ key: "context" }],
});
assert.deepEqual(ids(withNone.payload), ["ac/small", "ac/none"]);
const withNoneAsc = await publish(
[{ id: "ac/none" }, { id: "ac/small", context_length: 8192 }],
{
modelOrder: [{ key: "context", direction: "asc" }],
}
);
assert.deepEqual(ids(withNoneAsc.payload), ["ac/small", "ac/none"]);
});
it("applies a chained list: free, then provider, then name", async () => {
const raw: Raw[] = [{ id: "zz/paid" }, { id: "ac/free" }, { id: "ac/paid" }, { id: "zz/free" }];
const enrichment = new Map([
["ac/paid", { pricing: { input: 3, output: 1 } }],
["zz/paid", { pricing: { input: 0.01, output: 0.01 } }],
]);
const { payload } = await publish(
raw,
{ modelOrder: [{ key: "free" }, { key: "provider" }, { key: "name" }] },
enrichment
);
assert.deepEqual(ids(payload), ["ac/free", "zz/free", "ac/paid", "zz/paid"]);
});
it("rejects an unknown key or direction at load, naming the value and the supported set", () => {
assert.throws(
() =>
parsePluginOptions({ baseURL: "https://gw.example.com", modelOrder: [{ key: "zorg" }] }),
(err: Error) =>
err.message.includes("zorg") &&
err.message.includes("provider | name | recency | free | price | context")
);
assert.throws(
() =>
parsePluginOptions({
baseURL: "https://gw.example.com",
modelOrder: [{ key: "name", direction: "up" }],
}),
(err: Error) => err.message.includes('"up"') && err.message.includes("asc | desc")
);
// A valid list parses and carries through.
const parsed = parsePluginOptions({
baseURL: "https://gw.example.com",
modelOrder: [{ key: "free" }, { key: "name", direction: "desc" }],
});
assert.deepEqual(parsed.modelOrder, [{ key: "free" }, { key: "name", direction: "desc" }]);
});
it("ranks absent data last without throwing, and id breaks the final tie", async () => {
const raw: Raw[] = [
{ id: "ac/undated" },
{ id: "ac/dated", release_date: "2026-01-01T00:00:00Z" },
];
// An absent date ranks last in BOTH directions (never treated as zero),
// so the dated model leads either way.
const desc = await publish(raw, { modelOrder: [{ key: "recency" }] });
assert.deepEqual(ids(desc.payload), ["ac/dated", "ac/undated"]);
const asc = await publish(raw, { modelOrder: [{ key: "recency", direction: "asc" }] });
assert.deepEqual(ids(asc.payload), ["ac/dated", "ac/undated"]);
// Two entries both absent on every criterion: the id decides, ascending.
const a = { ...toOrderEntry("omniroute/ac/a", noCostLegacy()), releaseDateMs: NaN };
const b = { ...toOrderEntry("omniroute/ac/b", noCostLegacy()), releaseDateMs: NaN };
assert.equal(catalogOrderComparator([])(a, b) < 0, true);
assert.equal(catalogOrderComparator([])(b, a) > 0, true);
});
function noCostLegacy(): LegacyModel {
return {
id: "ac/x",
name: "x",
capabilities: {
temperature: true,
reasoning: false,
attachment: false,
toolcall: false,
input: { text: true, audio: false, image: false, video: false, pdf: false },
output: { text: true, audio: false, image: false, video: false, pdf: false },
interleaved: false,
},
limit: { context: 0, output: 0 },
status: "active" as const,
options: {},
headers: {},
release_date: "",
providerID: "ac",
api: { id: "ac/x", url: "https://gw.example.com/v1", npm: "@ai-sdk/openai-compatible" },
} as LegacyModel;
}
it("ignores insertion order: permuted arrival gives the same published list", async () => {
const base: Raw[] = [
{ id: "ac/a1", release_date: "2026-01-01T00:00:00Z", context_length: 1000 },
{ id: "ac/a2", release_date: "2026-02-01T00:00:00Z", context_length: 2000 },
{ id: "zz/z1", release_date: "2026-03-01T00:00:00Z", context_length: 3000 },
{ id: "zz/z2", release_date: "2026-04-01T00:00:00Z", context_length: 4000 },
];
const opts = { modelOrder: [{ key: "name" }] };
const first = await publish(base, opts);
const second = await publish(
[...base].reverse().sort(() => 0.5 - Math.random()),
opts
);
assert.deepEqual(ids(first.payload), ids(second.payload));
});
it("keeps every field: a permuted arrival publishes identical models per id", async () => {
const base: Raw[] = [
{ id: "ac/a1", release_date: "2026-01-01T00:00:00Z", context_length: 1000 },
{ id: "zz/z1", release_date: "2026-02-01T00:00:00Z", context_length: 2000 },
];
const enrichment = new Map([
["ac/a1", { name: "A One", pricing: { input: 1, output: 2 } }],
["zz/z1", { name: "Z One", pricing: { input: 3, output: 4 } }],
]);
const opts = { modelOrder: [{ key: "name" }] };
const first = await publish(base, opts, enrichment);
const second = await publish([...base].reverse(), opts, enrichment);
const byId = (p: { models: unknown[] }) =>
Object.fromEntries(p.models.map((m) => [String((m as { id: string }).id), m]));
assert.deepEqual(byId(second.payload), byId(first.payload));
assert.equal(Object.keys(byId(second.payload)).length, 2);
});
it("documents modelOrder in the README: every key, its default, and the default chain", () => {
const readme = readFileSync(new URL("../README.md", import.meta.url), "utf8");
const line = readme.split("\n").find((l) => l.includes("`modelOrder`"));
assert.ok(line, "README options table has a modelOrder row");
for (const key of ["provider", "name", "recency", "free", "price", "context"]) {
assert.ok(line!.includes(key), `README row names the "${key}" key`);
}
assert.ok(line!.includes("provider → name → recency → id"), "README names the default chain");
});
it("builds stateless comparators: repeated and interleaved calls agree", () => {
const entry = (id: string, extra: Partial<CatalogOrderEntry> = {}): CatalogOrderEntry => ({
id,
provider: "ac",
name: "x",
releaseDateMs: NaN,
free: false,
priceInput: 1,
priceOutput: 1,
context: 100,
...extra,
});
const low = catalogOrderComparator([{ key: "name" }]);
const high = catalogOrderComparator([{ key: "name" }]);
const a = entry("omniroute/ac/a", { name: "z" });
const b = entry("omniroute/ac/b", { name: "a" });
const c = entry("omniroute/ac/c", { name: "b" });
const d = entry("omniroute/ac/d", { name: "m" });
const first = low(a, b);
assert.equal(low(c, d) < 0, true, "second pair sorts on its own values");
assert.equal(low(a, b), first, "same pair, same result, no retained state");
assert.equal(Math.sign(low(a, b)), Math.sign(high(b, a) * -1), "two comparators agree");
});
});

View File

@@ -102,7 +102,7 @@ describe("freeSignals", () => {
}
);
assert.deepEqual([...m.keys()], ["omniroute/nv/a"]);
assert.match(String(m.get("omniroute/nv/a")?.name), /^🆓\? /);
assert.match(String(m.get("omniroute/nv/a")?.name), /\(free, inferred\)$/);
});
it("priced skips router segments whose zero is a placeholder", async () => {
@@ -284,7 +284,7 @@ describe("freeSignals", () => {
});
const names = [...draft.models.values()].map((m) => String(m.name));
assert.ok(
names.every((n) => /^🆓\? /.test(n)),
names.every((n) => /\(free, inferred\)$/.test(n)),
names.join("|")
);
});
@@ -295,7 +295,7 @@ describe("freeSignals", () => {
visibleModels: ["*"],
});
assert.deepEqual([...m.keys()], ["omniroute/nv/a"]);
assert.match(String(m.get("omniroute/nv/a")?.name), /^🆓\? /);
assert.match(String(m.get("omniroute/nv/a")?.name), /\(free, inferred\)$/);
});
it("a restored entry named by usage follows the same signals and label", async () => {
@@ -318,7 +318,7 @@ describe("freeSignals", () => {
}
);
assert.ok(draft.models.has("omniroute/nv/target"));
assert.match(String(draft.models.get("omniroute/nv/target")?.name), /^🆓\? /);
assert.match(String(draft.models.get("omniroute/nv/target")?.name), /\(free, inferred\)$/);
});
it("provider-named with a non-empty overlay warns the declared ratio", async () => {
@@ -363,35 +363,6 @@ describe("freeSignals gate cases", () => {
});
assert.equal(m.size, 0);
});
it("an inferred model named in Free shows one leading marker and keeps its disambiguation id", async () => {
const named = (): Entry => ({
name: "Nemotron 3.5 Lightning Free",
providerAlias: "bzl",
providerCanonical: "bzl",
providerDisplayName: "Bazaarlink",
pricing: zero,
});
const m = await run(
["bzl/nemotron-3.5-lightning-free", "bzl/nvidia"],
new Map<string, Entry>([
["bzl/nemotron-3.5-lightning-free", named()],
["bzl/nvidia", named()],
]),
{ freeSignals: ["priced"] }
);
const first = String(m.get("omniroute/bzl/nemotron-3.5-lightning-free")?.name);
const second = String(m.get("omniroute/bzl/nvidia")?.name);
assert.equal(
first,
"🆓? Bazaarlink - Nemotron 3.5 Lightning (bzl/nemotron-3.5-lightning-free)"
);
assert.equal(second, "🆓? Bazaarlink - Nemotron 3.5 Lightning (bzl/nvidia)");
assert.equal((first.match(/🆓/g) ?? []).length, 1);
assert.equal((second.match(/🆓/g) ?? []).length, 1);
assert.ok(!first.includes("(free, inferred)") && !second.includes("(free, inferred)"));
assert.notEqual(first, second);
});
});
describe("freeSignals options", () => {

View File

@@ -71,27 +71,6 @@ describe("compact model names", () => {
assert.equal(name, "🆓 opencode-go - beam");
});
it("strips an upstream free glyph wherever it sits, keeping one leading marker", () => {
const trailing = buildModelDisplayName({
rawId: "cloudflare-ai/@cf/qwen/qwq-32b",
enrichmentName: "QwQ 32B (🆓)",
providerDisplayName: "Cloudflare-ai",
isFree: true,
});
assert.equal(trailing, "🆓 Cloudflare-ai - QwQ 32B");
assert.equal((trailing.match(/🆓/g) ?? []).length, 1);
const inline = buildModelDisplayName({
rawId: "cloudflare-ai/@cf/meta/llama-3.3-70b",
enrichmentName: "Llama 3.3 70B (FP8 Fast 🆓 ~150 resp/day)",
providerDisplayName: "Cloudflare-ai",
isFree: true,
});
assert.ok(inline.startsWith("🆓 Cloudflare-ai - Llama 3.3 70B"), inline);
assert.equal((inline.match(/🆓/g) ?? []).length, 1);
assert.ok(!inline.includes("(FP8 Fast 🆓"), inline);
});
it("keeps colliding entries distinct with a route suffix", async () => {
const raw = await entriesThroughReader([
{ id: "opencode-go/claude-haiku-5-5", owned_by: "opencode-go", context_length: 1000 },

View File

@@ -1,6 +1,5 @@
import { describe, it } from "node:test";
import assert from "node:assert/strict";
import { readFileSync } from "node:fs";
import {
integrationIdFor,
parsePluginOptions,
@@ -8,7 +7,6 @@ import {
providerIdFor,
resolveTimeouts,
toResolvedOptions,
warnOnIgnoredFreeSignals,
} from "../src/options.js";
import { buildModelDisplayName } from "../src/shared/naming.js";
@@ -317,43 +315,3 @@ describe("resolved relay defaults", () => {
assert.equal(resolved.freeProviders, undefined);
});
});
describe("README options table", () => {
it("documents telemetry as opt-in and keeps autoCombos marked as ignored", () => {
const readme = readFileSync(new URL("../README.md", import.meta.url), "utf8");
const telemetryRow = readme.split("\n").find((line) => line.includes("`telemetry`"));
assert.ok(telemetryRow, "README must document the telemetry option");
assert.match(telemetryRow, /`false`/);
assert.match(
telemetryRow,
/opt-in; marks inference requests through the host SDK hook when enabled/i
);
assert.match(readme, /still parses but is ignored/);
});
});
describe("warnOnIgnoredFreeSignals", () => {
const MESSAGE =
"freeSignals is set but freeOnly is false; the extra signals are ignored and the published catalog is unchanged.";
it("warns exactly once when freeSignals is set without freeOnly", () => {
const raw = { baseURL: "https://gw.example.com", freeSignals: ["priced"] };
const warns: string[] = [];
warnOnIgnoredFreeSignals(raw, parsePluginOptions(raw), (msg) => void warns.push(msg));
assert.deepEqual(warns, [MESSAGE]);
});
it("stays silent when freeSignals is absent", () => {
const raw = { baseURL: "https://gw.example.com" };
const warns: string[] = [];
warnOnIgnoredFreeSignals(raw, parsePluginOptions(raw), (msg) => void warns.push(msg));
assert.deepEqual(warns, []);
});
it("stays silent when freeOnly is true", () => {
const raw = { baseURL: "https://gw.example.com", freeSignals: ["priced"], freeOnly: true };
const warns: string[] = [];
warnOnIgnoredFreeSignals(raw, parsePluginOptions(raw), (msg) => void warns.push(msg));
assert.deepEqual(warns, []);
});
});

View File

@@ -226,25 +226,12 @@ describe("v1-vs-v2 catalog parity", () => {
providerId: "omniroute",
baseURL: TEST_OPTS.baseURL,
});
const expectedPayload = JSON.parse(
JSON.stringify({ ...(expected as object), providerID: undefined, name: undefined })
);
// Documented exclusion: v1 filled a missing gateway `max_output_tokens`
// with `limit.output: 0`; v2 leaves `limit.output` out instead of
// publishing a zero output limit the gateway never stated.
if (typeof entry.max_output_tokens !== "number") {
assert.equal(expectedPayload.limit.output, 0, `v1 recorded a zero output for ${entry.id}`);
assert.equal(
"output" in viaShared.limit,
false,
`v2 omits limit.output for ${entry.id} when the gateway does not state it`
);
delete expectedPayload.limit.output;
}
assert.deepEqual(
JSON.parse(JSON.stringify({ ...viaShared, providerID: undefined, name: undefined })),
expectedPayload,
JSON.parse(
JSON.stringify({ ...(expected as object), providerID: undefined, name: undefined })
),
`model mapper parity for ${entry.id}`
);
}

View File

@@ -91,12 +91,4 @@ describe("mapRawModelToModelV2", () => {
);
assert.ok(!("variants" in without));
});
it("omits limit.output when the gateway does not publish max_output_tokens", () => {
const m = mapRawModelToModelV2(
{ id: "ovh-free/gpt-oss-120b", context_length: 128000 },
{ providerId: "omniroute", baseURL: "https://gw.example.com" }
);
assert.equal(m.limit.context, 128000);
assert.ok(!("output" in m.limit));
});
});

View File

@@ -49,15 +49,8 @@ test("formatFreeBudget: discontinued has no token/credit args", () => {
assert.equal(formatFreeBudget({ freeType: "discontinued" }), "(discontinued)");
});
test("formatFreeBudget: a daily quota not stated in tokens is labelled explicitly", () => {
assert.equal(formatFreeBudget({ freeType: "recurring-daily" }), "(usage-based quota)");
});
test("formatFreeBudget: a monthly quota of zero is labelled explicitly too", () => {
assert.equal(
formatFreeBudget({ freeType: "recurring-monthly", monthlyTokens: 0 }),
"(usage-based quota)"
);
test("formatFreeBudget: missing token/credit counts default to 0", () => {
assert.equal(formatFreeBudget({ freeType: "recurring-daily" }), "0 tokens/day");
});
test("formatFreeBudget: unknown future value renders its own name, never empty", () => {

View File

@@ -11,7 +11,7 @@ import {
writeFileSync,
} from "node:fs";
import { createCipheriv, createDecipheriv, randomBytes, scryptSync } from "node:crypto";
import { dirname, join, extname, basename, resolve } from "node:path";
import { dirname, join, extname, basename } from "node:path";
import { Readable } from "node:stream";
import { pipeline } from "node:stream/promises";
import { resolveDataDir } from "../data-dir.mjs";
@@ -56,7 +56,6 @@ export function registerBackup(program) {
.option("--cron <expr>", t("backup.auto.cronOpt"), "0 3 * * *")
.option("--cloud", t("backup.cloudOpt"))
.option("--encrypt", t("backup.encryptOpt"))
.option("--key-file <path>", t("backup.keyFileOpt"))
.option("--retention <n>", t("backup.retentionOpt"), parseInt)
.action(async (opts) => {
const exitCode = await runBackupAutoEnableCommand(opts);
@@ -193,16 +192,7 @@ export async function runBackupCommand(opts = {}) {
let passphrase = null;
if (opts.encrypt) {
if (opts.keyFile) {
try {
passphrase = readFileSync(opts.keyFile, "utf8").trim();
} catch (err) {
console.error(`Cannot read key file ${opts.keyFile}: ${err?.code || "read error"}`);
return 1;
}
if (!passphrase) {
console.error(t("backup.noPassphrase"));
return 1;
}
passphrase = readFileSync(opts.keyFile, "utf8").trim();
} else {
passphrase = await promptPassphrase();
if (!passphrase) {
@@ -346,29 +336,11 @@ function getSchedulePath() {
export async function runBackupAutoEnableCommand(opts = {}) {
const schedulePath = getSchedulePath();
let keyFile;
if (opts.encrypt) {
// A scheduled run has no TTY, so an encrypted schedule needs a key file.
// Persist the absolute PATH only (never the passphrase): the server cwd
// differs from the CLI cwd.
if (!opts.keyFile) {
console.error("Encrypted automatic backups need --key-file <path> (no TTY on a schedule).");
return 1;
}
keyFile = resolve(String(opts.keyFile));
try {
if (!readFileSync(keyFile, "utf8").trim()) throw new Error("empty");
} catch {
console.error(`Key file ${keyFile} is missing, unreadable or empty.`);
return 1;
}
}
const schedule = {
enabled: true,
cron: opts.cron || "0 3 * * *",
cloud: !!opts.cloud,
encrypt: !!opts.encrypt,
...(keyFile ? { keyFile } : {}),
retention: opts.retention || null,
updatedAt: new Date().toISOString(),
};
@@ -403,10 +375,7 @@ export async function runBackupAutoStatusCommand() {
console.log(` cron: ${schedule.cron}`);
console.log(` cloud: ${schedule.cloud ? "yes" : "no"}`);
console.log(` encrypt: ${schedule.encrypt ? "yes" : "no"}`);
if (schedule.keyFile) console.log(` key-file: ${schedule.keyFile}`);
console.log(` retention: ${schedule.retention ?? "unlimited"}`);
if (schedule.lastRunAt) console.log(` last run: ${schedule.lastRunAt}`);
if (schedule.lastError) console.log(` last error: ${schedule.lastError}`);
return 0;
}

View File

@@ -187,17 +187,8 @@ export function registerResilience(program) {
.option("--threshold <n>", t("resilience.config.threshold"), parseInt)
.option("--reset-timeout <ms>", t("resilience.config.resetTimeout"), parseInt)
.option("--base-cooldown <ms>", t("resilience.config.baseCooldown"), parseInt)
.option("--p2c-latency-weight <0-20>", t("resilience.config.p2cLatencyWeight"), parseInt)
.action(async (opts, cmd) => {
const body = {};
if (opts.p2cLatencyWeight != null) {
const w = opts.p2cLatencyWeight;
if (!Number.isInteger(w) || w < 0 || w > 20) {
process.stderr.write("Error: --p2c-latency-weight must be an integer from 0 to 20\n");
process.exit(1);
}
body.p2cLatency = { weight: w };
}
if (opts.threshold != null) body.threshold = opts.threshold;
if (opts.resetTimeout != null) body.resetTimeoutMs = opts.resetTimeout;
if (opts.baseCooldown != null) body.baseCooldownMs = opts.baseCooldown;

View File

@@ -31,25 +31,11 @@ import {
profileNameFromModelId,
} from "./setup-codex.mjs";
// Claude Code effortLevel values, lowest first. `minimal`/`none` are catalog tiers but not
// Claude Code levels, so they are never a clamp target.
const CLAUDE_EFFORT_LEVELS = ["low", "medium", "high", "xhigh", "max"];
/**
* Map a Codex-style effort to a Claude Code settings.json effortLevel.
* Codex categories use xhigh/high/low/undefined; Claude Code accepts the same names. Omitted
* for the "simple" tier. When the catalog row lists the model's `effort_tiers`, a level it
* does not offer is lowered to the highest listed level below it, and omitted when none fits.
*/
function effortLevelFor(cfg, effortTiers) {
const wanted = cfg?.effort || undefined;
const tiers = Array.isArray(effortTiers) ? effortTiers : [];
if (!wanted || tiers.length === 0 || tiers.includes(wanted)) return wanted;
const rank = CLAUDE_EFFORT_LEVELS.indexOf(wanted);
if (rank < 0) return wanted;
return CLAUDE_EFFORT_LEVELS.slice(0, rank)
.reverse()
.find((level) => tiers.includes(level));
/** Map a Codex-style effort to a Claude Code settings.json effortLevel. */
function effortLevelFor(cfg) {
// Codex categories use xhigh/high/low/undefined; Claude Code accepts the same
// names (low|medium|high|xhigh). Pass through, omit for the "simple" tier.
return cfg.effort || undefined;
}
/**
@@ -121,10 +107,8 @@ export function inheritedAnthropicKeyWarning(env = process.env) {
* `contextWindow` is the model's real window from the catalog; without it the profile table's
* `cfg.ctx` is used. The window rule (compact at 85% below 200k, else 190000) is the one
* `omniroute launch` applies; it lives in claudeWindowEnv, shared by both.
* `effortTiers` is the catalog row's `capabilities.effort_tiers`; it keeps `effortLevel` within
* the levels the model offers.
*/
export function buildProfileSettings(modelId, baseUrl, cfg, contextWindow, effortTiers) {
export function buildProfileSettings(modelId, baseUrl, cfg, contextWindow) {
const window = claudeWindowEnv(contextWindow ?? cfg?.ctx);
const env = {
ANTHROPIC_BASE_URL: baseUrl,
@@ -142,7 +126,7 @@ export function buildProfileSettings(modelId, baseUrl, cfg, contextWindow, effor
model: modelId,
env,
};
const effort = effortLevelFor(cfg, effortTiers);
const effort = effortLevelFor(cfg);
if (effort) settings.effortLevel = effort;
// NOTE: ANTHROPIC_AUTH_TOKEN is intentionally NOT written here — `omniroute
// launch --profile` injects it from the active context, keeping the secret off
@@ -248,8 +232,7 @@ export async function syncClaudeProfilesFromModels(models, opts = {}) {
// Same order as `omniroute launch`: max_input_tokens, then context_length.
const catalogWindow =
typeof m === "string" ? undefined : (m.max_input_tokens ?? m.context_length);
const effortTiers = typeof m === "string" ? undefined : m.capabilities?.effort_tiers;
const content = buildProfileSettings(id, baseUrl, cfg, catalogWindow, effortTiers);
const content = buildProfileSettings(id, baseUrl, cfg, catalogWindow);
if (dryRun) {
log(`\n── [dry-run] ${filePath} ──`);

View File

@@ -22,41 +22,29 @@ export function getLegacyDotDataDir(homeDir = safeHomeDir()) {
return path.join(homeDir, `.${APP_NAME}`);
}
function hasDatabase(dir) {
try {
return fs.statSync(path.join(dir, "storage.sqlite")).isFile();
} catch {
return false;
}
}
export function getDefaultDataDir() {
const homeDir = safeHomeDir();
const legacyDir = getLegacyDotDataDir(homeDir);
let legacyIsDir = false;
try {
legacyIsDir = fs.statSync(legacyDir).isDirectory();
} catch {
// Ignore stat errors and continue to the platform default.
if (fs.existsSync(legacyDir)) {
try {
if (fs.statSync(legacyDir).isDirectory()) {
return legacyDir;
}
} catch {
// Ignore stat errors and continue to the platform default.
}
}
let platformDir = null;
if (process.platform === "win32") {
const appData = process.env.APPDATA || path.join(homeDir, "AppData", "Roaming");
platformDir = path.join(appData, APP_NAME);
} else {
const xdgConfigHome = normalizeConfiguredPath(process.env.XDG_CONFIG_HOME);
if (xdgConfigHome) platformDir = path.join(xdgConfigHome, APP_NAME);
return path.join(appData, APP_NAME);
}
// An existing legacy dir wins, unless the platform dir holds the database and the legacy dir
// does not: other code creates ~/.omniroute/<sub> directly, and that alone must not move an
// XDG/APPDATA install to an empty database.
if (legacyIsDir && !(platformDir && !hasDatabase(legacyDir) && hasDatabase(platformDir))) {
return legacyDir;
}
return platformDir ?? legacyDir;
const xdgConfigHome = normalizeConfiguredPath(process.env.XDG_CONFIG_HOME);
if (xdgConfigHome) return path.join(xdgConfigHome, APP_NAME);
return legacyDir;
}
export function resolveDataDir() {

View File

@@ -973,8 +973,7 @@
"description": "Manage resilience config",
"threshold": "Failure threshold",
"resetTimeout": "Reset timeout in ms",
"baseCooldown": "Base cooldown in ms",
"p2cLatencyWeight": "p2c latency weight, 0 (off) to 20"
"baseCooldown": "Base cooldown in ms"
}
},
"nodes": {

View File

@@ -1 +0,0 @@
- **feat(images):** `/v1/images/edits` supports Leonardo: the reference image is uploaded through Leonardo's init-image flow and the generation is guided by it (`init_image_id`, `init_strength` 0.3), instead of the edit being rejected as unsupported. Leonardo takes one reference image; more than one returns 400, and a combo moves on to its next provider rather than editing with the first image only ([#18674](https://github.com/cheaper-inference/OmniRoute/pull/18674), closes [#18671](https://github.com/cheaper-inference/OmniRoute/issues/18671))

View File

@@ -1 +0,0 @@
- **feat(opencode-plugin-v2):** make the published catalog order configurable through `modelOrder` — an ordered list of `{ key, direction }` pairs over `provider`, `name`, `recency`, `free`, `price` and `context`, each with its direction — so the OpenCode plugin publishes models deterministically by default (`provider → name → recency → id`, replacing raw API arrival order) and the operator can reorder the picker ([#18804](https://github.com/cheaper-inference/OmniRoute/pull/18804)) — thanks @maxmad64bis

View File

@@ -1 +0,0 @@
- **feat(providers):** `expiry-first` treats a lapsed weekly/monthly reset (stale quota read) as refilled instead of "expires now", and gains an opt-in `expiryFirstOrder: "deadline"` (per provider) that spends the account whose quota is lost first while it has quota ([#19583](https://github.com/diegosouzapw/OmniRoute/pull/19583)) — thanks @feci

View File

@@ -1 +0,0 @@
- **feat(api):** add the per-request `x-omniroute-no-log` header to omit request/response payloads from call logs while keeping timestamp, model, status, duration and token counts ([#20096](https://github.com/cheaper-inference/OmniRoute/pull/20096))

View File

@@ -1 +0,0 @@
- **feat(sse):** Mistral now counts as an automatic-prefix-caching provider (cache-aware compression guard, cache stats) and gets a stable `prompt_cache_key` on both Chat Completions and Responses bodies ([#20111](https://github.com/cheaper-inference/OmniRoute/pull/20111)) — thanks @RayJW

View File

@@ -1 +0,0 @@
- Command Code short plan ids (go, goat, pro, ultra, teams-pro) now resolve to their plan names, and known plans show their fixed credit cap as the quota total. ([#20347](https://github.com/cheaper-inference/OmniRoute/pull/20347))

View File

@@ -1 +0,0 @@
- Qoder's Sonus (smodel) and Cantus (cmodel) are now in the static model fallback, so the ids stay routable when the live catalog is unavailable. ([#20351](https://github.com/cheaper-inference/OmniRoute/pull/20351))

View File

@@ -1 +0,0 @@
- **feat(plugins):** Opt-in `PLUGIN_PERMISSION_MODEL_ENABLED` feature flag (off by default) runs each plugin process under the Node.js permission model built from its manifest: reads confined to the plugin directory, writes only to its data directory with `file-write`, child processes only with `exec`; `network` stays declarative

View File

@@ -1 +0,0 @@
- **feat(ci):** omni-queue can speak as the owner and sign its merge commits, both off by default. With `voice: "owner"` in `config/merge-queue/config.json`, the queue's comments and label removals on pull requests, the dashboard issue and its comments, base-red comments and the tree-divergence issue go out with `OMNI_QUEUE_LAND_TOKEN`; statuses, refs, the state branch, re-runs and reads stay the App's, and a missing or refused token falls back to the App with one `error` event. With `landing.signing: "ssh"` (owner actor only), every merge commit the queue composes is signed with the owner's key from the `OMNI_QUEUE_SIGNING_KEY` environment secret, and a missing key composes unsigned with one `error` event per batch ([#20792](https://github.com/cheaper-inference/OmniRoute/pull/20792))

View File

@@ -1 +0,0 @@
- **feat(combo):** new `decision` router strategy for Auto combos: a decider picks the model for each request and `rules` picks the account. The decider can be TypeSafe System One, your own decision URL (System One or OpenAI chat format), or one of the combo's own models called in process. Only the last user message (up to 8000 characters) and the model menu are sent; the key comes from a stored connection inside the API key's allowed connections or from `OMNIROUTE_DECISION_API_KEY`, never from the combo. Calls go through the outbound guard with no redirects, a 64 KB answer cap and a 2 s default timeout (5 s max), and any failure routes with `rules`. Off by default behind `COMBO_DECISION_ROUTER_ENABLED`; combos without a decision block do not change. The combo builder gets the settings and a Test decision button, and the TypeSafe client now uses the same guarded transport — thanks @BelphegorPrime, @alvinveroy, @rafacpti23 and @miguelenes

View File

@@ -1 +0,0 @@
- Add an opt-in `X-OmniRoute-Selected-Connection-Plan` response header for Codex account-routing troubleshooting (`OMNIROUTE_CODEX_PLAN_RESPONSE_HEADER=1`), off by default with an explicit plan allowlist.

View File

@@ -1 +0,0 @@
- **feat(models):** add GPT-6.1 Terra to OpenAI API and Codex model catalogs, including Responses-only tool routing, supported reasoning tiers, verified token pricing, long-context rates, and Codex aliases.

View File

@@ -1 +0,0 @@
- fix(providers): a Codex discovery with a failed client-version refresh no longer shrinks the stored synced catalog (#16714)

View File

@@ -1 +0,0 @@
- fix(providers): Cloudflare Playground (cfp) no longer emits duplicated content deltas when upstream replays chunks (`replay: true` or repeated `seq`) (#18732)

View File

@@ -1 +0,0 @@
- fix(images): Codex GPT Image routes now reject a non-PNG `output_format` with a clear 400 instead of silently returning PNG (#19252)

View File

@@ -1 +0,0 @@
- **fix(translator):** thinking blocks that OmniRoute translates for Claude clients now carry an empty `signature` field, so strict Claude clients no longer fail to parse reasoning from OpenAI-shaped and Gemini providers. ([#19403](https://github.com/cheaper-inference/OmniRoute/pull/19403))

View File

@@ -1 +0,0 @@
- **fix(translator):** Gemini-native streams (`/v1beta/models/*:streamGenerateContent`) now forward the mid-stream keepalive as an empty `data:` frame, so a client idle-read timer resets while the upstream is quiet. Before, the keepalive was dropped and the socket stayed silent. ([#19403](https://github.com/cheaper-inference/OmniRoute/pull/19403))

View File

@@ -1 +0,0 @@
- **fix(translator):** parallel tool calls from OpenAI-compatible providers that omit the tool-call index no longer merge into one call with empty arguments on Gemini-format and Antigravity streams. ([#19403](https://github.com/cheaper-inference/OmniRoute/pull/19403))

View File

@@ -1 +0,0 @@
- **fix(mcp):** one skill with a duplicate MCP tool name no longer stops the later skills from getting tools. The duplicate is skipped and logged. ([#19542](https://github.com/cheaper-inference/OmniRoute/pull/19542))

View File

@@ -1 +0,0 @@
- **fix(sse):** A field that a provider rejected with a 400 stays removed when the same URL is re-run after a 429, also for Claude-compatible relays with active thinking. The Claude step re-added `context_management` after the learned strip, so the relay rejected the same field again and the client got the 400. The learned strip now runs once more after that step. Follow-up to [#19033](https://github.com/cheaper-inference/OmniRoute/pull/19033). ([#19628](https://github.com/cheaper-inference/OmniRoute/pull/19628))

View File

@@ -1 +0,0 @@
- **perf(sse):** large chat requests to plain (non-fingerprinted, unsigned) providers no longer re-parse the outbound body after serialization, which saves a body-sized copy and about 2.5 ms of blocking time per attempt on a 3 MB agent body ([#19628](https://github.com/cheaper-inference/OmniRoute/pull/19628))

View File

@@ -1 +0,0 @@
- **perf(db):** chat requests no longer re-run the compression-combo table bootstrap and default seed on every call, so a request no longer stalls for up to 2 s with "database is locked" while another process holds the SQLite write lock ([#19630](https://github.com/cheaper-inference/OmniRoute/pull/19630))

View File

@@ -1 +0,0 @@
- **fix(db):** Deleting a compatible provider node now also deletes its custom model list, so no orphaned model rows are left behind. ([#19630](https://github.com/cheaper-inference/OmniRoute/pull/19630))

View File

@@ -1 +0,0 @@
- **fix(skills):** the server tool replay table no longer grows without limit; rows older than 30 days and rows beyond the newest 10,000 (never the last day, never a live claim) are removed. ([#19630](https://github.com/cheaper-inference/OmniRoute/pull/19630))

View File

@@ -1 +0,0 @@
- **fix(cli):** an XDG or %APPDATA% install keeps using its own database when an empty `~/.omniroute` folder appears, instead of silently switching to a new empty database on the next start. ([#19634](https://github.com/cheaper-inference/OmniRoute/pull/19634))

View File

@@ -1 +0,0 @@
- **fix(admission):** with per-tenant virtual lanes on, a freed slot now rotates across tenants instead of always serving the first lane, and a newer request no longer jumps an older request queued in its own lane. ([#19684](https://github.com/cheaper-inference/OmniRoute/pull/19684))

View File

@@ -1 +0,0 @@
- **fix(resilience):** a DashScope key with no balance (400 `Arrearage`) or without the model service (403 `AccessDenied.Unpurchased`) now parks as credits exhausted instead of being retried every few seconds; a ban phrase quoted inside a 408, 429 or 5xx body no longer gives the account a one-year permanent cooldown ([#19684](https://github.com/cheaper-inference/OmniRoute/pull/19684))

View File

@@ -1 +0,0 @@
- **fix(db):** automatic and manual backup pruning now skips a migration restore point that a running upgrade still holds, once the upgrade takes its lease; a lease left by a dead process is ignored. ([#19690](https://github.com/cheaper-inference/OmniRoute/pull/19690))

View File

@@ -1 +0,0 @@
- **fix(db):** a migration that was left out of the ledger now repairs every missing column and index it adds, no longer adds cache tokens to usage history a second time, and no longer gets recorded as applied when a column it adds is still missing. ([#19690](https://github.com/cheaper-inference/OmniRoute/pull/19690))

View File

@@ -1 +0,0 @@
- **fix(db):** restoring a database backup made under a different `STORAGE_ENCRYPTION_KEY` is refused with a message that names both key fingerprints, instead of loading credentials that cannot be read. Pass `allowKeyMismatch` for a key rotation. ([#19690](https://github.com/cheaper-inference/OmniRoute/pull/19690))

View File

@@ -1 +0,0 @@
- **fix(db):** Retention cleanup no longer deletes spend that an active daily, weekly or monthly API-key budget window still counts, so a 31-day month cannot reopen its used allowance. ([#19701](https://github.com/cheaper-inference/OmniRoute/pull/19701))

View File

@@ -1 +0,0 @@
- **fix(db):** Scheduled cleanup now prunes ended exclusive-connection lease rows and past provider quota-reset events, so these two history tables stop growing forever. ([#19701](https://github.com/cheaper-inference/OmniRoute/pull/19701))

View File

@@ -1 +0,0 @@
- **fix(db):** the scheduled call-log retention pass now also deletes the request/response body files of the rows it removes, so an idle gateway no longer keeps expired bodies on disk. ([#19701](https://github.com/cheaper-inference/OmniRoute/pull/19701))

View File

@@ -1 +0,0 @@
- **fix(security):** the prompt-injection guard now decodes base64, hex and percent-encoded text in a request and scans the result, so an instruction hidden in an encoded string is scored like the same instruction in plain text. ([#19724](https://github.com/cheaper-inference/OmniRoute/pull/19724))

View File

@@ -1 +0,0 @@
- **fix(resilience):** a circuit breaker with `halfOpenRequests` above 1 now needs that many probe successes in a row before it closes, so one lucky probe no longer restores a flapping provider. ([#19724](https://github.com/cheaper-inference/OmniRoute/pull/19724))

View File

@@ -1 +0,0 @@
- **fix(pii):** a custom PII regex that backtracks for exponential time on a long run of one character, such as an overlapping alternation, is now refused when you save or test it, instead of freezing the gateway. ([#19724](https://github.com/cheaper-inference/OmniRoute/pull/19724))

View File

@@ -1 +0,0 @@
- **fix(a2a):** cancelling an A2A task now aborts the task's signal and a task that finishes after a cancel is refused with a clear "cancelled" error, instead of failing with "Invalid transition: cancelled → completed". ([#19727](https://github.com/cheaper-inference/OmniRoute/pull/19727))

View File

@@ -1 +0,0 @@
- **fix(cli-tools):** the CLI tools overview no longer shows Claude, Droid, OpenClaw, Cline and Kilo as configured when their config only mentions OmniRoute in unrelated text, or points at another host or port. The badge now follows the same fields the tool's own settings page reads. ([#19727](https://github.com/cheaper-inference/OmniRoute/pull/19727))

View File

@@ -1 +0,0 @@
- **fix(guardrails):** opt-in credential redaction no longer rewrites signed thinking blocks, encrypted reasoning or long base64 blobs because random bytes look like a short-prefix key, so replayed signatures stay valid. Full-format keys inside them are still redacted. ([#19727](https://github.com/cheaper-inference/OmniRoute/pull/19727))

View File

@@ -1 +0,0 @@
- **fix(quota):** the Redis quota store now charges a usage counter and sets its expiry in one atomic call, so a crash between the two steps can no longer leave a counter that never expires. ([#19727](https://github.com/cheaper-inference/OmniRoute/pull/19727))

View File

@@ -1 +0,0 @@
- **fix(codex):** The Codex ChatGPT Web and app-server adapters now cap the buffered event backlog by retained text size and merge adjacent small text deltas, so a fast producer behind a slow client can no longer grow memory without bound. ([#19733](https://github.com/cheaper-inference/OmniRoute/pull/19733))

View File

@@ -1 +0,0 @@
- **fix(gemini):** a non-streaming Gemini or Antigravity reply whose `[Tool call: ...]` text arrives in several stream parts now returns one tool call, and a tool-only stream cut before its finish reason is now marked as cut so a combo can try the next target. ([#19733](https://github.com/cheaper-inference/OmniRoute/pull/19733))

View File

@@ -1 +0,0 @@
- **fix(translator):** Gemini requests now map content roles `function` and `tool` to user messages, and infer a missing role from the parts, so single-turn Gemini requests without a role no longer reach the upstream as assistant messages. ([#19733](https://github.com/cheaper-inference/OmniRoute/pull/19733))

View File

@@ -1 +0,0 @@
- **fix(usage):** A non-streaming reply with no usage object now writes its estimated token counts to usage history and the call log, as a stream already does, so per-key USD limits count that spend. ([#19745](https://github.com/cheaper-inference/OmniRoute/pull/19745))

View File

@@ -1 +0,0 @@
- **fix(cache):** The semantic cache no longer stores a reply that ended in a content filter block (`content_filter`, or Claude `refusal`), so a false-positive block can clear on retry instead of being served from cache for the whole TTL. ([#19749](https://github.com/cheaper-inference/OmniRoute/pull/19749))

View File

@@ -1 +0,0 @@
- **fix(usage):** rerank spend now counts toward a key's daily, weekly and 5-hour USD limits. Speech and transcription already count through their usage history rows and are counted once. ([#19754](https://github.com/cheaper-inference/OmniRoute/pull/19754))

View File

@@ -1 +0,0 @@
- **fix(cache):** Claude Code requests to OpenRouter `anthropic/*` models keep their prompt-cache breakpoints (4 at most), so those turns write and read the prompt cache instead of paying full input price. Other OpenRouter families are unchanged. ([#19755](https://github.com/cheaper-inference/OmniRoute/pull/19755))

View File

@@ -1 +0,0 @@
- **fix(sse):** Claude Code CCH signing now uses the seed and the body view of the real client (verified on Claude Code 2.1.252 and 2.1.322), so the `cch=` token in the billing header equals the token the real client sends for the same body. ([#19761](https://github.com/cheaper-inference/OmniRoute/pull/19761))

View File

@@ -1 +0,0 @@
- **fix(providers):** Gemini 4 Carbon is registered like Argon — `gemini-4-carbon-{low,medium,high}` on Antigravity/AGY and `gemini-4-carbon` on the Gemini API key are priced at the published $2/$10 introductory rate, the bare id aliases to `-medium`, and the tiers get the declared 65535 output cap instead of the 16384 fallback ([#19797](https://github.com/cheaper-inference/OmniRoute/pull/19797), closes [#19796](https://github.com/cheaper-inference/OmniRoute/issues/19796)) — thanks @xiaoyaner0201

View File

@@ -1 +0,0 @@
- **fix(db-backups):** a chunked import upload is refused at the configured size while it streams, instead of being buffered in full and rejected afterwards ([#19831](https://github.com/cheaper-inference/OmniRoute/pull/19831)) — thanks @AndreAlmeidaDC

View File

@@ -1 +0,0 @@
- **fix(security):** strip `'unsafe-eval'` from the Content-Security-Policy `script-src` directive in production builds while retaining it strictly in development mode for React Fast Refresh and HMR ([#19836](https://github.com/cheaper-inference/OmniRoute/issues/19836)).

View File

@@ -1 +0,0 @@
- **fix(antigravity):** parallel conversations on one account no longer share a single Cloud Code session and evict each other's prompt cache — the upstream `sessionId` is now derived from account + conversation ([#19876](https://github.com/cheaper-inference/OmniRoute/pull/19876)) — thanks @adevwithpurpose

View File

@@ -1 +0,0 @@
- **fix(dashboard):** move the custom banned-keyword editor back to the Resilience settings tab (next to Auto Disable) instead of Security, and harden its save/load path: keywords appear only after the server accepts the PATCH, a failed settings load surfaces an error instead of a misleading empty list, the 200-character limit is enforced in the UI, and removals match by keyword value rather than index. The editor now also stays available when `/api/resilience` fails to load ([#20078](https://github.com/cheaper-inference/OmniRoute/pull/20078)) — thanks @sdfsdfw2

View File

@@ -1 +0,0 @@
- **fix(sse):** the usage guard computes the request body size and the input-token estimate once per request instead of on every streamed chunk that carries usage, so an upstream that repeats `usage` (for example with 0 input tokens) on each chunk no longer re-serializes and re-tokenizes a large request per chunk and starves the event loop, and a Responses passthrough stream no longer rebuilds the accounting receipt for every delta ([#20086](https://github.com/cheaper-inference/OmniRoute/issues/20086), [#20480](https://github.com/cheaper-inference/OmniRoute/issues/20480)) — thanks @mmatus3 and @javargasm

View File

@@ -1 +0,0 @@
- **fix(translator):** streamed chat completions from Claude models now return `"{}"` as the arguments of a tool call that takes no parameters, matching the non-streamed response. Before, the arguments were an empty string, which is not valid JSON. ([#20152](https://github.com/cheaper-inference/OmniRoute/issues/20152))

View File

@@ -1 +0,0 @@
- **fix(codex):** Keep subscription tier badges and paid-model routing eligibility in sync with the latest successful Codex usage response, including upgrades from Free to Plus and subsequent downgrades ([#20178](https://github.com/cheaper-inference/OmniRoute/pull/20178)) — thanks @Bl0ck154

View File

@@ -1 +0,0 @@
- Guard `POST /api/providers/[id]/sync-models` with `requireManagementAuth()` when not called with an internal model-sync token so validated management subjects (local CLI token, scoped `oma_` access tokens, manage-scoped API keys, internal service token) are accepted consistently and inference-only keys get 403 ([#20187](https://github.com/cheaper-inference/OmniRoute/issues/20187)) — thanks @wsk0715

View File

@@ -1 +0,0 @@
- **fix(sse):** in a combo, the Codex effort-suffix guard no longer removes the client's `output_config.effort` from the request body that the next combo target reads. ([#20194](https://github.com/cheaper-inference/OmniRoute/pull/20194))

View File

@@ -1 +0,0 @@
- **fix(sse):** let a deduplicated request run its own upstream call when the first caller disconnects. ([#20194](https://github.com/cheaper-inference/OmniRoute/pull/20194))

View File

@@ -1 +0,0 @@
- **fix(sse):** requests to DeepSeek models (`deepseek-*`, on any provider) keep only the first definition of a repeated tool name, because DeepSeek answers a repeated name with HTTP 400 "Tool names must be unique". Other models are not changed. ([#20194](https://github.com/cheaper-inference/OmniRoute/pull/20194))

View File

@@ -1 +0,0 @@
- **fix(sse):** a failed memory-settings read is logged at debug level; the request still runs with memory off, as before, but the cause is now visible. ([#20194](https://github.com/cheaper-inference/OmniRoute/pull/20194))

View File

@@ -1 +0,0 @@
- **fix(memory):** memory injection no longer puts the per-query memory text at the head of an OpenAI, Codex or Azure prompt (it broke automatic prefix caching on every turn), and one corrupt skill row no longer makes every non-streaming request of an API key fail. ([#20194](https://github.com/cheaper-inference/OmniRoute/pull/20194))

View File

@@ -1 +0,0 @@
- **fix(sse):** stop probe key-health writes on non-streaming calls and cap ModelScope retry waits. ([#20194](https://github.com/cheaper-inference/OmniRoute/pull/20194))

View File

@@ -1 +0,0 @@
- **fix(skills):** registering the same skill again (same API key, name and version) now updates the existing row and keeps its id and run history, instead of adding a duplicate. A migration removes old duplicates once (keeps the newest) and adds a unique index. ([#20194](https://github.com/cheaper-inference/OmniRoute/pull/20194))

View File

@@ -1 +0,0 @@
- **fix(sse):** A Claude passthrough request whose tool is named with a leading `proxy_` (for example `proxy_search`) gets the same tool name back in the reply; the executor strips that prefix upstream and the reply used to show the stripped name. ([#20199](https://github.com/cheaper-inference/OmniRoute/pull/20199))

View File

@@ -1 +0,0 @@
- **fix(sse):** an Android user agent (Dalvik, mobile browsers) is no longer taken for the Droid CLI, so a Responses-shaped body sent to a non-`/responses` endpoint by such a client is converted back to Chat Completions as before. ([#20199](https://github.com/cheaper-inference/OmniRoute/pull/20199))

View File

@@ -1 +0,0 @@
- **fix(sse):** the empty-turn retry on another connection now replaces the request credentials instead of merging into them, so keys that only the first connection defines (lease routing, a Copilot session token) are not sent to the second. ([#20199](https://github.com/cheaper-inference/OmniRoute/pull/20199))

View File

@@ -1 +0,0 @@
- **fix(sse):** when the upstream-proxy fallback drops a failed native response and retries through CLIProxyAPI or Dario, the dropped response body is cancelled at once instead of holding its socket until garbage collection. ([#20199](https://github.com/cheaper-inference/OmniRoute/pull/20199))

View File

@@ -1 +0,0 @@
- **fix(sse):** a failed connection-cooldown write (geo-blocked or project-required connection) and a failed Codex scope-cooldown persist are logged as warnings instead of being dropped, so a connection that is selected again can be traced to the failed write. ([#20199](https://github.com/cheaper-inference/OmniRoute/pull/20199))

View File

@@ -1 +0,0 @@
- **fix(sse):** `isTokenExpiringSoon` now reads a token expiry given in epoch seconds or as a numeric string, so a valid token is no longer reported as expiring (seconds) or as never expiring (numeric string). ([#20199](https://github.com/cheaper-inference/OmniRoute/pull/20199))

View File

@@ -1 +0,0 @@
- **fix(sse):** keep the combo target pin on safety-net redirects and release the OAuth slot when a connection reasoning rule fails. ([#20201](https://github.com/cheaper-inference/OmniRoute/pull/20201))

View File

@@ -1 +0,0 @@
- **fix(sse):** the retry that follows a rejected field or a clamped limit on a CLI-fingerprinted upstream (Claude Code) keeps the CLI body-field order of the first send instead of the client order. ([#20201](https://github.com/cheaper-inference/OmniRoute/pull/20201))

View File

@@ -1 +0,0 @@
- **fix(sse):** when a client sends the Claude Code sentinel and its own instructions in one system block, only the sentinel is replaced; the client's instructions are kept instead of being deleted with the block. ([#20201](https://github.com/cheaper-inference/OmniRoute/pull/20201))

View File

@@ -1 +0,0 @@
- **fix(sse):** a client abort during a request on a pooled-session provider (for example llm7) no longer puts the healthy session into cooldown; only real upstream failures do. ([#20201](https://github.com/cheaper-inference/OmniRoute/pull/20201))

View File

@@ -1 +0,0 @@
- **fix(executors):** merged abort signals no longer leave listeners on the long-lived request signal when nothing aborts. ([#20201](https://github.com/cheaper-inference/OmniRoute/pull/20201))

View File

@@ -1 +0,0 @@
- **fix(qoder):** A Qoder PAT connection runs the local `qodercli`, which gets text only, so an image in the request was replaced by the text `[Image omitted]` and the model answered blind. Image requests now skip PAT connections (a combo goes on to its next target), and a PAT call that still gets an image answers 400 `image_input_unsupported` before it starts the CLI. HTTP connections still forward images. ([#20201](https://github.com/cheaper-inference/OmniRoute/pull/20201))

Some files were not shown because too many files have changed in this diff Show More