mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-11-18 07:58:27 +00:00
Merge remote-tracking branch 'origin/release/v3.8.52' into HEAD
# Conflicts: # src/domain/quotaCache.ts
This commit is contained in:
17
.env.example
17
.env.example
@@ -718,6 +718,13 @@ ALLOW_API_KEY_REVEAL=false
|
||||
# Default: false
|
||||
# OMNIROUTE_PREFER_CLAUDE_CODE_FOR_UNPREFIXED_CLAUDE_MODELS=false
|
||||
|
||||
# Legacy resolveBareModelToConnectionDefault behaviour (#4825): replace ANY bare
|
||||
# model name (not only "auto"/empty) with the selected connection's defaultModel.
|
||||
# Off by default: a concrete bare name such as claude-haiku-4-5 is kept.
|
||||
# Used by: open-sse/services/model.ts.
|
||||
# Default: false
|
||||
# BARE_MODEL_DEFAULT_OVERRIDE_LEGACY=false
|
||||
|
||||
# Per-model concurrency cap for round-robin combos (#9100).
|
||||
# Used by: open-sse/services/comboConfig.ts — the round-robin combo semaphore
|
||||
# was hard-capped at 3 concurrent requests per model with no override, which
|
||||
@@ -872,6 +879,10 @@ NEXT_PUBLIC_CLOUD_URL=
|
||||
# Override only for relays or test fixtures.
|
||||
#OMNIROUTE_OPENCODE_QUOTA_URL=https://opencode.ai/zen/go/v1/usage
|
||||
#OMNIROUTE_OLLAMA_CLOUD_USAGE_URL=https://ollama.com/settings
|
||||
# Ollama Cloud documented balance endpoint, authenticated with the connection API key
|
||||
# (open-sse/services/ollamaCloudBalance.ts). Tried before the settings-page scraper.
|
||||
# Override only for relays or test fixtures.
|
||||
#OMNIROUTE_OLLAMA_CLOUD_BALANCE_URL=https://ollama.com/api/balance
|
||||
|
||||
# OpenCode Go/Zen VPS egress (#5997): on a datacenter VPS, Cloudflare in front of
|
||||
# opencode.ai/zen/go 403s chat requests that lack OpenCode CLI identity headers.
|
||||
@@ -885,6 +896,12 @@ NEXT_PUBLIC_CLOUD_URL=
|
||||
#OPENCODE_CLIENT=desktop
|
||||
#OPENCODE_PROJECT=global
|
||||
|
||||
# Forward client app-attribution headers (x-session-id / x-title / http-referer) to
|
||||
# upstream providers, so requests keep their app identity through the router
|
||||
# (OpenRouter publisher gates key on them). ON by default; operator custom headers
|
||||
# always win. Set to 0/false/no/off to keep the operator identity instead.
|
||||
#OMNIROUTE_FORWARD_ATTRIBUTION=1
|
||||
|
||||
# Keyless OpenCode models are answered only when the request declares a non-empty tool
|
||||
# list, and the upstream inspects which names it carries. OmniRoute reuses the list a
|
||||
# request of the same conversation was last seen getting through, so a request that
|
||||
|
||||
16
.github/workflows/ci.yml
vendored
16
.github/workflows/ci.yml
vendored
@@ -141,6 +141,7 @@ jobs:
|
||||
if-no-files-found: warn
|
||||
retention-days: 7
|
||||
- run: npm run check:cycles:ratchet
|
||||
- run: npm run check:boundary:ratchet
|
||||
- run: npm run check:route-validation:t06
|
||||
- run: npm run check:any-budget:t11
|
||||
- run: npm run check:provider-consistency
|
||||
@@ -705,7 +706,7 @@ jobs:
|
||||
# back to ubuntu-latest unless the PR head repo is this repository (push /
|
||||
# dispatch events are own-origin by definition). Any failure path (VM down,
|
||||
# var unset/false) also falls back to ubuntu-latest.
|
||||
runs-on: ${{ (vars.USE_VPS_RUNNER == 'true' && github.event_name != 'merge_group' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository)) && fromJSON('["self-hosted","omni-build"]') || 'ubuntu-latest' }}
|
||||
runs-on: ${{ (vars.USE_VPS_RUNNER == 'true' && vars.USE_VPS_BUILD_RUNNER == 'true' && github.event_name != 'merge_group' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository)) && fromJSON('["self-hosted","omni-build"]') || 'ubuntu-latest' }}
|
||||
needs: changes
|
||||
# Capacity is owned by the ONE omni-build runner slot (#12048), also used by
|
||||
# Docker amd64. Do not add another worker with that label on the same host
|
||||
@@ -734,9 +735,16 @@ jobs:
|
||||
# Use the existing webpack fallback on hosted runners, matching limited Docker builders.
|
||||
# Keep the benchmarked Turbopack build on the dedicated omni-build runner.
|
||||
# Both produce the standalone artifact consumed by downstream smoke checks.
|
||||
# 2026-10-16: Turbopack is OFF on every runner. Measured alone on the 32-vCPU/47 GB
|
||||
# .113 (cgroup cap, swap off), a Turbopack build of this tree peaks at 33-37 GB on
|
||||
# Next 16.3.5/16.3.6/16.3.8 (compile ~21 GB + 31 static-generation workers 17-21 GB),
|
||||
# which the box cannot spare next to the three omni-light runners (~200 red Builds
|
||||
# since 10-06, each swap-thrashing for 17-90 min); 16.4.2 needs more than 36 GB in
|
||||
# the compile phase alone. webpack builds the same tree in 14 GB. Guarded by
|
||||
# tests/unit/ci-build-bundler-webpack.test.ts; flip back only with a measurement.
|
||||
- run: npm run build
|
||||
env:
|
||||
OMNIROUTE_USE_TURBOPACK: ${{ (vars.USE_VPS_RUNNER == 'true' && github.event_name != 'merge_group' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository)) && '1' || '0' }}
|
||||
OMNIROUTE_USE_TURBOPACK: "0"
|
||||
- name: Verify colocated compression worker
|
||||
run: node --import tsx/esm --test tests/integration/compression-worker-standalone.int.test.ts
|
||||
env:
|
||||
@@ -1066,7 +1074,7 @@ jobs:
|
||||
- name: Upload test results to Trunk (advisory)
|
||||
if: ${{ always() && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) }}
|
||||
continue-on-error: true
|
||||
uses: trunk-io/analytics-uploader@14c0f18990953eecd01c9c5afe3cc63a73b6c371 # v2.1.5
|
||||
uses: trunk-io/analytics-uploader@a86313c7029d22e6ea2d5c346060a224d90053dc # v2.1.6
|
||||
with:
|
||||
junit-paths: trunk-junit/**/*.xml
|
||||
org-slug: omniroute
|
||||
@@ -1399,7 +1407,7 @@ jobs:
|
||||
- name: Upload test results to Trunk (advisory)
|
||||
if: ${{ always() && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) }}
|
||||
continue-on-error: true
|
||||
uses: trunk-io/analytics-uploader@14c0f18990953eecd01c9c5afe3cc63a73b6c371 # v2.1.5
|
||||
uses: trunk-io/analytics-uploader@a86313c7029d22e6ea2d5c346060a224d90053dc # v2.1.6
|
||||
with:
|
||||
junit-paths: junit-e2e-results.xml
|
||||
org-slug: omniroute
|
||||
|
||||
4
.github/workflows/codeql.yml
vendored
4
.github/workflows/codeql.yml
vendored
@@ -22,10 +22,10 @@ jobs:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
- uses: github/codeql-action/init@2892aa5e19bbd11bc0cff5427e3b750a04d9e3c2 # v4.38.2
|
||||
- uses: github/codeql-action/init@24c54180a607b1449ed407dd24f251e4e9147c8d # v4.38.3
|
||||
with:
|
||||
languages: javascript-typescript
|
||||
queries: security-extended
|
||||
- uses: github/codeql-action/analyze@2892aa5e19bbd11bc0cff5427e3b750a04d9e3c2 # v4.38.2
|
||||
- uses: github/codeql-action/analyze@24c54180a607b1449ed407dd24f251e4e9147c8d # v4.38.3
|
||||
with:
|
||||
category: "/language:javascript-typescript"
|
||||
|
||||
7
.github/workflows/docker-publish.yml
vendored
7
.github/workflows/docker-publish.yml
vendored
@@ -144,7 +144,7 @@ jobs:
|
||||
name: Preflight — amd64 runner availability
|
||||
needs: prepare
|
||||
if: >-
|
||||
github.event_name != 'schedule' && needs.prepare.outputs.skip != 'true' && vars.USE_VPS_RUNNER == 'true' &&
|
||||
github.event_name != 'schedule' && needs.prepare.outputs.skip != 'true' && vars.USE_VPS_RUNNER == 'true' && vars.USE_VPS_BUILD_RUNNER == 'true' &&
|
||||
(github.event_name != 'schedule' || github.repository == 'diegosouzapw/OmniRoute')
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 5
|
||||
@@ -193,7 +193,7 @@ jobs:
|
||||
# (run 33253576569). The same tree's arm64 webpack build on hosted ARM
|
||||
# succeeded (run 33264823398). Dockerfile already documents webpack as the
|
||||
# Docker escape hatch (OMNIROUTE_USE_TURBOPACK=0).
|
||||
runs-on: ${{ matrix.arch == 'amd64' && (vars.USE_VPS_RUNNER == 'true' && fromJSON('["self-hosted","omni-build"]') || 'ubuntu-24.04') || 'ubuntu-24.04-arm' }}
|
||||
runs-on: ${{ matrix.arch == 'amd64' && (vars.USE_VPS_RUNNER == 'true' && vars.USE_VPS_BUILD_RUNNER == 'true' && fromJSON('["self-hosted","omni-build"]') || 'ubuntu-24.04') || 'ubuntu-24.04-arm' }}
|
||||
# Share the 1-slot omni-build ceiling (#12048) with ci.yml `Build` /
|
||||
# npm-publish. Same group as main's Build so a :next publish waits beside
|
||||
# the artefact instead of sitting next to it. arm64 is hosted — its own
|
||||
@@ -665,7 +665,7 @@ jobs:
|
||||
- name: Upload Trivy SARIF to Security tab
|
||||
if: needs.prepare.outputs.version != 'main'
|
||||
continue-on-error: true
|
||||
uses: github/codeql-action/upload-sarif@v4.38.2
|
||||
uses: github/codeql-action/upload-sarif@v4.38.3
|
||||
with:
|
||||
sarif_file: trivy-results.sarif
|
||||
category: trivy-image
|
||||
@@ -691,6 +691,7 @@ jobs:
|
||||
name: omni-build runner offline alert
|
||||
if: >-
|
||||
(github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') &&
|
||||
vars.USE_VPS_RUNNER == 'true' && vars.USE_VPS_BUILD_RUNNER == 'true' &&
|
||||
(github.event_name != 'schedule' || github.repository == 'diegosouzapw/OmniRoute')
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 5
|
||||
|
||||
34
.github/workflows/nightly-llm-security.yml
vendored
34
.github/workflows/nightly-llm-security.yml
vendored
@@ -21,6 +21,24 @@ jobs:
|
||||
persist-credentials: false
|
||||
- uses: actions/setup-node@v7
|
||||
with: { node-version: "24", cache: npm }
|
||||
# Fresh runtime state per run (same contract as nightly-schemathesis.yml). The
|
||||
# omni-light runner keeps a persistent $HOME, so the server used to boot on
|
||||
# $HOME/.omniroute, where the database left by older nights sat at migration 134
|
||||
# while the tip ships 200+: the mass-migration guard (#3416, threshold 50) refused
|
||||
# to migrate it, the catalog warm-up hit `no such table: model_capability_overrides`
|
||||
# and the health wait failed every night (no verdict since 2026-08-27). A DATA_DIR
|
||||
# under $RUNNER_TEMP is a new database every run, so every migration applies and
|
||||
# nothing on the box is touched. Auto-backups stay off: one pre-migration backup
|
||||
# per boot had piled up 1.6 GB under the runner's home.
|
||||
- name: Prepare isolated runtime state
|
||||
id: runtime
|
||||
run: |
|
||||
data_dir=$(mktemp -d "$RUNNER_TEMP/omniroute-llm-security.XXXXXX")
|
||||
mkdir "$data_dir/plugins"
|
||||
{
|
||||
echo "DATA_DIR=$data_dir"
|
||||
echo "OMNIROUTE_PLUGINS_DIR=$data_dir/plugins"
|
||||
} >> "$GITHUB_ENV"
|
||||
- run: npm ci
|
||||
env:
|
||||
ONNXRUNTIME_NODE_INSTALL: "skip"
|
||||
@@ -28,6 +46,7 @@ jobs:
|
||||
env:
|
||||
JWT_SECRET: ci-build-secret-with-sufficient-length-for-validation
|
||||
OMNIROUTE_BUILD_BACKEND_ONLY: "1"
|
||||
OMNIROUTE_USE_TURBOPACK: "0"
|
||||
run: npm run build:cli
|
||||
# Own port: this box also hosts the deployed server (the a11y job's
|
||||
# "20128 is already used" nights prove it). A test server that dies on
|
||||
@@ -39,6 +58,7 @@ jobs:
|
||||
JWT_SECRET: ci-build-secret-with-sufficient-length-for-validation
|
||||
PORT: "21778"
|
||||
INJECTION_GUARD_MODE: block
|
||||
DISABLE_SQLITE_AUTO_BACKUP: "true"
|
||||
run: |
|
||||
node dist/server.js > server.log 2>&1 &
|
||||
echo $! > server.pid
|
||||
@@ -88,6 +108,18 @@ jobs:
|
||||
- uses: actions/setup-node@v7
|
||||
if: steps.gate.outputs.run == 'true'
|
||||
with: { node-version: "24", cache: npm }
|
||||
# Same isolation as the promptfoo job above: a fresh DATA_DIR per run, never the
|
||||
# runner's persistent $HOME/.omniroute (stale schema → migration guard → no boot).
|
||||
- name: Prepare isolated runtime state
|
||||
id: runtime
|
||||
if: steps.gate.outputs.run == 'true'
|
||||
run: |
|
||||
data_dir=$(mktemp -d "$RUNNER_TEMP/omniroute-llm-security.XXXXXX")
|
||||
mkdir "$data_dir/plugins"
|
||||
{
|
||||
echo "DATA_DIR=$data_dir"
|
||||
echo "OMNIROUTE_PLUGINS_DIR=$data_dir/plugins"
|
||||
} >> "$GITHUB_ENV"
|
||||
- run: npm ci
|
||||
env:
|
||||
ONNXRUNTIME_NODE_INSTALL: "skip"
|
||||
@@ -97,6 +129,7 @@ jobs:
|
||||
env:
|
||||
JWT_SECRET: ci-build-secret-with-sufficient-length-for-validation
|
||||
OMNIROUTE_BUILD_BACKEND_ONLY: "1"
|
||||
OMNIROUTE_USE_TURBOPACK: "0"
|
||||
run: npm run build:cli
|
||||
# Same contract as the promptfoo job above: dedicated port, and the
|
||||
# health wait must fail the job instead of letting garak probe whatever
|
||||
@@ -106,6 +139,7 @@ jobs:
|
||||
env:
|
||||
JWT_SECRET: ci-build-secret-with-sufficient-length-for-validation
|
||||
PORT: "21779"
|
||||
DISABLE_SQLITE_AUTO_BACKUP: "true"
|
||||
run: |
|
||||
node dist/server.js > server.log 2>&1 &
|
||||
echo $! > server.pid
|
||||
|
||||
4
.github/workflows/nightly-release-green.yml
vendored
4
.github/workflows/nightly-release-green.yml
vendored
@@ -70,7 +70,7 @@ jobs:
|
||||
# this runs on the dedicated VPS runner — clean env (no operator OMNIROUTE_API_KEY,
|
||||
# no local noauth CLIs => zero machine-specific false positives) and no contention.
|
||||
# Nightly cron normally finds the var false (VM off) and falls back to hosted.
|
||||
runs-on: ${{ (vars.USE_VPS_RUNNER == 'true' && fromJSON('["self-hosted","omni-build"]')) || 'ubuntu-latest' }}
|
||||
runs-on: ${{ (vars.USE_VPS_RUNNER == 'true' && vars.USE_VPS_BUILD_RUNNER == 'true' && fromJSON('["self-hosted","omni-build"]')) || 'ubuntu-latest' }}
|
||||
env:
|
||||
JWT_SECRET: ci-nightly-secret-with-sufficient-length-for-validation
|
||||
API_KEY_SECRET: ci-nightly-api-key-secret-long
|
||||
@@ -276,7 +276,7 @@ jobs:
|
||||
# On a push, only run for a push to main — a push to release/* is handled by
|
||||
# release-green above. Schedule/dispatch always run (they also sweep main).
|
||||
if: ${{ (github.event_name != 'push' || github.ref_name == 'main') && (github.event_name != 'schedule' || github.repository == 'diegosouzapw/OmniRoute') }}
|
||||
runs-on: ${{ (vars.USE_VPS_RUNNER == 'true' && fromJSON('["self-hosted","omni-build"]')) || 'ubuntu-latest' }}
|
||||
runs-on: ${{ (vars.USE_VPS_RUNNER == 'true' && vars.USE_VPS_BUILD_RUNNER == 'true' && fromJSON('["self-hosted","omni-build"]')) || 'ubuntu-latest' }}
|
||||
env:
|
||||
JWT_SECRET: ci-nightly-secret-with-sufficient-length-for-validation
|
||||
API_KEY_SECRET: ci-nightly-api-key-secret-long
|
||||
|
||||
40
.github/workflows/nightly-resilience.yml
vendored
40
.github/workflows/nightly-resilience.yml
vendored
@@ -45,7 +45,12 @@ jobs:
|
||||
k6-soak:
|
||||
if: ${{ github.event_name != 'schedule' || github.repository == 'diegosouzapw/OmniRoute' }}
|
||||
name: k6 load/soak
|
||||
runs-on: ubuntu-latest
|
||||
# #11965: this job runs a backend-only `next build`; the hosted 7 GB runner cannot build
|
||||
# release/v3.8.51 (VM shutdown ~7 min in), so it targets the box's light pool (`omni-light`:
|
||||
# two listeners, jobs ≤ ~6 GB). Falls back to hosted when USE_VPS_RUNNER is off.
|
||||
# #16853: on hosted it died in `npm run build:cli` 8 nights out of 8 ("The runner has
|
||||
# received a shutdown signal").
|
||||
runs-on: ${{ (vars.USE_VPS_RUNNER == 'true' && fromJSON('["self-hosted","omni-light"]')) || 'ubuntu-latest' }}
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
with:
|
||||
@@ -54,6 +59,21 @@ jobs:
|
||||
with:
|
||||
node-version: "24"
|
||||
cache: npm
|
||||
# Fresh runtime state per run (same contract as nightly-llm-security.yml). The
|
||||
# omni-light runner keeps a persistent $HOME, so a server booted without DATA_DIR
|
||||
# lands on $HOME/.omniroute, where a database left by older runs can sit far behind
|
||||
# the tip's migrations: the mass-migration guard (#3416) refuses to migrate it and
|
||||
# the server never becomes healthy. A DATA_DIR under $RUNNER_TEMP is a new database
|
||||
# every run, so every migration applies and nothing on the box is touched.
|
||||
- name: Prepare isolated runtime state
|
||||
id: runtime
|
||||
run: |
|
||||
data_dir=$(mktemp -d "$RUNNER_TEMP/omniroute-k6-soak.XXXXXX")
|
||||
mkdir "$data_dir/plugins"
|
||||
{
|
||||
echo "DATA_DIR=$data_dir"
|
||||
echo "OMNIROUTE_PLUGINS_DIR=$data_dir/plugins"
|
||||
} >> "$GITHUB_ENV"
|
||||
- run: npm ci
|
||||
env:
|
||||
ONNXRUNTIME_NODE_INSTALL: "skip"
|
||||
@@ -61,24 +81,34 @@ jobs:
|
||||
env:
|
||||
JWT_SECRET: ci-build-secret-with-sufficient-length-for-validation
|
||||
OMNIROUTE_BUILD_BACKEND_ONLY: "1"
|
||||
OMNIROUTE_USE_TURBOPACK: "0"
|
||||
run: npm run build:cli
|
||||
# Own port: this box also hosts the deployed server on 20128. A test server that
|
||||
# dies on EADDRINUSE must NOT let the soak fall through to whatever else answers
|
||||
# there, and a soak against nothing must not go green — the health wait fails the
|
||||
# job (same contract as nightly-llm-security.yml). Auto-backups stay off: one
|
||||
# pre-migration backup per boot piles up under the runner's home.
|
||||
- name: Start OmniRoute (background)
|
||||
env:
|
||||
JWT_SECRET: ci-build-secret-with-sufficient-length-for-validation
|
||||
PORT: "20128"
|
||||
PORT: "21776"
|
||||
DISABLE_SQLITE_AUTO_BACKUP: "true"
|
||||
run: |
|
||||
node dist/server.js > server.log 2>&1 &
|
||||
echo $! > server.pid
|
||||
for i in $(seq 1 30); do
|
||||
if curl -sf http://localhost:20128/api/monitoring/health >/dev/null; then echo "server up"; break; fi
|
||||
for i in $(seq 1 60); do
|
||||
if curl -sf http://localhost:21776/api/monitoring/health >/dev/null; then echo "server up"; exit 0; fi
|
||||
sleep 2
|
||||
done
|
||||
echo "::error::Test server did not come up on 21776 in 120s — see server.log. Refusing to run the soak against an unknown target."
|
||||
tail -40 server.log || true
|
||||
exit 1
|
||||
- name: Install k6
|
||||
uses: grafana/setup-k6-action@v1
|
||||
- name: Run k6 soak
|
||||
run: k6 run tests/load/k6-soak.js
|
||||
env:
|
||||
BASE_URL: http://localhost:20128
|
||||
BASE_URL: http://localhost:21776
|
||||
SOAK_DURATION: "3m"
|
||||
SOAK_VUS: "10"
|
||||
- name: Stop server
|
||||
|
||||
1
.github/workflows/nightly-schemathesis.yml
vendored
1
.github/workflows/nightly-schemathesis.yml
vendored
@@ -38,6 +38,7 @@ jobs:
|
||||
env:
|
||||
JWT_SECRET: ci-build-secret-with-sufficient-length-for-validation
|
||||
OMNIROUTE_BUILD_BACKEND_ONLY: "1"
|
||||
OMNIROUTE_USE_TURBOPACK: "0"
|
||||
run: npm run build:cli
|
||||
- name: Start OmniRoute (background)
|
||||
env:
|
||||
|
||||
2
.github/workflows/nightly-v4-build.yml
vendored
2
.github/workflows/nightly-v4-build.yml
vendored
@@ -56,7 +56,7 @@ jobs:
|
||||
if: (github.event_name != 'schedule' || github.repository == 'diegosouzapw/OmniRoute') && needs.detect.outputs.exists == 'true'
|
||||
# Same dynamic-runner rule as npm-publish.yml: a full `next build` outgrew the
|
||||
# 16 GB hosted runner during v3.8.49. Never runs on pull_request.
|
||||
runs-on: ${{ vars.USE_VPS_RUNNER == 'true' && fromJSON('["self-hosted","omni-build"]') || 'ubuntu-latest' }}
|
||||
runs-on: ${{ vars.USE_VPS_RUNNER == 'true' && vars.USE_VPS_BUILD_RUNNER == 'true' && fromJSON('["self-hosted","omni-build"]') || 'ubuntu-latest' }}
|
||||
permissions:
|
||||
contents: read
|
||||
outputs:
|
||||
|
||||
2
.github/workflows/npm-publish.yml
vendored
2
.github/workflows/npm-publish.yml
vendored
@@ -65,7 +65,7 @@ jobs:
|
||||
# mid-"Creating an optimized production build" while v3.8.48 had still fit in 16min.
|
||||
# This job never runs on `pull_request`, so the fork-safety clause is always true here;
|
||||
# it is kept verbatim so the expression stays greppable against ci.yml.
|
||||
runs-on: ${{ (vars.USE_VPS_RUNNER == 'true' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository)) && fromJSON('["self-hosted","omni-build"]') || 'ubuntu-latest' }}
|
||||
runs-on: ${{ (vars.USE_VPS_RUNNER == 'true' && vars.USE_VPS_BUILD_RUNNER == 'true' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository)) && fromJSON('["self-hosted","omni-build"]') || 'ubuntu-latest' }}
|
||||
outputs:
|
||||
version: ${{ steps.resolve.outputs.version }}
|
||||
tag: ${{ steps.resolve.outputs.tag }}
|
||||
|
||||
2
.github/workflows/preview-artifact.yml
vendored
2
.github/workflows/preview-artifact.yml
vendored
@@ -102,7 +102,7 @@ jobs:
|
||||
# Same pool rule as npm-publish.yml: the hosted runner cannot hold `next build`
|
||||
# for this tree any more (#11946). The fork clause is redundant here (resolve
|
||||
# already refused forks) and is kept so the expression stays greppable.
|
||||
runs-on: ${{ (vars.USE_VPS_RUNNER == 'true' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository)) && fromJSON('["self-hosted","omni-build"]') || 'ubuntu-latest' }}
|
||||
runs-on: ${{ (vars.USE_VPS_RUNNER == 'true' && vars.USE_VPS_BUILD_RUNNER == 'true' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository)) && fromJSON('["self-hosted","omni-build"]') || 'ubuntu-latest' }}
|
||||
timeout-minutes: 120
|
||||
permissions:
|
||||
contents: read # checkout + git fetch refs/pull/<N>/head — read-only, no OIDC
|
||||
|
||||
8
.github/workflows/quality.yml
vendored
8
.github/workflows/quality.yml
vendored
@@ -244,9 +244,11 @@ jobs:
|
||||
# Ratchet-mode gates append --ratchet. `cycles` belongs here since #15281
|
||||
# (69cb18dca8): check-cycles.mjs exits 1 on ANY cycle without --ratchet, and
|
||||
# the frozen ceiling lives in quality-baseline.json → metrics.cycles — same
|
||||
# `check:cycles:ratchet` semantics ci.yml runs (base-red #15306).
|
||||
# `check:cycles:ratchet` semantics ci.yml runs (base-red #15306). `boundary`
|
||||
# caps the open-sse → src edge count (measure-boundary.mjs --ratchet, ceiling
|
||||
# quality-baseline.json → metrics.boundaryOpenSseToSrc) — same as ci.yml lint.
|
||||
ratchet_gates=(
|
||||
secrets vuln-ratchet workflows openapi-breaking cycles
|
||||
secrets vuln-ratchet workflows openapi-breaking cycles boundary
|
||||
)
|
||||
failed=()
|
||||
for g in "${gates[@]}"; do
|
||||
@@ -412,7 +414,7 @@ jobs:
|
||||
- name: Upload test results to Trunk (advisory)
|
||||
if: ${{ always() && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) }}
|
||||
continue-on-error: true
|
||||
uses: trunk-io/analytics-uploader@14c0f18990953eecd01c9c5afe3cc63a73b6c371 # v2.1.5
|
||||
uses: trunk-io/analytics-uploader@a86313c7029d22e6ea2d5c346060a224d90053dc # v2.1.6
|
||||
with:
|
||||
junit-paths: trunk-junit/**/*.xml
|
||||
org-slug: omniroute
|
||||
|
||||
2
.github/workflows/scorecard.yml
vendored
2
.github/workflows/scorecard.yml
vendored
@@ -29,7 +29,7 @@ jobs:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Run analysis
|
||||
uses: ossf/scorecard-action@v2.4.4
|
||||
uses: ossf/scorecard-action@v2.5.0
|
||||
with:
|
||||
results_file: results.sarif
|
||||
results_format: sarif
|
||||
|
||||
668
.i18n-state.json
668
.i18n-state.json
File diff suppressed because it is too large
Load Diff
@@ -95,35 +95,37 @@ active. When a gateway rejects that fallback, the catalog still
|
||||
publishes — but with raw model ids instead of display names, no canonical
|
||||
alias dedupe, no pricing and no combos. The plugin warns once per endpoint
|
||||
when this happens, naming the endpoint and the consequence, so the degraded
|
||||
catalog is never a mystery.
|
||||
catalog is never a mystery. Environment variables must reach the opencode
|
||||
server process: when the host runs as a service, export the key where the
|
||||
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; 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` | Prefix a display name with the upstream provider it routes to |
|
||||
| `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`) |
|
||||
| `freeOnly` / `toolsOnly` / `visionOnly` | `false` / `false` / `false` | Filter to free-tier / tool-calling / image-input models; combos with a filtered member are dropped, never partial |
|
||||
| `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-or-suffix allowlists, deny wins |
|
||||
| `providersAllow` | `[]` | Provider allowlist by id prefix (empty = full catalog); unknown names warn once, empty result publishes empty + warns. Unknown catalog prefixes always pass, and an allowlist or vocabulary that names nothing known keeps the full catalog + warns |
|
||||
| `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 |
|
||||
| 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; 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` | Prefix a display name with the upstream provider it routes to |
|
||||
| `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`) |
|
||||
| `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) |
|
||||
| `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-or-suffix allowlists, deny wins |
|
||||
| `providersAllow` | `[]` | Provider allowlist by id prefix (empty = full catalog); unknown names warn once, empty result publishes empty + warns. Unknown catalog prefixes always pass, and an allowlist or vocabulary that names nothing known keeps the full catalog + warns |
|
||||
| `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 —
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
import type { LegacyModel } from "./legacy-model.js";
|
||||
import type { OmniRouteEnrichmentEntry } from "./shared/enrich.js";
|
||||
import type { OmniRouteEnrichmentEntry, OmniRouteEnrichmentMap } from "./shared/enrich.js";
|
||||
import { lookupEnrichment } from "./shared/enrich.js";
|
||||
import type { OmniRouteRawCombo } from "./shared/combos-map.js";
|
||||
import type { OmniRouteRawModelEntry } from "./shared/models-map.js";
|
||||
import { isFreeOnlyFreeType } from "./shared/naming.js";
|
||||
|
||||
export interface CapabilityPresetFlags {
|
||||
freeOnly?: boolean;
|
||||
@@ -20,7 +24,7 @@ export function passesCapabilityPresets(
|
||||
enrichment: OmniRouteEnrichmentEntry | undefined,
|
||||
flags: CapabilityPresetFlags
|
||||
): boolean {
|
||||
if (flags.freeOnly === true && enrichment?.freeType === undefined) return false;
|
||||
if (flags.freeOnly === true && !isFreeOnlyFreeType(enrichment?.freeType)) return false;
|
||||
if (flags.toolsOnly === true && mapped.capabilities.toolcall !== true) return false;
|
||||
if (
|
||||
flags.visionOnly === true &&
|
||||
@@ -29,3 +33,198 @@ export function passesCapabilityPresets(
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Raw-entry form of the preset predicate for the ranks-before-filters
|
||||
* pool. Reads the same signals as `passesCapabilityPresets` without
|
||||
* mapping the entry first: `freeOnly` uses `isFreeOnlyFreeType` on the
|
||||
* overlay row the caller resolved, `toolsOnly` reads `capabilities.tool_calling`,
|
||||
* `visionOnly`
|
||||
* reads `capabilities.attachment ?? capabilities.vision` or an `image`
|
||||
* input modality (same `?? ["text"]` default as the mapper). Neutral
|
||||
* when no preset is on, so the default view is unchanged without one.
|
||||
*/
|
||||
export function passesRawPreset(
|
||||
raw: OmniRouteRawModelEntry,
|
||||
enrichment: OmniRouteEnrichmentEntry | undefined,
|
||||
flags: CapabilityPresetFlags
|
||||
): boolean {
|
||||
if (flags.freeOnly === true && !isFreeOnlyFreeType(enrichment?.freeType)) return false;
|
||||
if (flags.toolsOnly === true && Boolean(raw.capabilities?.tool_calling ?? false) !== true)
|
||||
return false;
|
||||
if (
|
||||
flags.visionOnly === true &&
|
||||
!(
|
||||
Boolean(raw.capabilities?.attachment ?? raw.capabilities?.vision ?? false) ||
|
||||
new Set(raw.input_modalities ?? ["text"]).has("image")
|
||||
)
|
||||
)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/** True when any preset subtracts: the pool narrows, combos resolve per member. */
|
||||
export function presetsActive(flags: CapabilityPresetFlags): boolean {
|
||||
return flags.freeOnly === true || flags.toolsOnly === true || flags.visionOnly === true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Narrow a raw pool to the entries that pass the presets. The showcase
|
||||
* and the recent picks rank this narrowed pool instead of ranking
|
||||
* everything and letting the preset empty the pick. Neutral when no
|
||||
* preset is on, so the default view is unchanged without one.
|
||||
*/
|
||||
export function filterRawPoolByPreset(
|
||||
entries: readonly OmniRouteRawModelEntry[],
|
||||
enrichment: OmniRouteEnrichmentMap | undefined,
|
||||
canonicalToAlias: Map<string, string>,
|
||||
flags: CapabilityPresetFlags
|
||||
): OmniRouteRawModelEntry[] {
|
||||
if (!presetsActive(flags)) return [...entries];
|
||||
return entries.filter(
|
||||
(entry) =>
|
||||
entry.id &&
|
||||
passesRawPreset(entry, lookupEnrichment(entry.id, enrichment, canonicalToAlias), flags)
|
||||
);
|
||||
}
|
||||
|
||||
interface ComboPresetStep {
|
||||
memberEntries: OmniRouteRawModelEntry[];
|
||||
deferred: boolean;
|
||||
failsPreset: boolean;
|
||||
countable: boolean;
|
||||
}
|
||||
|
||||
function readComboStepField(step: unknown, key: "kind" | "comboName" | "model"): unknown {
|
||||
return (step as Record<string, unknown> | null | undefined)?.[key];
|
||||
}
|
||||
|
||||
/**
|
||||
* Fold one combo step list into member entries plus the preset verdict.
|
||||
* A `combo-ref` step reads the child verdict from `presetByName` (kept
|
||||
* for dropped combos too): a ref to an unknown name stays deferred, a
|
||||
* ref to a dropped combo fails. Never looks up an enrichment row for
|
||||
* the synthesized `combo-ref:<name>` id (there is none). An unknown
|
||||
* model id fails under an active preset, stays neutral without one.
|
||||
*/
|
||||
export function foldComboPresetSteps(
|
||||
combo: OmniRouteRawCombo,
|
||||
rawModelById: ReadonlyMap<string, OmniRouteRawModelEntry>,
|
||||
resolvedByName: ReadonlyMap<string, LegacyModel>,
|
||||
presetByName: ReadonlyMap<string, boolean>,
|
||||
enrichment: OmniRouteEnrichmentMap | undefined,
|
||||
canonicalToAlias: Map<string, string>,
|
||||
flags: CapabilityPresetFlags
|
||||
): ComboPresetStep {
|
||||
const memberEntries: OmniRouteRawModelEntry[] = [];
|
||||
const active = presetsActive(flags);
|
||||
let deferred = false;
|
||||
let failsPreset = false;
|
||||
let countable = false;
|
||||
const memberSteps = Array.isArray(combo.models) ? combo.models : [];
|
||||
for (const step of memberSteps) {
|
||||
const kind = readComboStepField(step, "kind");
|
||||
if (kind === "combo-ref") {
|
||||
const comboName = readComboStepField(step, "comboName");
|
||||
if (typeof comboName !== "string" || comboName.length === 0) continue;
|
||||
if (active && presetByName.get(comboName) === false) {
|
||||
failsPreset = true;
|
||||
break;
|
||||
}
|
||||
const nested = resolvedByName.get(comboName);
|
||||
if (!nested) {
|
||||
deferred = true;
|
||||
break;
|
||||
}
|
||||
if (active) countable = true;
|
||||
memberEntries.push(synthesizeNestedMember(comboName, nested));
|
||||
continue;
|
||||
}
|
||||
const modelId = readComboStepField(step, "model");
|
||||
if (typeof modelId !== "string" || modelId.length === 0) continue;
|
||||
const member = rawModelById.get(modelId);
|
||||
if (!member) {
|
||||
if (active) failsPreset = true;
|
||||
continue;
|
||||
}
|
||||
if (active) {
|
||||
countable = true;
|
||||
if (
|
||||
!passesRawPreset(member, lookupEnrichment(member.id, enrichment, canonicalToAlias), flags)
|
||||
) {
|
||||
failsPreset = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
memberEntries.push(member);
|
||||
}
|
||||
return { memberEntries, deferred, failsPreset, countable };
|
||||
}
|
||||
|
||||
/**
|
||||
* Record the preset verdict of a resolved combo (published or dropped)
|
||||
* under its lookup name: `name` trimmed, else `id`. Under an active
|
||||
* preset a combo with no countable member never passes, so it is
|
||||
* dropped, never partial.
|
||||
*/
|
||||
export function recordComboPresetVerdict(
|
||||
presetByName: Map<string, boolean>,
|
||||
combo: OmniRouteRawCombo,
|
||||
failsPreset: boolean,
|
||||
countable: boolean,
|
||||
flags: CapabilityPresetFlags
|
||||
): boolean {
|
||||
const comboName =
|
||||
typeof combo.name === "string" && combo.name.trim().length > 0 ? combo.name.trim() : combo.id;
|
||||
const passes = !presetsActive(flags) || (failsPreset !== true && countable);
|
||||
presetByName.set(comboName, passes);
|
||||
return passes;
|
||||
}
|
||||
|
||||
/** Lookup name of a combo: `name` trimmed, else `id`. */
|
||||
export function comboLookupName(combo: OmniRouteRawCombo): string {
|
||||
return typeof combo.name === "string" && combo.name.trim().length > 0
|
||||
? combo.name.trim()
|
||||
: combo.id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Synthesize a raw-model entry from an already-resolved nested combo so a
|
||||
* parent combo's LCD folds the whole nested capability vector (context,
|
||||
* output, modalities, capabilities) instead of only direct raw members.
|
||||
* v1 parity (combo member synthesis at nested resolution time).
|
||||
*/
|
||||
export function synthesizeNestedMember(name: string, nested: LegacyModel): OmniRouteRawModelEntry {
|
||||
const inputModalities: string[] = [];
|
||||
if (nested.capabilities.input.text) inputModalities.push("text");
|
||||
if (nested.capabilities.input.audio) inputModalities.push("audio");
|
||||
if (nested.capabilities.input.image) inputModalities.push("image");
|
||||
if (nested.capabilities.input.video) inputModalities.push("video");
|
||||
if (nested.capabilities.input.pdf) inputModalities.push("pdf");
|
||||
const outputModalities: string[] = [];
|
||||
if (nested.capabilities.output.text) outputModalities.push("text");
|
||||
if (nested.capabilities.output.audio) outputModalities.push("audio");
|
||||
if (nested.capabilities.output.image) outputModalities.push("image");
|
||||
if (nested.capabilities.output.video) outputModalities.push("video");
|
||||
if (nested.capabilities.output.pdf) outputModalities.push("pdf");
|
||||
return {
|
||||
id: `combo-ref:${name}`,
|
||||
context_length: nested.limit.context,
|
||||
max_output_tokens: nested.limit.output,
|
||||
...(nested.limit.input !== undefined ? { max_input_tokens: nested.limit.input } : {}),
|
||||
owned_by: "combo",
|
||||
input_modalities: inputModalities,
|
||||
output_modalities: outputModalities,
|
||||
capabilities: {
|
||||
temperature: nested.capabilities.temperature,
|
||||
// A raw entry carries plain flags; the mapped model widens them to
|
||||
// `boolean | { field }` (custom reasoning/thinking field). Every
|
||||
// non-false form means the capability is present, which is all the
|
||||
// LCD fold reads.
|
||||
reasoning: nested.capabilities.reasoning !== false,
|
||||
thinking: nested.capabilities.interleaved !== false,
|
||||
attachment: nested.capabilities.attachment,
|
||||
tool_calling: nested.capabilities.toolcall,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,17 +1,22 @@
|
||||
import type { Model, Provider } from "@opencode/plugin";
|
||||
import {
|
||||
buildProviderResolve,
|
||||
compileProviderFilter,
|
||||
filterAllUnknown,
|
||||
passesProviderCombo,
|
||||
passesProviderFilter,
|
||||
warnNoVocabulary,
|
||||
warnUnknownProviders,
|
||||
resolveProviderFilter,
|
||||
warnProviderMatchedNothing,
|
||||
type ProviderFilter,
|
||||
type ProviderResolve,
|
||||
} from "./provider-filter.js";
|
||||
import type { LegacyModel } from "./legacy-model.js";
|
||||
import { type CapabilityPresetFlags, passesCapabilityPresets } from "./capability-presets.js";
|
||||
import {
|
||||
comboLookupName,
|
||||
filterRawPoolByPreset,
|
||||
foldComboPresetSteps,
|
||||
presetsActive,
|
||||
recordComboPresetVerdict,
|
||||
type CapabilityPresetFlags,
|
||||
passesCapabilityPresets,
|
||||
} from "./capability-presets.js";
|
||||
import {
|
||||
isHttpUrl,
|
||||
type ApiFormatV2,
|
||||
@@ -28,6 +33,7 @@ import {
|
||||
applyEnrichment,
|
||||
buildCanonicalToAliasMap,
|
||||
canonicalDedupSet,
|
||||
countFreeTierMatch,
|
||||
createLogger,
|
||||
defaultOmniRouteEnrichmentFetcher,
|
||||
defaultOmniRouteProvidersFetcher,
|
||||
@@ -428,54 +434,6 @@ export function legacyApiToInfoApi(api: LegacyModel["api"]): {
|
||||
return { id: api.id, type: "aisdk", package: api.npm, url: api.url };
|
||||
}
|
||||
|
||||
function legacyCostToInfoCost(cost: LegacyModel["cost"]): StableModelInfo["cost"] {
|
||||
const c = [{ input: cost.input, output: cost.output, cache: cost.cache }];
|
||||
return c as unknown as StableModelInfo["cost"];
|
||||
}
|
||||
|
||||
function legacyCapabilitiesToInfoCapabilities(
|
||||
caps: LegacyModel["capabilities"]
|
||||
): StableModelInfo["capabilities"] {
|
||||
const input: string[] = [];
|
||||
if (caps.input.text) input.push("text");
|
||||
if (caps.input.audio) input.push("audio");
|
||||
if (caps.input.image) input.push("image");
|
||||
if (caps.input.video) input.push("video");
|
||||
if (caps.input.pdf) input.push("pdf");
|
||||
const output: string[] = [];
|
||||
if (caps.output.text) output.push("text");
|
||||
if (caps.output.audio) output.push("audio");
|
||||
if (caps.output.image) output.push("image");
|
||||
if (caps.output.video) output.push("video");
|
||||
if (caps.output.pdf) output.push("pdf");
|
||||
return { tools: caps.toolcall, input, output };
|
||||
}
|
||||
|
||||
function legacyToInfo(providerID: string, modelID: string, m: LegacyModel): StableModelInfo {
|
||||
const variants = Object.entries(m.variants ?? {}).map(([id, body]) => ({
|
||||
id,
|
||||
headers: {},
|
||||
body: body as Record<string, unknown>,
|
||||
}));
|
||||
const parsed = Date.parse(m.release_date);
|
||||
const out = {
|
||||
id: modelID,
|
||||
modelID,
|
||||
providerID,
|
||||
...(m.family !== undefined ? { family: m.family } : {}),
|
||||
name: m.name,
|
||||
capabilities: legacyCapabilitiesToInfoCapabilities(m.capabilities),
|
||||
headers: { ...m.headers },
|
||||
variants,
|
||||
time: { released: Number.isNaN(parsed) ? 0 : parsed },
|
||||
cost: legacyCostToInfoCost(m.cost),
|
||||
status: m.status,
|
||||
enabled: true,
|
||||
limit: { ...m.limit },
|
||||
};
|
||||
return out as unknown as StableModelInfo;
|
||||
}
|
||||
|
||||
export interface PublishCounts {
|
||||
models: number;
|
||||
combos: number;
|
||||
@@ -563,19 +521,6 @@ export function assignProviderFields(
|
||||
}
|
||||
|
||||
/** A widened capability flag (`boolean | { field }`) read back as a plain flag. */
|
||||
function isCapabilityEnabled(value: boolean | { field: string }): boolean {
|
||||
return value !== false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Combo steps reach us from the gateway with a shape the SDK types do not
|
||||
* describe (`kind`, `comboName`, `model` appear per step kind). One reader
|
||||
* keeps that single untyped boundary in one place instead of scattering casts.
|
||||
*/
|
||||
function readStepField(step: unknown, key: "kind" | "comboName" | "model"): unknown {
|
||||
return (step as Record<string, unknown> | null | undefined)?.[key];
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve the display-name + pricing overlay. A caller may hand over a
|
||||
* ready-made map (tests, pre-resolved overlays) or turn the fetch off; a
|
||||
@@ -734,32 +679,26 @@ async function publishCombos(
|
||||
return true;
|
||||
});
|
||||
const resolvedByName = new Map<string, LegacyModel>();
|
||||
const presetByName = new Map<string, boolean>();
|
||||
const activeFlags: CapabilityPresetFlags = {
|
||||
freeOnly: opts.freeOnly,
|
||||
toolsOnly: opts.toolsOnly,
|
||||
visionOnly: opts.visionOnly,
|
||||
};
|
||||
let unresolved: typeof pending = [];
|
||||
|
||||
for (let pass = 0; pass < MAX_COMBO_PASSES && pending.length > 0; pass++) {
|
||||
const stillPending: typeof pending = [];
|
||||
for (const combo of pending) {
|
||||
const memberSteps = Array.isArray(combo.models) ? combo.models : [];
|
||||
const memberEntries: OmniRouteRawModelEntry[] = [];
|
||||
let deferred = false;
|
||||
for (const step of memberSteps) {
|
||||
const kind = readStepField(step, "kind");
|
||||
if (kind === "combo-ref") {
|
||||
const comboName = readStepField(step, "comboName");
|
||||
if (typeof comboName !== "string" || comboName.length === 0) continue;
|
||||
const nested = resolvedByName.get(comboName);
|
||||
if (!nested) {
|
||||
deferred = true;
|
||||
break;
|
||||
}
|
||||
memberEntries.push(synthesizeNestedMember(comboName, nested));
|
||||
continue;
|
||||
}
|
||||
const modelId = readStepField(step, "model");
|
||||
if (typeof modelId !== "string" || modelId.length === 0) continue;
|
||||
const member = rawModelById.get(modelId);
|
||||
if (member) memberEntries.push(member);
|
||||
}
|
||||
const { memberEntries, deferred, failsPreset, countable } = foldComboPresetSteps(
|
||||
combo,
|
||||
rawModelById,
|
||||
resolvedByName,
|
||||
presetByName,
|
||||
enrichment,
|
||||
canonicalToAlias,
|
||||
activeFlags
|
||||
);
|
||||
if (deferred) {
|
||||
stillPending.push(combo);
|
||||
continue;
|
||||
@@ -769,12 +708,22 @@ async function publishCombos(
|
||||
applyEnrichment(mapped, comboEnrichment, {
|
||||
isCombo: true,
|
||||
});
|
||||
const comboName = comboLookupName(combo);
|
||||
const passesMembers = recordComboPresetVerdict(
|
||||
presetByName,
|
||||
combo,
|
||||
failsPreset,
|
||||
countable,
|
||||
activeFlags
|
||||
);
|
||||
if (
|
||||
!passesCapabilityPresets(mapped, comboEnrichment, {
|
||||
freeOnly: opts.freeOnly,
|
||||
toolsOnly: opts.toolsOnly,
|
||||
visionOnly: opts.visionOnly,
|
||||
} satisfies CapabilityPresetFlags)
|
||||
presetsActive(activeFlags)
|
||||
? !passesMembers
|
||||
: !passesCapabilityPresets(mapped, comboEnrichment, {
|
||||
freeOnly: opts.freeOnly,
|
||||
toolsOnly: opts.toolsOnly,
|
||||
visionOnly: opts.visionOnly,
|
||||
} satisfies CapabilityPresetFlags)
|
||||
)
|
||||
continue;
|
||||
const mid = mapped.id.startsWith(X + "/") ? mapped.id.slice(X.length + 1) : mapped.id;
|
||||
@@ -806,11 +755,7 @@ async function publishCombos(
|
||||
publishedKeys.add(key);
|
||||
publishedModelIds.set(key, mapped.id);
|
||||
comboCount += 1;
|
||||
const lookupName =
|
||||
typeof combo.name === "string" && combo.name.trim().length > 0
|
||||
? combo.name.trim()
|
||||
: combo.id;
|
||||
if (!resolvedByName.has(lookupName)) resolvedByName.set(lookupName, mapped);
|
||||
if (!resolvedByName.has(comboName)) resolvedByName.set(comboName, mapped);
|
||||
}
|
||||
if (stillPending.length === pending.length) {
|
||||
unresolved = stillPending;
|
||||
@@ -829,47 +774,6 @@ async function publishCombos(
|
||||
return { published: comboCount, providerDropped };
|
||||
}
|
||||
|
||||
/**
|
||||
* Synthesize a raw-model entry from an already-resolved nested combo so a
|
||||
* parent combo's LCD folds the whole nested capability vector (context,
|
||||
* output, modalities, capabilities) instead of only direct raw members.
|
||||
* v1 parity (combo member synthesis at nested resolution time).
|
||||
*/
|
||||
function synthesizeNestedMember(name: string, nested: LegacyModel): OmniRouteRawModelEntry {
|
||||
const inputModalities: string[] = [];
|
||||
if (nested.capabilities.input.text) inputModalities.push("text");
|
||||
if (nested.capabilities.input.audio) inputModalities.push("audio");
|
||||
if (nested.capabilities.input.image) inputModalities.push("image");
|
||||
if (nested.capabilities.input.video) inputModalities.push("video");
|
||||
if (nested.capabilities.input.pdf) inputModalities.push("pdf");
|
||||
const outputModalities: string[] = [];
|
||||
if (nested.capabilities.output.text) outputModalities.push("text");
|
||||
if (nested.capabilities.output.audio) outputModalities.push("audio");
|
||||
if (nested.capabilities.output.image) outputModalities.push("image");
|
||||
if (nested.capabilities.output.video) outputModalities.push("video");
|
||||
if (nested.capabilities.output.pdf) outputModalities.push("pdf");
|
||||
return {
|
||||
id: `combo-ref:${name}`,
|
||||
context_length: nested.limit.context,
|
||||
max_output_tokens: nested.limit.output,
|
||||
...(nested.limit.input !== undefined ? { max_input_tokens: nested.limit.input } : {}),
|
||||
owned_by: "combo",
|
||||
input_modalities: inputModalities,
|
||||
output_modalities: outputModalities,
|
||||
capabilities: {
|
||||
temperature: nested.capabilities.temperature,
|
||||
// A raw entry carries plain flags; the mapped model widens them to
|
||||
// `boolean | { field }` (custom reasoning/thinking field). Every
|
||||
// non-false form means the capability is present, which is all the
|
||||
// LCD fold reads.
|
||||
reasoning: isCapabilityEnabled(nested.capabilities.reasoning),
|
||||
thinking: isCapabilityEnabled(nested.capabilities.interleaved),
|
||||
attachment: nested.capabilities.attachment,
|
||||
tool_calling: nested.capabilities.toolcall,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Collect the full catalog (models + combos) as legacy entries
|
||||
* keyed `providerId/bareId`, then project them onto the stable contract in
|
||||
@@ -919,18 +823,26 @@ export async function collectCatalog(
|
||||
// `freeOnly` reads the overlay: an empty overlay (no management token,
|
||||
// `enrichment: false`, or fetch failure) would otherwise empty the catalog
|
||||
// silently. Warn once per refresh and keep filtering (fail-closed).
|
||||
// A sparse overlay (free-tier lines that never meet a served id) warns
|
||||
// with its match ratio instead, so a short catalog names its cause.
|
||||
const {
|
||||
total: freeTotal,
|
||||
matched: freeMatched,
|
||||
unmatched: freeUnmatched,
|
||||
} = countFreeTierMatch(
|
||||
rawModels.map((e) => e.id),
|
||||
enrichment,
|
||||
canonicalToAlias
|
||||
);
|
||||
if (opts.freeOnly === true) {
|
||||
let hasFreeEntry = false;
|
||||
for (const entry of enrichment.values()) {
|
||||
if (entry.freeType !== undefined) {
|
||||
hasFreeEntry = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!hasFreeEntry) {
|
||||
if (freeTotal === 0) {
|
||||
log.warn(
|
||||
`[omniroute-v2] freeOnly is on but the enrichment overlay has no free-tier entries (no management token, enrichment disabled, or free-tier fetch failed); publishing an empty catalog. Disable freeOnly or configure the management token.`
|
||||
);
|
||||
} else if (freeUnmatched > 0) {
|
||||
log.warn(
|
||||
`[omniroute-v2] freeOnly dropped ${freeUnmatched} of ${freeTotal} free-tier lines: ${freeMatched}/${freeTotal} free-tier entries match the served catalog.`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -944,27 +856,16 @@ export async function collectCatalog(
|
||||
);
|
||||
|
||||
// Provider allowlist (same seam as the allowlists above, applied last):
|
||||
// compile once, resolve alias<->canonical once via the usable pass, then
|
||||
// one predicate per collection point. `buildCanonicalToAliasMap` returns
|
||||
// canonical->alias; the resolve table needs the inverse alias->canonical.
|
||||
// compiled once here, then one predicate per collection point.
|
||||
const warnedCombos = opts.collisionWarned ?? new Set<string>();
|
||||
const providerFilter = compileProviderFilter(opts.providersAllow);
|
||||
let providerResolve: ProviderResolve | undefined;
|
||||
let providerAllUnknown = false;
|
||||
if (providerFilter) {
|
||||
const pairs: Array<{ alias?: string; canonical?: string }> = [];
|
||||
for (const entry of enrichment.values()) {
|
||||
pairs.push({ alias: entry.providerAlias, canonical: entry.providerCanonical });
|
||||
}
|
||||
for (const [canonical, alias] of canonicalToAlias) {
|
||||
pairs.push({ alias, canonical });
|
||||
}
|
||||
providerResolve = buildProviderResolve(pairs, usable?.canonicals);
|
||||
providerAllUnknown = filterAllUnknown(providerFilter, providerResolve);
|
||||
if (providerResolve.known.size === 0)
|
||||
warnNoVocabulary(providerFilter, providerResolve.known, warnedCombos, log);
|
||||
else warnUnknownProviders(providerFilter, providerResolve.known, warnedCombos, log);
|
||||
}
|
||||
const { providerFilter, providerResolve, providerAllUnknown } = resolveProviderFilter(
|
||||
opts.providersAllow,
|
||||
enrichment,
|
||||
canonicalToAlias,
|
||||
usable?.canonicals,
|
||||
warnedCombos,
|
||||
log
|
||||
);
|
||||
|
||||
const rawModelById = new Map<string, OmniRouteRawModelEntry>();
|
||||
for (const entry of rawModels) {
|
||||
@@ -981,9 +882,17 @@ export async function collectCatalog(
|
||||
let providerDroppedCount = 0;
|
||||
// Showcase ranks the allowlisted pool so the default picker stays usable
|
||||
// without pinning plus the curated dates and pinned ids below.
|
||||
const presetFlags: CapabilityPresetFlags = {
|
||||
freeOnly: opts.freeOnly,
|
||||
toolsOnly: opts.toolsOnly,
|
||||
visionOnly: opts.visionOnly,
|
||||
};
|
||||
const presetPool = catalogAll
|
||||
? []
|
||||
: filterRawPoolByPreset(rawModels, enrichment, canonicalToAlias, presetFlags);
|
||||
const showcasePool = catalogAll
|
||||
? []
|
||||
: rawModels.filter(
|
||||
: presetPool.filter(
|
||||
(entry) =>
|
||||
entry.id &&
|
||||
!canonicalDedup.has(entry.id) &&
|
||||
@@ -1001,13 +910,19 @@ export async function collectCatalog(
|
||||
const freshKept = catalogAll
|
||||
? new Set<string>()
|
||||
: selectFreshKeptIds(
|
||||
rawModels,
|
||||
presetPool,
|
||||
opts.freshPerOwner ?? FRESH_PER_OWNER,
|
||||
nowMs,
|
||||
visibleFilter,
|
||||
windowMs
|
||||
);
|
||||
const staticallyDropped: OmniRouteRawModelEntry[] = [];
|
||||
// Stage counters for the refresh summary line. Frozen at the end of the
|
||||
// static pass, before the usage-memory restoration below: restored
|
||||
// entries rejoin `collected` (so `published` can exceed `afterPresets`),
|
||||
// and the summary keeps reading the filter stages, not the restore.
|
||||
let afterDefaultView = 0;
|
||||
let afterPresets = 0;
|
||||
for (const entry of rawModels) {
|
||||
if (!entry.id) continue;
|
||||
if (canonicalDedup.has(entry.id)) continue;
|
||||
@@ -1024,6 +939,7 @@ export async function collectCatalog(
|
||||
staticallyDropped.push(entry);
|
||||
continue;
|
||||
}
|
||||
afterDefaultView += 1;
|
||||
const mapped = mapRawModelToModelV2(entry, {
|
||||
providerId: X,
|
||||
baseURL: opts.baseURL,
|
||||
@@ -1041,6 +957,7 @@ export async function collectCatalog(
|
||||
} satisfies CapabilityPresetFlags)
|
||||
)
|
||||
continue;
|
||||
afterPresets += 1;
|
||||
const mid = mapped.id.startsWith(X + "/") ? mapped.id.slice(X.length + 1) : mapped.id;
|
||||
const key = X + "/" + mid;
|
||||
collected.set(key, mapped);
|
||||
@@ -1066,9 +983,18 @@ export async function collectCatalog(
|
||||
baseURL: opts.baseURL,
|
||||
apiFormat: opts.apiFormat,
|
||||
});
|
||||
applyEnrichment(mapped, lookupEnrichment(entry.id, enrichment, canonicalToAlias), {
|
||||
const restoreEnrichment = lookupEnrichment(entry.id, enrichment, canonicalToAlias);
|
||||
applyEnrichment(mapped, restoreEnrichment, {
|
||||
providerTag: opts.providerTag !== false,
|
||||
});
|
||||
if (
|
||||
!passesCapabilityPresets(mapped, restoreEnrichment, {
|
||||
freeOnly: opts.freeOnly,
|
||||
toolsOnly: opts.toolsOnly,
|
||||
visionOnly: opts.visionOnly,
|
||||
} satisfies CapabilityPresetFlags)
|
||||
)
|
||||
continue;
|
||||
const mid = mapped.id.startsWith(X + "/") ? mapped.id.slice(X.length + 1) : mapped.id;
|
||||
const key = X + "/" + mid;
|
||||
collected.set(key, mapped);
|
||||
@@ -1100,8 +1026,19 @@ export async function collectCatalog(
|
||||
warnedCombos,
|
||||
cacheKey,
|
||||
});
|
||||
if (comboResult === undefined)
|
||||
// One summary line per successful refresh: the stage counters plus the
|
||||
// free-tier lines the served catalog never reached. Audible at the
|
||||
// default `warn` level so a service install (stdout lost) still reads
|
||||
// the cause of a short catalog in the host log.
|
||||
const emitSummary = (published: number): void => {
|
||||
log.warn(
|
||||
`[omniroute-v2] catalog refresh: served=${rawModels.length} default=${afterDefaultView} presets=${afterPresets} published=${published} unmatched-free=${freeUnmatched}`
|
||||
);
|
||||
};
|
||||
if (comboResult === undefined) {
|
||||
emitSummary(collected.size);
|
||||
return { entries: collected, counts: { models: modelCount, combos: 0 } };
|
||||
}
|
||||
const comboCount = comboResult.published;
|
||||
providerDroppedCount += comboResult.providerDropped;
|
||||
|
||||
@@ -1114,26 +1051,13 @@ export async function collectCatalog(
|
||||
warnProviderMatchedNothing(providerFilter, warnedCombos, log);
|
||||
}
|
||||
|
||||
emitSummary(collected.size);
|
||||
return {
|
||||
entries: collected,
|
||||
counts: { models: modelCount, combos: comboCount },
|
||||
};
|
||||
}
|
||||
|
||||
function warnProviderMatchedNothing(
|
||||
providerFilter: ProviderFilter | undefined,
|
||||
warnedCombos: Set<string>,
|
||||
log: Logger
|
||||
): void {
|
||||
if (!providerFilter) return;
|
||||
const key = `provider-matched-nothing::${[...providerFilter.allow].sort().join(",")}`;
|
||||
if (warnedCombos.has(key)) return;
|
||||
warnedCombos.add(key);
|
||||
log.warn(
|
||||
`[omniroute-v2] providersAllow [${providerFilter.originals.join(", ")}] matched nothing, publishing empty catalog.`
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Project a collected catalog onto the stable contract: one provider `info`
|
||||
* plus one `Model.Info` per entry. The provider carries the endpoint and the
|
||||
|
||||
@@ -3,10 +3,12 @@ import {
|
||||
optionalTierFingerprint,
|
||||
catalogContentFingerprint,
|
||||
createLogger,
|
||||
setHostSink,
|
||||
defaultOmniRouteCombosFetcher,
|
||||
defaultOmniRouteEnrichmentFetcher,
|
||||
defaultOmniRouteModelsFetcher,
|
||||
defaultOmniRouteProvidersFetcher,
|
||||
type LogLevel,
|
||||
type OmniRouteEnrichmentMap,
|
||||
type OmniRouteProviderConnection,
|
||||
} from "./shared/index.js";
|
||||
@@ -72,6 +74,31 @@ export default Plugin.define({
|
||||
resolved.logger = log;
|
||||
resolved.logLevel = parsed.logLevel;
|
||||
resolved.startupDebug = parsed.startupDebug;
|
||||
// Forward plugin lines to the host log when the host exposes one, so a
|
||||
// service install (stdout lost) still records warnings. Defensive at
|
||||
// every level: without it the console output above stays the only copy.
|
||||
try {
|
||||
const maybeClient = (ctx as { client?: unknown }).client as
|
||||
{ app?: { log?: unknown } } | undefined;
|
||||
const appLog = maybeClient?.app?.log;
|
||||
if (typeof appLog === "function") {
|
||||
const hostLog = appLog as (input: {
|
||||
body: { service: string; level: LogLevel; message: string };
|
||||
}) => unknown;
|
||||
setHostSink((level, message) => {
|
||||
const out = hostLog({
|
||||
body: { service: "[omniroute-plugin]", level, message },
|
||||
});
|
||||
return out;
|
||||
});
|
||||
}
|
||||
} catch (err) {
|
||||
// The probe itself threw (a throwing getter on the host object):
|
||||
// trace it on the console so a missed host log is never silent.
|
||||
console.warn(
|
||||
`[omniroute-plugin] [WARN] host log probe failed, keeping console output: ${err instanceof Error ? err.message : String(err)}`
|
||||
);
|
||||
}
|
||||
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,
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
*/
|
||||
|
||||
import type { OmniRouteRawCombo } from "./shared/combos-map.js";
|
||||
import type { OmniRouteEnrichmentMap } from "./shared/enrich.js";
|
||||
import type { Logger } from "./shared/logger.js";
|
||||
|
||||
/** Compiled allowlist. `undefined` means inactive (empty/absent = full catalog). */
|
||||
@@ -253,6 +254,44 @@ export function warnUnknownProviders(
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Provider-allowlist preamble: build the filter/resolve tables from the
|
||||
* same alias pairs the collection passes use, and warn on an active
|
||||
* filter with no vocabulary or unknown names. Returns the three values
|
||||
* both collection points read, so the preamble cannot drift from them.
|
||||
*/
|
||||
export function resolveProviderFilter(
|
||||
providersAllow: string[] | undefined,
|
||||
enrichment: OmniRouteEnrichmentMap,
|
||||
canonicalToAlias: ReadonlyMap<string, string>,
|
||||
usableCanonicals: Iterable<string> | undefined,
|
||||
warned: Set<string>,
|
||||
log: Pick<Logger, "warn">
|
||||
): {
|
||||
providerFilter: ProviderFilter | undefined;
|
||||
providerResolve: ProviderResolve | undefined;
|
||||
providerAllUnknown: boolean;
|
||||
} {
|
||||
const providerFilter = compileProviderFilter(providersAllow);
|
||||
let providerResolve: ProviderResolve | undefined;
|
||||
let providerAllUnknown = false;
|
||||
if (providerFilter) {
|
||||
const pairs: Array<{ alias?: string; canonical?: string }> = [];
|
||||
for (const entry of enrichment.values()) {
|
||||
pairs.push({ alias: entry.providerAlias, canonical: entry.providerCanonical });
|
||||
}
|
||||
for (const [canonical, alias] of canonicalToAlias) {
|
||||
pairs.push({ alias, canonical });
|
||||
}
|
||||
providerResolve = buildProviderResolve(pairs, usableCanonicals);
|
||||
providerAllUnknown = filterAllUnknown(providerFilter, providerResolve);
|
||||
if (providerResolve.known.size === 0)
|
||||
warnNoVocabulary(providerFilter, providerResolve.known, warned, log);
|
||||
else warnUnknownProviders(providerFilter, providerResolve.known, warned, log);
|
||||
}
|
||||
return { providerFilter, providerResolve, providerAllUnknown };
|
||||
}
|
||||
|
||||
/** Warn once when the filter is active but no vocabulary exists. */
|
||||
export function warnNoVocabulary(
|
||||
filter: ProviderFilter | undefined,
|
||||
@@ -270,3 +309,18 @@ export function warnNoVocabulary(
|
||||
`keeping the full catalog.`
|
||||
);
|
||||
}
|
||||
|
||||
/** Warn once when the provider filter drops the whole catalog. */
|
||||
export function warnProviderMatchedNothing(
|
||||
filter: ProviderFilter | undefined,
|
||||
warned: Set<string>,
|
||||
log: Pick<Logger, "warn">
|
||||
): void {
|
||||
if (!filter) return;
|
||||
const key = `provider-matched-nothing::${[...filter.allow].sort().join(",")}`;
|
||||
if (warned.has(key)) return;
|
||||
warned.add(key);
|
||||
log.warn(
|
||||
`[omniroute-v2] providersAllow [${filter.originals.join(", ")}] matched nothing, publishing empty catalog.`
|
||||
);
|
||||
}
|
||||
|
||||
@@ -45,6 +45,36 @@ export interface OmniRouteEnrichmentEntry {
|
||||
/** Map keyed by full model id (possibly namespaced, e.g. `cc/claude-sonnet-4-6`). */
|
||||
export type OmniRouteEnrichmentMap = Map<string, OmniRouteEnrichmentEntry>;
|
||||
|
||||
/**
|
||||
* Free-tier match between the enrichment overlay and the served catalog:
|
||||
* how many overlay lines carry a `freeType`, and how many of them a served
|
||||
* id reaches through the alias-aware lookup the collection pass uses.
|
||||
*/
|
||||
export interface FreeTierMatch {
|
||||
total: number;
|
||||
matched: number;
|
||||
unmatched: number;
|
||||
}
|
||||
|
||||
export function countFreeTierMatch(
|
||||
servedIds: readonly string[],
|
||||
enrichment: OmniRouteEnrichmentMap | undefined,
|
||||
canonicalToAlias: ReadonlyMap<string, string>
|
||||
): FreeTierMatch {
|
||||
if (!enrichment) return { total: 0, matched: 0, unmatched: 0 };
|
||||
let total = 0;
|
||||
const matched = new Set<object>();
|
||||
for (const entry of enrichment.values()) {
|
||||
if (entry.freeType !== undefined) total += 1;
|
||||
}
|
||||
for (const id of servedIds) {
|
||||
if (typeof id !== "string" || id.length === 0) continue;
|
||||
const hit = lookupEnrichment(id, enrichment, canonicalToAlias);
|
||||
if (hit !== undefined && hit.freeType !== undefined) matched.add(hit);
|
||||
}
|
||||
return { total, matched: matched.size, unmatched: total - matched.size };
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse-index the enrichment map from `providerCanonical → providerAlias`.
|
||||
*
|
||||
@@ -94,7 +124,7 @@ export function buildCanonicalToAliasMap(
|
||||
export function lookupEnrichment(
|
||||
rawId: string,
|
||||
enrichment: OmniRouteEnrichmentMap | undefined,
|
||||
canonicalToAlias: Map<string, string>
|
||||
canonicalToAlias: ReadonlyMap<string, string>
|
||||
): OmniRouteEnrichmentEntry | undefined {
|
||||
if (!enrichment) return undefined;
|
||||
const direct = enrichment.get(rawId);
|
||||
@@ -483,30 +513,58 @@ export const defaultOmniRouteEnrichmentFetcher: OmniRouteEnrichmentFetcher = asy
|
||||
: Array.isArray(body)
|
||||
? (body as unknown[])
|
||||
: [];
|
||||
// Index namespaced keys by (canonical provider, model suffix) so a
|
||||
// free-tier line stamps every key its provider serves — alias and
|
||||
// canonical alike — instead of the first key found. Bare ids are
|
||||
// never indexed: only `alias + "/"`-prefixed keys qualify, and only
|
||||
// by exact match on both levels at stamp time. Local to this
|
||||
// refresh; nothing survives the call.
|
||||
const canonicalAliasIndex = new Map<string, Map<string, string[]>>();
|
||||
for (const [key, entry] of out) {
|
||||
const alias = typeof entry.providerAlias === "string" ? entry.providerAlias : "";
|
||||
const canonical =
|
||||
typeof entry.providerCanonical === "string" ? entry.providerCanonical : "";
|
||||
if (alias.length === 0 || canonical.length === 0) continue;
|
||||
if (!key.startsWith(`${alias}/`)) continue;
|
||||
const suffix = key.slice(alias.length + 1);
|
||||
if (suffix.length === 0) continue;
|
||||
let byModel = canonicalAliasIndex.get(canonical);
|
||||
if (!byModel) {
|
||||
byModel = new Map<string, string[]>();
|
||||
canonicalAliasIndex.set(canonical, byModel);
|
||||
}
|
||||
const keys = byModel.get(suffix);
|
||||
if (keys) {
|
||||
if (!keys.includes(key)) keys.push(key);
|
||||
} else {
|
||||
byModel.set(suffix, [key]);
|
||||
}
|
||||
}
|
||||
for (const fm of perModel) {
|
||||
if (!fm || typeof fm !== "object") continue;
|
||||
const fmObj = fm as Record<string, unknown>;
|
||||
const provider = typeof fmObj.provider === "string" ? fmObj.provider : "";
|
||||
const modelId = typeof fmObj.modelId === "string" ? fmObj.modelId : "";
|
||||
const freeType = typeof fmObj.freeType === "string" ? fmObj.freeType : "";
|
||||
if (!modelId || !freeType) continue;
|
||||
if (!provider || !modelId || !freeType) continue;
|
||||
const monthlyTokens =
|
||||
typeof fmObj.monthlyTokens === "number" ? fmObj.monthlyTokens : undefined;
|
||||
const creditTokens =
|
||||
typeof fmObj.creditTokens === "number" ? fmObj.creditTokens : undefined;
|
||||
const displayName = typeof fmObj.displayName === "string" ? fmObj.displayName : "";
|
||||
const candidates = [
|
||||
`${provider}/${modelId}`,
|
||||
modelId,
|
||||
...(displayName ? [displayName] : []),
|
||||
];
|
||||
for (const key of candidates) {
|
||||
const entry = out.get(key);
|
||||
if (entry) {
|
||||
const stamped = out.get(`${provider}/${modelId}`);
|
||||
if (stamped) {
|
||||
stamped.freeType = freeType as FreeModelFreeType;
|
||||
if (monthlyTokens !== undefined) stamped.monthlyTokens = monthlyTokens;
|
||||
if (creditTokens !== undefined) stamped.creditTokens = creditTokens;
|
||||
}
|
||||
const namespacedByCanonical = canonicalAliasIndex.get(provider)?.get(modelId);
|
||||
if (namespacedByCanonical) {
|
||||
for (const key of namespacedByCanonical) {
|
||||
const entry = out.get(key);
|
||||
if (!entry || entry === stamped) continue;
|
||||
entry.freeType = freeType as FreeModelFreeType;
|
||||
if (monthlyTokens !== undefined) entry.monthlyTokens = monthlyTokens;
|
||||
if (creditTokens !== undefined) entry.creditTokens = creditTokens;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,9 @@
|
||||
|
||||
export type LogLevel = "error" | "warn" | "info" | "debug";
|
||||
|
||||
/** Synchronous host-log receiver: the host forwards plugin lines to its own log. */
|
||||
export type HostLogSink = (level: LogLevel, message: string) => unknown;
|
||||
|
||||
const LEVEL_ORDER: Record<LogLevel, number> = {
|
||||
error: 0,
|
||||
warn: 1,
|
||||
@@ -23,6 +26,12 @@ function shouldLog(current: LogLevel, target: LogLevel): boolean {
|
||||
|
||||
let _level: LogLevel = "warn";
|
||||
|
||||
/** Optional host-log receiver (module-global, same pattern as the log level). */
|
||||
let _hostSink: HostLogSink | undefined;
|
||||
|
||||
/** A host-log send already failed once in this process: stay on console only. */
|
||||
let _hostSinkFailed = false;
|
||||
|
||||
export function setLogLevel(level: LogLevel): void {
|
||||
_level = level;
|
||||
}
|
||||
@@ -31,40 +40,115 @@ export function getLogLevel(): LogLevel {
|
||||
return _level;
|
||||
}
|
||||
|
||||
/**
|
||||
* Point plugin log lines at the host log as well as the console. Pass
|
||||
* `undefined` to drop the receiver (and clear the send-once failure
|
||||
* marker so a later receiver starts clean).
|
||||
*/
|
||||
export function setHostSink(sink: HostLogSink | undefined): void {
|
||||
_hostSink = sink;
|
||||
if (sink === undefined) _hostSinkFailed = false;
|
||||
}
|
||||
|
||||
function fmt(level: LogLevel, msg: string, tag?: string): string {
|
||||
const prefix = tag ? `${TAG}${tag}` : TAG;
|
||||
return `${prefix} [${level.toUpperCase()}] ${msg}`;
|
||||
}
|
||||
|
||||
function emitHostSink(level: LogLevel, line: string): void {
|
||||
if (_hostSink === undefined || _hostSinkFailed) return;
|
||||
try {
|
||||
const sent = _hostSink(level, line);
|
||||
// A host client that answers asynchronously still reports delivery
|
||||
// failures: keep the once-only console trace for its rejection too.
|
||||
if (sent !== null && (typeof sent === "object" || typeof sent === "function")) {
|
||||
const then = (sent as { then?: unknown }).then;
|
||||
if (typeof then === "function") {
|
||||
(sent as Promise<unknown>).then(undefined, (err: unknown) => {
|
||||
if (_hostSinkFailed) return;
|
||||
_hostSinkFailed = true;
|
||||
console.warn(
|
||||
`${TAG} [WARN] host log sink failed, keeping console output: ${err instanceof Error ? err.message : String(err)}`
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
if (_hostSinkFailed) return;
|
||||
_hostSinkFailed = true;
|
||||
console.warn(
|
||||
`${TAG} [WARN] host log sink failed, keeping console output: ${err instanceof Error ? err.message : String(err)}`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function buildLogger(getLevel: () => LogLevel) {
|
||||
return {
|
||||
error(msg: string, ...args: unknown[]): void {
|
||||
if (shouldLog(getLevel(), "error")) console.error(fmt("error", msg), ...args);
|
||||
if (shouldLog(getLevel(), "error")) {
|
||||
const line = fmt("error", msg);
|
||||
console.error(line, ...args);
|
||||
emitHostSink("error", [line, ...args.map(String)].join(" "));
|
||||
}
|
||||
},
|
||||
warn(msg: string, ...args: unknown[]): void {
|
||||
if (shouldLog(getLevel(), "warn")) console.warn(fmt("warn", msg), ...args);
|
||||
if (shouldLog(getLevel(), "warn")) {
|
||||
const line = fmt("warn", msg);
|
||||
console.warn(line, ...args);
|
||||
emitHostSink("warn", [line, ...args.map(String)].join(" "));
|
||||
}
|
||||
},
|
||||
info(msg: string, ...args: unknown[]): void {
|
||||
if (shouldLog(getLevel(), "info")) console.warn(fmt("info", msg), ...args);
|
||||
if (shouldLog(getLevel(), "info")) {
|
||||
const line = fmt("info", msg);
|
||||
console.warn(line, ...args);
|
||||
emitHostSink("info", [line, ...args.map(String)].join(" "));
|
||||
}
|
||||
},
|
||||
debug(msg: string, ...args: unknown[]): void {
|
||||
if (shouldLog(getLevel(), "debug")) console.warn(fmt("debug", msg), ...args);
|
||||
if (shouldLog(getLevel(), "debug")) {
|
||||
const line = fmt("debug", msg);
|
||||
console.warn(line, ...args);
|
||||
emitHostSink("debug", [line, ...args.map(String)].join(" "));
|
||||
}
|
||||
},
|
||||
/** Always emit regardless of level (for critical init breadcrumbs). */
|
||||
always(msg: string, ...args: unknown[]): void {
|
||||
console.warn(TAG, msg, ...args);
|
||||
const line = `${TAG} ${msg}`;
|
||||
console.warn(line, ...args);
|
||||
emitHostSink("warn", [line, ...args.map(String)].join(" "));
|
||||
},
|
||||
|
||||
child(tag: string) {
|
||||
return {
|
||||
error: (msg: string, ...args: unknown[]) =>
|
||||
shouldLog(getLevel(), "error") && console.error(fmt("error", msg, tag), ...args),
|
||||
warn: (msg: string, ...args: unknown[]) =>
|
||||
shouldLog(getLevel(), "warn") && console.warn(fmt("warn", msg, tag), ...args),
|
||||
info: (msg: string, ...args: unknown[]) =>
|
||||
shouldLog(getLevel(), "info") && console.warn(fmt("info", msg, tag), ...args),
|
||||
debug: (msg: string, ...args: unknown[]) =>
|
||||
shouldLog(getLevel(), "debug") && console.warn(fmt("debug", msg, tag), ...args),
|
||||
error: (msg: string, ...args: unknown[]) => {
|
||||
if (shouldLog(getLevel(), "error")) {
|
||||
const line = fmt("error", msg, tag);
|
||||
console.error(line, ...args);
|
||||
emitHostSink("error", [line, ...args.map(String)].join(" "));
|
||||
}
|
||||
},
|
||||
warn: (msg: string, ...args: unknown[]) => {
|
||||
if (shouldLog(getLevel(), "warn")) {
|
||||
const line = fmt("warn", msg, tag);
|
||||
console.warn(line, ...args);
|
||||
emitHostSink("warn", [line, ...args.map(String)].join(" "));
|
||||
}
|
||||
},
|
||||
info: (msg: string, ...args: unknown[]) => {
|
||||
if (shouldLog(getLevel(), "info")) {
|
||||
const line = fmt("info", msg, tag);
|
||||
console.warn(line, ...args);
|
||||
emitHostSink("info", [line, ...args.map(String)].join(" "));
|
||||
}
|
||||
},
|
||||
debug: (msg: string, ...args: unknown[]) => {
|
||||
if (shouldLog(getLevel(), "debug")) {
|
||||
const line = fmt("debug", msg, tag);
|
||||
console.warn(line, ...args);
|
||||
emitHostSink("debug", [line, ...args.map(String)].join(" "));
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
@@ -43,10 +43,30 @@ export type FreeModelFreeType =
|
||||
| "recurring-daily"
|
||||
| "recurring-monthly"
|
||||
| "recurring-credit"
|
||||
| "recurring-uncapped"
|
||||
| "one-time-initial"
|
||||
| "keyless"
|
||||
| "discontinued";
|
||||
|
||||
/**
|
||||
* Free types the `freeOnly` preset admits. Single-use credits and
|
||||
* retired models stay visible without the preset but never pass it;
|
||||
* an unrecognised gateway value stays unpublished under the preset
|
||||
* until it is classified here.
|
||||
*/
|
||||
const FREE_ONLY_FREE_TYPES: ReadonlySet<string> = new Set([
|
||||
"recurring-daily",
|
||||
"recurring-monthly",
|
||||
"recurring-credit",
|
||||
"recurring-uncapped",
|
||||
"keyless",
|
||||
]);
|
||||
|
||||
/** Whether a free-tier entry counts as free under the `freeOnly` preset. */
|
||||
export function isFreeOnlyFreeType(freeType: unknown): boolean {
|
||||
return typeof freeType === "string" && FREE_ONLY_FREE_TYPES.has(freeType);
|
||||
}
|
||||
|
||||
// ── Provider Label ────────────────────────────────────────────────────────
|
||||
|
||||
/**
|
||||
@@ -139,12 +159,17 @@ function fmtTokens(n: number): string {
|
||||
/**
|
||||
* Format a free model budget into a short human-readable suffix.
|
||||
*
|
||||
* recurring-daily → "25M tokens/day"
|
||||
* recurring-monthly → "25M tokens/month"
|
||||
* recurring-credit → "10M credits"
|
||||
* one-time-initial → "1M credits (one-time)"
|
||||
* keyless → "(keyless)"
|
||||
* discontinued → "(discontinued)"
|
||||
* recurring-daily → "25M tokens/day"
|
||||
* recurring-monthly → "25M tokens/month"
|
||||
* recurring-credit → "10M credits"
|
||||
* recurring-uncapped → "(uncapped)"
|
||||
* one-time-initial → "1M credits (one-time)"
|
||||
* keyless → "(keyless)"
|
||||
* discontinued → "(discontinued)"
|
||||
* unknown future type → "(<type>)", never empty
|
||||
*
|
||||
* The uncapped label reuses the dashboard wording ("uncapped" in
|
||||
* `FreeBudgetCard.tsx:133`), parenthesised like the other cap-less labels.
|
||||
*/
|
||||
export function formatFreeBudget(params: {
|
||||
freeType: FreeModelFreeType;
|
||||
@@ -160,6 +185,8 @@ export function formatFreeBudget(params: {
|
||||
return `${fmtTokens(monthlyTokens)} tokens/month`;
|
||||
case "recurring-credit":
|
||||
return `${fmtTokens(creditTokens)} credits`;
|
||||
case "recurring-uncapped":
|
||||
return "(uncapped)";
|
||||
case "one-time-initial":
|
||||
return `${fmtTokens(creditTokens)} credits (one-time)`;
|
||||
case "keyless":
|
||||
@@ -167,7 +194,7 @@ export function formatFreeBudget(params: {
|
||||
case "discontinued":
|
||||
return "(discontinued)";
|
||||
default:
|
||||
return "";
|
||||
return `(${String(freeType)})`;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
464
@omniroute/opencode-plugin-v2/tests/catalog-presets-pool.test.ts
Normal file
464
@omniroute/opencode-plugin-v2/tests/catalog-presets-pool.test.ts
Normal file
@@ -0,0 +1,464 @@
|
||||
import { describe, it } from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import { collectCatalog, publishCatalog } from "../src/catalog.js";
|
||||
|
||||
type BetaDraft = {
|
||||
provider: {
|
||||
list?: () => unknown[];
|
||||
get?: (id: string) => unknown;
|
||||
update: (id: string, fn: (p: Record<string, any>) => void) => void;
|
||||
remove?: () => void;
|
||||
};
|
||||
model: {
|
||||
get?: (...a: string[]) => unknown;
|
||||
update: (pid: string, mid: string, fn: (m: Record<string, any>) => void) => void;
|
||||
remove?: () => void;
|
||||
default?: { get: () => undefined; set: () => void };
|
||||
};
|
||||
};
|
||||
|
||||
function fakeDraft(): {
|
||||
providers: Map<string, Record<string, any>>;
|
||||
models: Map<string, Record<string, any>>;
|
||||
provider: BetaDraft["provider"];
|
||||
model: BetaDraft["model"];
|
||||
} {
|
||||
const providers = new Map<string, Record<string, any>>();
|
||||
const models = new Map<string, Record<string, any>>();
|
||||
return {
|
||||
providers,
|
||||
models,
|
||||
provider: {
|
||||
list: () => [],
|
||||
get: (id: string) => providers.get(id) as never,
|
||||
update: (id: string, fn: (p: Record<string, any>) => void) => {
|
||||
const p = (providers.get(id) ?? { id }) as Record<string, any>;
|
||||
fn(p);
|
||||
providers.set(id, p);
|
||||
},
|
||||
remove: () => {},
|
||||
},
|
||||
model: {
|
||||
get: () => undefined,
|
||||
update: (pid: string, mid: string, fn: (m: Record<string, any>) => void) => {
|
||||
const k = pid + "/" + mid;
|
||||
const m = (models.get(k) ?? { id: mid, providerID: pid }) as Record<string, any>;
|
||||
fn(m);
|
||||
models.set(k, m);
|
||||
},
|
||||
remove: () => {},
|
||||
default: { get: () => undefined, set: () => {} },
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
const baseOpts = {
|
||||
providerId: "omniroute",
|
||||
baseURL: "https://gw.example.com",
|
||||
apiKey: "k",
|
||||
timeoutMs: 1000,
|
||||
modelCacheTtlMs: 300000,
|
||||
usableOnly: false,
|
||||
};
|
||||
|
||||
const FIXED_NOW = Date.parse("2026-10-03T12:00:00.000Z");
|
||||
|
||||
async function withFixedNow<T>(fn: () => Promise<T>): Promise<T> {
|
||||
const realNow = Date.now;
|
||||
Date.now = () => FIXED_NOW;
|
||||
try {
|
||||
return await fn();
|
||||
} finally {
|
||||
Date.now = realNow;
|
||||
}
|
||||
}
|
||||
|
||||
function captureWarns(): { warns: string[]; restore: () => void } {
|
||||
const warns: string[] = [];
|
||||
const origWarn = console.warn;
|
||||
console.warn = (...args: unknown[]) => {
|
||||
warns.push(String(args[0]));
|
||||
};
|
||||
return {
|
||||
warns,
|
||||
restore() {
|
||||
console.warn = origWarn;
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
function freeOverlay(ids: string[]): Map<string, { freeType: "recurring-monthly" }> {
|
||||
return new Map(ids.map((id) => [id, { freeType: "recurring-monthly" as const }]));
|
||||
}
|
||||
|
||||
describe("capability presets pick from the whole catalog", () => {
|
||||
it("freeOnly publishes the two free entries of a thirty-model provider, not the ten newest emptied", async () => {
|
||||
const draft = fakeDraft();
|
||||
const ids = Array.from({ length: 30 }, (_v, i) => `ac/m${i}`);
|
||||
const res = await publishCatalog(
|
||||
draft,
|
||||
{ ...baseOpts, freeOnly: true },
|
||||
{
|
||||
fetcher: async () => ids.map((id, i) => ({ id, owned_by: "ac", context_length: 1000 + i })),
|
||||
enrichmentFetcher: async () => freeOverlay(["ac/m0", "ac/m1"]),
|
||||
combosFetcher: async () => [],
|
||||
}
|
||||
);
|
||||
assert.equal(res.models, 2);
|
||||
assert.ok(draft.models.has("omniroute/ac/m0"));
|
||||
assert.ok(draft.models.has("omniroute/ac/m1"));
|
||||
assert.ok(!draft.models.has("omniroute/ac/m29"));
|
||||
});
|
||||
|
||||
it("without a preset the same provider keeps the ten newest entries", async () => {
|
||||
const draft = fakeDraft();
|
||||
const ids = Array.from({ length: 30 }, (_v, i) => `ac/m${i}`);
|
||||
const res = await publishCatalog(
|
||||
draft,
|
||||
{ ...baseOpts },
|
||||
{
|
||||
fetcher: async () => ids.map((id, i) => ({ id, owned_by: "ac", context_length: 1000 + i })),
|
||||
enrichmentFetcher: async () => new Map(),
|
||||
combosFetcher: async () => [],
|
||||
}
|
||||
);
|
||||
assert.equal(res.models, 10);
|
||||
assert.ok(draft.models.has("omniroute/ac/m29"));
|
||||
assert.ok(!draft.models.has("omniroute/ac/m0"));
|
||||
});
|
||||
|
||||
it("toolsOnly replaces the entries without tool calls in the showcase and in the recent picks", async () => {
|
||||
// Showcase path: stale entries, rank by context length.
|
||||
{
|
||||
const draft = fakeDraft();
|
||||
const res = await publishCatalog(
|
||||
draft,
|
||||
{ ...baseOpts, toolsOnly: true },
|
||||
{
|
||||
fetcher: async () =>
|
||||
Array.from({ length: 30 }, (_v, i) => ({
|
||||
id: `tl/m${i}`,
|
||||
owned_by: "tl",
|
||||
context_length: 1000 + i,
|
||||
...(["tl/m27", "tl/m28", "tl/m29"].includes(`tl/m${i}`)
|
||||
? {}
|
||||
: { capabilities: { tool_calling: true } }),
|
||||
})),
|
||||
enrichmentFetcher: async () => new Map(),
|
||||
combosFetcher: async () => [],
|
||||
}
|
||||
);
|
||||
assert.equal(res.models, 10);
|
||||
assert.ok(!draft.models.has("omniroute/tl/m27"));
|
||||
assert.ok(!draft.models.has("omniroute/tl/m28"));
|
||||
assert.ok(!draft.models.has("omniroute/tl/m29"));
|
||||
assert.ok(draft.models.has("omniroute/tl/m17"));
|
||||
}
|
||||
// Recent path: fresh entries, the fresh cap ranks the same way.
|
||||
await withFixedNow(async () => {
|
||||
const draft = fakeDraft();
|
||||
const dayMs = 24 * 3600 * 1000;
|
||||
const res = await publishCatalog(
|
||||
draft,
|
||||
{ ...baseOpts, toolsOnly: true },
|
||||
{
|
||||
fetcher: async () =>
|
||||
Array.from({ length: 13 }, (_v, i) => ({
|
||||
id: `tb${i}`,
|
||||
owned_by: "toolbox",
|
||||
context_length: 1000,
|
||||
release_date: new Date(FIXED_NOW - i * dayMs).toISOString(),
|
||||
...(i < 3 ? {} : { capabilities: { tool_calling: true } }),
|
||||
})),
|
||||
enrichmentFetcher: async () => new Map(),
|
||||
combosFetcher: async () => [],
|
||||
}
|
||||
);
|
||||
assert.equal(res.models, 10);
|
||||
assert.ok(!draft.models.has("omniroute/tb0"));
|
||||
assert.ok(!draft.models.has("omniroute/tb1"));
|
||||
assert.ok(!draft.models.has("omniroute/tb2"));
|
||||
assert.ok(draft.models.has("omniroute/tb12"));
|
||||
});
|
||||
});
|
||||
|
||||
it('visibleModels ["*"] keeps the full-loop behaviour under freeOnly', async () => {
|
||||
const draft = fakeDraft();
|
||||
const res = await publishCatalog(
|
||||
draft,
|
||||
{ ...baseOpts, freeOnly: true, visibleModels: ["*"] },
|
||||
{
|
||||
fetcher: async () => [{ id: "v0" }, { id: "v1" }, { id: "v2" }, { id: "v3" }, { id: "v4" }],
|
||||
enrichmentFetcher: async () => freeOverlay(["v0", "v1", "v2"]),
|
||||
combosFetcher: async () => [],
|
||||
}
|
||||
);
|
||||
assert.equal(res.models, 3);
|
||||
assert.ok(draft.models.has("omniroute/v0"));
|
||||
assert.ok(!draft.models.has("omniroute/v3"));
|
||||
});
|
||||
|
||||
it("freeOnly publishes a combo whose three members are free", async () => {
|
||||
const draft = fakeDraft();
|
||||
const res = await publishCatalog(
|
||||
draft,
|
||||
{ ...baseOpts, freeOnly: true },
|
||||
{
|
||||
fetcher: async () => [{ id: "k1" }, { id: "k2" }, { id: "k3" }],
|
||||
enrichmentFetcher: async () => freeOverlay(["k1", "k2", "k3"]),
|
||||
combosFetcher: async () => [
|
||||
{
|
||||
id: "trio",
|
||||
name: "Trio",
|
||||
models: [
|
||||
{ kind: "model", model: "k1" } as never,
|
||||
{ kind: "model", model: "k2" } as never,
|
||||
{ kind: "model", model: "k3" } as never,
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
);
|
||||
assert.equal(res.combos, 1);
|
||||
assert.ok(draft.models.has("omniroute/Trio"));
|
||||
});
|
||||
|
||||
it("freeOnly drops a combo with a paid member and keeps the all-free one", async () => {
|
||||
const draft = fakeDraft();
|
||||
const res = await publishCatalog(
|
||||
draft,
|
||||
{ ...baseOpts, freeOnly: true },
|
||||
{
|
||||
fetcher: async () => [{ id: "g1" }, { id: "g2" }, { id: "g3" }, { id: "p1" }],
|
||||
enrichmentFetcher: async () => freeOverlay(["g1", "g2", "g3"]),
|
||||
combosFetcher: async () => [
|
||||
{
|
||||
id: "trio",
|
||||
name: "GoodTrio",
|
||||
models: [
|
||||
{ kind: "model", model: "g1" } as never,
|
||||
{ kind: "model", model: "g2" } as never,
|
||||
{ kind: "model", model: "g3" } as never,
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "mixed",
|
||||
name: "Mixed",
|
||||
models: [
|
||||
{ kind: "model", model: "g1" } as never,
|
||||
{ kind: "model", model: "p1" } as never,
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
);
|
||||
assert.equal(res.combos, 1);
|
||||
assert.ok(draft.models.has("omniroute/GoodTrio"));
|
||||
assert.ok(!draft.models.has("omniroute/Mixed"));
|
||||
});
|
||||
|
||||
it("freeOnly drops a combo without members and keeps the all-free one", async () => {
|
||||
const draft = fakeDraft();
|
||||
const res = await publishCatalog(
|
||||
draft,
|
||||
{ ...baseOpts, freeOnly: true },
|
||||
{
|
||||
fetcher: async () => [{ id: "g1" }, { id: "g2" }, { id: "g3" }],
|
||||
enrichmentFetcher: async () => freeOverlay(["g1", "g2", "g3"]),
|
||||
combosFetcher: async () => [
|
||||
{
|
||||
id: "trio",
|
||||
name: "GoodTrio",
|
||||
models: [
|
||||
{ kind: "model", model: "g1" } as never,
|
||||
{ kind: "model", model: "g2" } as never,
|
||||
{ kind: "model", model: "g3" } as never,
|
||||
],
|
||||
},
|
||||
{ id: "empty", name: "Empty", models: [] },
|
||||
],
|
||||
}
|
||||
);
|
||||
assert.equal(res.combos, 1);
|
||||
assert.ok(draft.models.has("omniroute/GoodTrio"));
|
||||
assert.ok(!draft.models.has("omniroute/Empty"));
|
||||
});
|
||||
|
||||
it("freeOnly publishes a combo over a free combo and the free combo itself", async () => {
|
||||
const draft = fakeDraft();
|
||||
const res = await publishCatalog(
|
||||
draft,
|
||||
{ ...baseOpts, freeOnly: true },
|
||||
{
|
||||
fetcher: async () => [{ id: "c1" }],
|
||||
enrichmentFetcher: async () => freeOverlay(["c1"]),
|
||||
combosFetcher: async () => [
|
||||
{
|
||||
id: "parent",
|
||||
name: "Parent",
|
||||
models: [
|
||||
{ kind: "combo-ref", comboName: "Child" } as never,
|
||||
{ kind: "model", model: "c1" } as never,
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "child",
|
||||
name: "Child",
|
||||
models: [{ kind: "model", model: "c1" } as never],
|
||||
},
|
||||
],
|
||||
}
|
||||
);
|
||||
assert.equal(res.combos, 2);
|
||||
assert.ok(draft.models.has("omniroute/Child"));
|
||||
assert.ok(draft.models.has("omniroute/Parent"));
|
||||
});
|
||||
|
||||
it("freeOnly drops a combo over a dropped combo and warns on the never-resolving ref", async () => {
|
||||
const draft = fakeDraft();
|
||||
const { warns, restore } = captureWarns();
|
||||
try {
|
||||
const res = await publishCatalog(
|
||||
draft,
|
||||
{ ...baseOpts, freeOnly: true },
|
||||
{
|
||||
fetcher: async () => [{ id: "g1" }, { id: "g2" }, { id: "g3" }, { id: "p1" }],
|
||||
enrichmentFetcher: async () => freeOverlay(["g1", "g2", "g3"]),
|
||||
combosFetcher: async () => [
|
||||
{
|
||||
id: "trio",
|
||||
name: "GoodTrio",
|
||||
models: [
|
||||
{ kind: "model", model: "g1" } as never,
|
||||
{ kind: "model", model: "g2" } as never,
|
||||
{ kind: "model", model: "g3" } as never,
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "mixed",
|
||||
name: "Mixed",
|
||||
models: [
|
||||
{ kind: "model", model: "g1" } as never,
|
||||
{ kind: "model", model: "p1" } as never,
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "parent",
|
||||
name: "ParentOfDropped",
|
||||
models: [
|
||||
{ kind: "combo-ref", comboName: "Mixed" } as never,
|
||||
{ kind: "model", model: "g1" } as never,
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "orphan",
|
||||
name: "Orphan",
|
||||
models: [
|
||||
{ kind: "combo-ref", comboName: "Nobody" } as never,
|
||||
{ kind: "model", model: "g1" } as never,
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
);
|
||||
assert.equal(res.combos, 1);
|
||||
assert.ok(draft.models.has("omniroute/GoodTrio"));
|
||||
assert.ok(!draft.models.has("omniroute/ParentOfDropped"));
|
||||
assert.ok(!draft.models.has("omniroute/Orphan"));
|
||||
} finally {
|
||||
restore();
|
||||
}
|
||||
assert.ok(warns.some((w) => /could not resolve all nested combo-refs/.test(w)));
|
||||
});
|
||||
|
||||
it("freeOnly drops a combo with an unknown member and keeps the all-free one", async () => {
|
||||
const draft = fakeDraft();
|
||||
const res = await publishCatalog(
|
||||
draft,
|
||||
{ ...baseOpts, freeOnly: true },
|
||||
{
|
||||
fetcher: async () => [{ id: "g1" }, { id: "g2" }, { id: "g3" }],
|
||||
enrichmentFetcher: async () => freeOverlay(["g1", "g2", "g3"]),
|
||||
combosFetcher: async () => [
|
||||
{
|
||||
id: "trio",
|
||||
name: "GoodTrio",
|
||||
models: [
|
||||
{ kind: "model", model: "g1" } as never,
|
||||
{ kind: "model", model: "g2" } as never,
|
||||
{ kind: "model", model: "g3" } as never,
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "ghost",
|
||||
name: "Ghost",
|
||||
models: [
|
||||
{ kind: "model", model: "g1" } as never,
|
||||
{ kind: "model", model: "no-such-model" } as never,
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
);
|
||||
assert.equal(res.combos, 1);
|
||||
assert.ok(draft.models.has("omniroute/GoodTrio"));
|
||||
assert.ok(!draft.models.has("omniroute/Ghost"));
|
||||
});
|
||||
|
||||
it("without a preset every resolving combo publishes, dropped or unknown members included", async () => {
|
||||
const draft = fakeDraft();
|
||||
const res = await publishCatalog(
|
||||
draft,
|
||||
{ ...baseOpts },
|
||||
{
|
||||
fetcher: async () => [{ id: "g1" }, { id: "p1" }],
|
||||
enrichmentFetcher: async () => new Map(),
|
||||
combosFetcher: async () => [
|
||||
{
|
||||
id: "mixed",
|
||||
name: "Mixed",
|
||||
models: [
|
||||
{ kind: "model", model: "g1" } as never,
|
||||
{ kind: "model", model: "p1" } as never,
|
||||
],
|
||||
},
|
||||
{ id: "empty", name: "Empty", models: [] },
|
||||
{
|
||||
id: "ghost",
|
||||
name: "Ghost",
|
||||
models: [
|
||||
{ kind: "model", model: "g1" } as never,
|
||||
{ kind: "model", model: "no-such-model" } as never,
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
);
|
||||
assert.equal(res.combos, 3);
|
||||
assert.ok(draft.models.has("omniroute/Mixed"));
|
||||
assert.ok(draft.models.has("omniroute/Empty"));
|
||||
assert.ok(draft.models.has("omniroute/Ghost"));
|
||||
});
|
||||
|
||||
it("freeOnly does not restore a paid entry named by usage memory", async () => {
|
||||
const collected = await collectCatalog(
|
||||
{ ...baseOpts, freeOnly: true, managementReadToken: "m" },
|
||||
{
|
||||
fetcher: async () => [
|
||||
...Array.from({ length: 10 }, (_v, i) => ({
|
||||
id: `zzz/f${i}`,
|
||||
owned_by: "zzz",
|
||||
context_length: 100000 + i,
|
||||
})),
|
||||
{ id: "zzz/old-paid", owned_by: "zzz", context_length: 1000 },
|
||||
],
|
||||
enrichmentFetcher: async () => freeOverlay(["zzz/f0", "zzz/f1"]),
|
||||
combosFetcher: async () => [],
|
||||
usageFetcher: async () => ["zzz/old-paid"],
|
||||
}
|
||||
);
|
||||
assert.equal(collected.counts.models, 2);
|
||||
assert.ok(collected.entries.has("omniroute/zzz/f0"));
|
||||
assert.ok(!collected.entries.has("omniroute/zzz/old-paid"));
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,201 @@
|
||||
import { describe, it } from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import { publishCatalog } from "../src/catalog.js";
|
||||
|
||||
type Draft = {
|
||||
providers: Map<string, Record<string, any>>;
|
||||
models: Map<string, Record<string, any>>;
|
||||
provider: {
|
||||
update: (id: string, fn: (p: Record<string, any>) => void) => void;
|
||||
};
|
||||
model: {
|
||||
update: (pid: string, mid: string, fn: (m: Record<string, any>) => void) => void;
|
||||
};
|
||||
};
|
||||
|
||||
function draft(): Draft {
|
||||
const providers = new Map<string, Record<string, any>>();
|
||||
const models = new Map<string, Record<string, any>>();
|
||||
return {
|
||||
providers,
|
||||
models,
|
||||
provider: {
|
||||
update: (id: string, fn: (p: Record<string, any>) => void) => {
|
||||
const p = (providers.get(id) ?? { id }) as Record<string, any>;
|
||||
fn(p);
|
||||
providers.set(id, p);
|
||||
},
|
||||
},
|
||||
model: {
|
||||
update: (pid: string, mid: string, fn: (m: Record<string, any>) => void) => {
|
||||
const k = pid + "/" + mid;
|
||||
const m = (models.get(k) ?? { id: mid, providerID: pid }) as Record<string, any>;
|
||||
fn(m);
|
||||
models.set(k, m);
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
const baseOpts = {
|
||||
providerId: "omniroute",
|
||||
baseURL: "https://gw.example.com",
|
||||
apiKey: "k",
|
||||
timeoutMs: 1000,
|
||||
modelCacheTtlMs: 300000,
|
||||
usableOnly: false,
|
||||
// `visibleModels: ["*"]` skips the showcase/fresh narrowing so the stage
|
||||
// counters stay deterministic: every served id reaches the preset pass.
|
||||
visibleModels: ["*"],
|
||||
};
|
||||
|
||||
function captureWarns(): { warns: string[]; restore: () => void } {
|
||||
const warns: string[] = [];
|
||||
const origWarn = console.warn;
|
||||
console.warn = (...args: unknown[]) => {
|
||||
warns.push(String(args[0]));
|
||||
};
|
||||
return {
|
||||
warns,
|
||||
restore() {
|
||||
console.warn = origWarn;
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
function summaryOf(warns: string[]): string | undefined {
|
||||
return warns.find((w) => w.includes("catalog refresh:"));
|
||||
}
|
||||
|
||||
describe("catalog refresh summary", () => {
|
||||
it("normal refresh emits one summary line with the five counters", async () => {
|
||||
const d = draft();
|
||||
const { warns, restore } = captureWarns();
|
||||
try {
|
||||
const res = await publishCatalog(d, baseOpts, {
|
||||
fetcher: async () => [{ id: "m1" }, { id: "m2" }],
|
||||
enrichmentFetcher: async () => new Map(),
|
||||
combosFetcher: async () => [],
|
||||
});
|
||||
assert.deepEqual(res, { models: 2, combos: 0 });
|
||||
} finally {
|
||||
restore();
|
||||
}
|
||||
const summary = summaryOf(warns);
|
||||
assert.ok(summary, "expected a catalog refresh summary line");
|
||||
assert.match(summary, /served=2/);
|
||||
assert.match(summary, /default=2/);
|
||||
assert.match(summary, /presets=2/);
|
||||
assert.match(summary, /published=2/);
|
||||
assert.match(summary, /unmatched-free=0/);
|
||||
assert.equal(d.models.size, 2);
|
||||
});
|
||||
|
||||
it("freeOnly with 20 free-tier lines and 4 matched warns 4 of 20", async () => {
|
||||
const d = draft();
|
||||
const overlay = new Map<string, { freeType: "keyless" }>();
|
||||
for (const id of ["m1", "m2", "m3", "m4"]) overlay.set(id, { freeType: "keyless" });
|
||||
for (let i = 0; i < 16; i++) overlay.set(`other-${i}`, { freeType: "keyless" });
|
||||
const { warns, restore } = captureWarns();
|
||||
try {
|
||||
const res = await publishCatalog(
|
||||
d,
|
||||
{ ...baseOpts, freeOnly: true },
|
||||
{
|
||||
fetcher: async () => [{ id: "m1" }, { id: "m2" }, { id: "m3" }, { id: "m4" }],
|
||||
enrichmentFetcher: async () => overlay,
|
||||
combosFetcher: async () => [],
|
||||
}
|
||||
);
|
||||
assert.deepEqual(res, { models: 4, combos: 0 });
|
||||
} finally {
|
||||
restore();
|
||||
}
|
||||
const ratio = warns.find((w) => w.includes("free-tier entries match"));
|
||||
assert.ok(ratio, "expected a free-tier match ratio warning");
|
||||
assert.match(ratio, /4\/20/);
|
||||
const summary = summaryOf(warns);
|
||||
assert.ok(summary, "expected a catalog refresh summary line");
|
||||
assert.match(summary, /unmatched-free=16/);
|
||||
});
|
||||
|
||||
it("freeOnly with an empty overlay keeps the existing warning unchanged", async () => {
|
||||
const d = draft();
|
||||
const { warns, restore } = captureWarns();
|
||||
try {
|
||||
const res = await publishCatalog(
|
||||
d,
|
||||
{ ...baseOpts, freeOnly: true },
|
||||
{
|
||||
fetcher: async () => [{ id: "m1" }, { id: "m2" }],
|
||||
enrichmentFetcher: async () => new Map(),
|
||||
combosFetcher: async () => [],
|
||||
}
|
||||
);
|
||||
assert.deepEqual(res, { models: 0, combos: 0 });
|
||||
} finally {
|
||||
restore();
|
||||
}
|
||||
const existing = warns.find((w) => w.includes("no free-tier entries"));
|
||||
assert.ok(existing, "expected the existing empty-overlay warning");
|
||||
assert.match(existing, /freeOnly is on but the enrichment overlay has no free-tier entries/);
|
||||
assert.ok(
|
||||
!warns.some((w) => w.includes("free-tier entries match")),
|
||||
"no match ratio on an empty overlay"
|
||||
);
|
||||
});
|
||||
|
||||
it("freeOnly with every free-tier line matched stays silent", async () => {
|
||||
const d = draft();
|
||||
const { warns, restore } = captureWarns();
|
||||
try {
|
||||
const res = await publishCatalog(
|
||||
d,
|
||||
{ ...baseOpts, freeOnly: true },
|
||||
{
|
||||
fetcher: async () => [{ id: "m1" }, { id: "m2" }],
|
||||
enrichmentFetcher: async () =>
|
||||
new Map([
|
||||
["m1", { freeType: "keyless" as const }],
|
||||
["m2", { freeType: "keyless" as const }],
|
||||
]),
|
||||
combosFetcher: async () => [],
|
||||
}
|
||||
);
|
||||
assert.deepEqual(res, { models: 2, combos: 0 });
|
||||
} finally {
|
||||
restore();
|
||||
}
|
||||
assert.ok(
|
||||
!warns.some((w) => w.includes("free-tier")),
|
||||
"no free-tier warning when everything matches"
|
||||
);
|
||||
assert.ok(summaryOf(warns), "summary line still emitted");
|
||||
});
|
||||
|
||||
it("freeOnly off emits no free-tier warning", async () => {
|
||||
const d = draft();
|
||||
const { warns, restore } = captureWarns();
|
||||
try {
|
||||
const res = await publishCatalog(d, baseOpts, {
|
||||
fetcher: async () => [{ id: "m1" }],
|
||||
enrichmentFetcher: async () =>
|
||||
new Map([
|
||||
["m1", { freeType: "keyless" as const }],
|
||||
["other", { freeType: "keyless" as const }],
|
||||
]),
|
||||
combosFetcher: async () => [],
|
||||
});
|
||||
assert.deepEqual(res, { models: 1, combos: 0 });
|
||||
} finally {
|
||||
restore();
|
||||
}
|
||||
assert.ok(
|
||||
!warns.some((w) => w.includes("free-tier") || w.includes("freeOnly")),
|
||||
"no free-tier warning when freeOnly is off"
|
||||
);
|
||||
const summary = summaryOf(warns);
|
||||
assert.ok(summary, "summary line still emitted");
|
||||
assert.match(summary, /unmatched-free=1/);
|
||||
});
|
||||
});
|
||||
@@ -188,8 +188,12 @@ describe("catalog fail-open", () => {
|
||||
} finally {
|
||||
console.warn = origWarn;
|
||||
}
|
||||
assert.equal(warns.length, 1);
|
||||
assert.match(warns[0], /combos fetch failed/);
|
||||
assert.equal(warns.filter((w) => /combos fetch failed/.test(w)).length, 1);
|
||||
assert.match(
|
||||
warns.find((w) => /combos fetch failed/.test(w))!,
|
||||
/combos fetch failed/
|
||||
);
|
||||
assert.ok(warns.some((w) => /catalog refresh:/.test(w)));
|
||||
assert.ok(draft.models.has("omniroute/m1"));
|
||||
});
|
||||
|
||||
@@ -214,9 +218,12 @@ describe("catalog fail-open", () => {
|
||||
} finally {
|
||||
console.warn = origWarn;
|
||||
}
|
||||
assert.equal(warns.length, 1);
|
||||
assert.match(warns[0], /combos fetch failed/);
|
||||
assert.match(warns[0], /403/);
|
||||
assert.equal(warns.filter((w) => /combos fetch failed/.test(w)).length, 1);
|
||||
assert.match(
|
||||
warns.find((w) => /combos fetch failed/.test(w))!,
|
||||
/403/
|
||||
);
|
||||
assert.ok(warns.some((w) => /catalog refresh:/.test(w)));
|
||||
assert.ok(draft.models.has("omniroute/m1"));
|
||||
});
|
||||
|
||||
@@ -241,9 +248,12 @@ describe("catalog fail-open", () => {
|
||||
} finally {
|
||||
console.warn = origWarn;
|
||||
}
|
||||
assert.equal(warns.length, 1);
|
||||
assert.match(warns[0], /combos fetch failed/);
|
||||
assert.match(warns[0], /500/);
|
||||
assert.equal(warns.filter((w) => /combos fetch failed/.test(w)).length, 1);
|
||||
assert.match(
|
||||
warns.find((w) => /combos fetch failed/.test(w))!,
|
||||
/500/
|
||||
);
|
||||
assert.ok(warns.some((w) => /catalog refresh:/.test(w)));
|
||||
assert.ok(draft.models.has("omniroute/m1"));
|
||||
});
|
||||
|
||||
@@ -268,8 +278,12 @@ describe("catalog fail-open", () => {
|
||||
} finally {
|
||||
console.warn = origWarn;
|
||||
}
|
||||
assert.equal(warns.length, 1);
|
||||
assert.match(warns[0], /combos fetch failed/);
|
||||
assert.equal(warns.filter((w) => /combos fetch failed/.test(w)).length, 1);
|
||||
assert.match(
|
||||
warns.find((w) => /combos fetch failed/.test(w))!,
|
||||
/combos fetch failed/
|
||||
);
|
||||
assert.ok(warns.some((w) => /catalog refresh:/.test(w)));
|
||||
assert.ok(draft.models.has("omniroute/m1"));
|
||||
});
|
||||
});
|
||||
@@ -306,7 +320,10 @@ describe("catalog combo vs combo", () => {
|
||||
// Under name-based keying the combos publish at their own keys
|
||||
// (`omniroute/Dupe Combo` and `omniroute/Dupe Combo Again`) — they no
|
||||
// longer collide with the model `dupe` at `omniroute/dupe`.
|
||||
assert.equal(warns.length, 0);
|
||||
assert.deepEqual(
|
||||
warns.filter((w) => !/catalog refresh:/.test(w)),
|
||||
[]
|
||||
);
|
||||
const m = draft.models.get("omniroute/dupe");
|
||||
assert.ok(m, "raw model remains at its own key");
|
||||
assert.equal(m?.name, "dupe");
|
||||
@@ -345,14 +362,21 @@ describe("catalog model bare vs combo", () => {
|
||||
// Name-based keying: the combo advertises `Dupe Combo`, so it sits at
|
||||
// `omniroute/Dupe Combo` instead of collapsing onto the raw model's
|
||||
// `omniroute/dupe` key (the accidental-collision class the warn was
|
||||
// written for). Both entries publish, nothing warns.
|
||||
assert.equal(warns.length, 0);
|
||||
// written for). Both entries publish; only the refresh summary warns.
|
||||
assert.deepEqual(
|
||||
warns.filter((w) => !/catalog refresh:/.test(w)),
|
||||
[]
|
||||
);
|
||||
assert.ok(draft.models.get("omniroute/dupe"), "raw model keeps its id key");
|
||||
assert.ok(draft.models.get("omniroute/Dupe Combo"), "combo published under its name");
|
||||
});
|
||||
});
|
||||
|
||||
describe("catalog capability presets", () => {
|
||||
function freeOverlay(ids: string[]): Map<string, { freeType: "keyless" }> {
|
||||
return new Map(ids.map((id) => [id, { freeType: "keyless" as const }]));
|
||||
}
|
||||
|
||||
function captureWarns() {
|
||||
const warns: string[] = [];
|
||||
const origWarn = console.warn;
|
||||
@@ -402,8 +426,12 @@ describe("catalog capability presets", () => {
|
||||
} finally {
|
||||
restore();
|
||||
}
|
||||
assert.equal(warns.length, 1);
|
||||
assert.match(warns[0], /freeOnly.*enrichment|enrichment.*free/i);
|
||||
assert.equal(warns.filter((w) => /freeOnly.*enrichment|enrichment.*free/i.test(w)).length, 1);
|
||||
assert.match(
|
||||
warns.find((w) => /freeOnly.*enrichment|enrichment.*free/i.test(w))!,
|
||||
/freeOnly.*enrichment|enrichment.*free/i
|
||||
);
|
||||
assert.ok(warns.some((w) => /catalog refresh:/.test(w)));
|
||||
});
|
||||
|
||||
it("freeOnly with enrichment disabled publishes nothing", async () => {
|
||||
@@ -422,26 +450,38 @@ describe("catalog capability presets", () => {
|
||||
} finally {
|
||||
restore();
|
||||
}
|
||||
assert.equal(warns.length, 1);
|
||||
assert.match(warns[0], /freeOnly.*enrichment|enrichment.*free/i);
|
||||
assert.equal(warns.filter((w) => /freeOnly.*enrichment|enrichment.*free/i.test(w)).length, 1);
|
||||
assert.match(
|
||||
warns.find((w) => /freeOnly.*enrichment|enrichment.*free/i.test(w))!,
|
||||
/freeOnly.*enrichment|enrichment.*free/i
|
||||
);
|
||||
assert.ok(warns.some((w) => /catalog refresh:/.test(w)));
|
||||
});
|
||||
|
||||
it("freeOnly drops combos without an enrichment entry", async () => {
|
||||
it("freeOnly publishes a combo whose members are all free", async () => {
|
||||
const draft = fakeDraft();
|
||||
const res = await publishCatalog(
|
||||
draft,
|
||||
{ ...baseOpts, freeOnly: true },
|
||||
{
|
||||
fetcher: async () => [{ id: "m1" }],
|
||||
enrichmentFetcher: async () => new Map([["m1", { freeType: "keyless" as const }]]),
|
||||
fetcher: async () => [{ id: "m1" }, { id: "m2" }, { id: "m3" }],
|
||||
enrichmentFetcher: async () => freeOverlay(["m1", "m2", "m3"]),
|
||||
combosFetcher: async () => [
|
||||
{ id: "combo-a", name: "Combo A", models: [{ kind: "model", model: "m1" }] },
|
||||
{
|
||||
id: "combo-a",
|
||||
name: "Combo A",
|
||||
models: [
|
||||
{ kind: "model", model: "m1" } as never,
|
||||
{ kind: "model", model: "m2" } as never,
|
||||
{ kind: "model", model: "m3" } as never,
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
);
|
||||
assert.equal(res.models, 1);
|
||||
assert.equal(res.combos, 0);
|
||||
assert.ok(!draft.models.has("omniroute/Combo A"));
|
||||
assert.equal(res.models, 3);
|
||||
assert.equal(res.combos, 1);
|
||||
assert.ok(draft.models.has("omniroute/Combo A"));
|
||||
});
|
||||
|
||||
it("toolsOnly keeps only tool-calling models", async () => {
|
||||
@@ -605,6 +645,84 @@ describe("catalog capability presets", () => {
|
||||
assert.deepEqual(res, { models: 2, combos: 0 });
|
||||
});
|
||||
|
||||
it("freeOnly drops single-use and retired entries but keeps them without the flag", async () => {
|
||||
async function publishWith(freeOnly: boolean) {
|
||||
const draft = fakeDraft();
|
||||
const res = await publishCatalog(
|
||||
draft,
|
||||
{ ...baseOpts, freeOnly, visibleModels: ["*"] },
|
||||
{
|
||||
fetcher: async () => [{ id: "cf/one-time-m" }, { id: "cf/retired-m" }],
|
||||
enrichmentFetcher: async () =>
|
||||
new Map([
|
||||
["cf/one-time-m", { freeType: "one-time-initial" as const }],
|
||||
["cf/retired-m", { freeType: "discontinued" as const }],
|
||||
]),
|
||||
combosFetcher: async () => [],
|
||||
}
|
||||
);
|
||||
return { draft, res };
|
||||
}
|
||||
const filtered = await publishWith(true);
|
||||
assert.deepEqual(filtered.res, { models: 0, combos: 0 });
|
||||
const unfiltered = await publishWith(false);
|
||||
assert.equal(unfiltered.res.models, 2);
|
||||
assert.match(String(unfiltered.draft.models.get("omniroute/cf/one-time-m")?.name), /one-time/);
|
||||
assert.match(
|
||||
String(unfiltered.draft.models.get("omniroute/cf/retired-m")?.name),
|
||||
/discontinued/
|
||||
);
|
||||
});
|
||||
|
||||
it("freeOnly keeps uncapped entries with a non-empty budget", async () => {
|
||||
const draft = fakeDraft();
|
||||
const res = await publishCatalog(
|
||||
draft,
|
||||
{ ...baseOpts, freeOnly: true, visibleModels: ["*"] },
|
||||
{
|
||||
fetcher: async () => [{ id: "cf/open-m" }],
|
||||
enrichmentFetcher: async () =>
|
||||
new Map([["cf/open-m", { freeType: "recurring-uncapped" as const }]]) as never,
|
||||
combosFetcher: async () => [],
|
||||
}
|
||||
);
|
||||
assert.equal(res.models, 1);
|
||||
assert.match(String(draft.models.get("omniroute/cf/open-m")?.name), /uncapped/);
|
||||
});
|
||||
|
||||
it("freeOnly predicate admits recurring and keyless entries, refuses the rest", async () => {
|
||||
const { passesCapabilityPresets } = await import("../src/capability-presets.js");
|
||||
const { isFreeOnlyFreeType } = (await import("../src/shared/naming.js")) as unknown as {
|
||||
isFreeOnlyFreeType: (v: unknown) => boolean;
|
||||
};
|
||||
const admitted = [
|
||||
"recurring-daily",
|
||||
"recurring-monthly",
|
||||
"recurring-credit",
|
||||
"recurring-uncapped",
|
||||
"keyless",
|
||||
];
|
||||
for (const freeType of admitted) {
|
||||
assert.equal(isFreeOnlyFreeType(freeType), true);
|
||||
assert.equal(
|
||||
passesCapabilityPresets({} as never, { freeType: freeType as never }, { freeOnly: true }),
|
||||
true
|
||||
);
|
||||
}
|
||||
const refused: unknown[] = ["one-time-initial", "discontinued", "some-future-type", undefined];
|
||||
for (const freeType of refused) {
|
||||
assert.equal(isFreeOnlyFreeType(freeType), false);
|
||||
assert.equal(
|
||||
passesCapabilityPresets(
|
||||
{} as never,
|
||||
freeType === undefined ? undefined : ({ freeType: freeType as never } as never),
|
||||
{ freeOnly: true }
|
||||
),
|
||||
false
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
it("presets shrink a large stub catalog below threshold", async () => {
|
||||
const stubModels = async () =>
|
||||
Array.from({ length: 4000 }, (_, i) => ({
|
||||
|
||||
@@ -62,3 +62,31 @@ describe("the enrichment overlay reaches the picker", () => {
|
||||
assert.equal(m.cost.output, 15);
|
||||
});
|
||||
});
|
||||
|
||||
describe("free budget under alias and without cap", () => {
|
||||
it("renders the budget of an alias-served model", () => {
|
||||
const m = applyEnrichment(model("cf/@cf/meta/llama-3.3-70b-instruct-fp8-fast"), {
|
||||
name: "Llama 3.3 70B",
|
||||
providerDisplayName: "Cloudflare",
|
||||
providerAlias: "cf",
|
||||
freeType: "recurring-monthly" as const,
|
||||
monthlyTokens: 1_000_000,
|
||||
});
|
||||
assert.equal(m.name, "[Free] Cloudflare - Llama 3.3 70B · 1M tokens/month");
|
||||
});
|
||||
|
||||
it("renders the uncapped label with no counters", () => {
|
||||
const m = applyEnrichment(model("cf/open-m"), {
|
||||
name: "Open Model",
|
||||
providerDisplayName: "Cloudflare",
|
||||
providerAlias: "cf",
|
||||
freeType: "recurring-uncapped" as const,
|
||||
});
|
||||
assert.match(m.name, /\(uncapped\)/);
|
||||
});
|
||||
|
||||
it("renders nothing extra when the budget is unknown", () => {
|
||||
const m = applyEnrichment(model("cf/open-m"), { name: "Open Model" });
|
||||
assert.ok(!m.name.includes("·"));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -4,6 +4,7 @@ import {
|
||||
applyEnrichment,
|
||||
buildCanonicalToAliasMap,
|
||||
canonicalDedupSet,
|
||||
countFreeTierMatch,
|
||||
lookupEnrichment,
|
||||
type OmniRouteEnrichmentMap,
|
||||
} from "../src/shared/enrich.js";
|
||||
@@ -45,3 +46,26 @@ describe("canonicalDedupSet", () => {
|
||||
assert.ok(!drop.has("cc/model-x"));
|
||||
});
|
||||
});
|
||||
|
||||
describe("countFreeTierMatch", () => {
|
||||
it("counts free-tier lines the served ids reach", () => {
|
||||
const overlay: OmniRouteEnrichmentMap = new Map([
|
||||
["m1", { freeType: "keyless" as const }],
|
||||
["other", { freeType: "keyless" as const }],
|
||||
]);
|
||||
const match = countFreeTierMatch(["m1"], overlay, new Map());
|
||||
assert.deepEqual(match, { total: 2, matched: 1, unmatched: 1 });
|
||||
});
|
||||
|
||||
it("resolves matches through the alias fallback chain", () => {
|
||||
const overlay: OmniRouteEnrichmentMap = new Map([
|
||||
["cc/model-x", { freeType: "keyless" as const }],
|
||||
["other", { freeType: "keyless" as const }],
|
||||
]);
|
||||
const canonicalToAlias = buildCanonicalToAliasMap(
|
||||
new Map([["cc/model-x", { providerAlias: "cc", providerCanonical: "claude" }]])
|
||||
);
|
||||
const match = countFreeTierMatch(["claude/model-x"], overlay, canonicalToAlias);
|
||||
assert.deepEqual(match, { total: 2, matched: 1, unmatched: 1 });
|
||||
});
|
||||
});
|
||||
|
||||
@@ -123,3 +123,145 @@ describe("defaultOmniRouteEnrichmentFetcher", () => {
|
||||
assert.equal(map.size, 0);
|
||||
});
|
||||
});
|
||||
|
||||
describe("free-tier canonical fan-out", () => {
|
||||
const modelsBody = {
|
||||
cf: {
|
||||
id: "cloudflare-ai",
|
||||
alias: "cf",
|
||||
name: "Cloudflare",
|
||||
models: [{ id: "@cf/meta/llama-3.3-70b-instruct-fp8-fast", name: "Llama 3.3 70B" }],
|
||||
},
|
||||
};
|
||||
|
||||
function fetchFor(perModel: unknown[]): typeof fetch {
|
||||
return (async (url: unknown) => {
|
||||
const href = String(url);
|
||||
const body = href.endsWith("/api/pricing/models")
|
||||
? modelsBody
|
||||
: href.endsWith("/api/pricing")
|
||||
? {}
|
||||
: { perModel };
|
||||
return { ok: true, status: 200, statusText: "OK", json: async () => body };
|
||||
}) as unknown as typeof fetch;
|
||||
}
|
||||
|
||||
it("stamps the canonical freeType and budgets on every namespaced key of the provider", async () => {
|
||||
const origFetch = globalThis.fetch;
|
||||
globalThis.fetch = fetchFor([
|
||||
{
|
||||
provider: "cloudflare-ai",
|
||||
modelId: "@cf/meta/llama-3.3-70b-instruct-fp8-fast",
|
||||
freeType: "recurring-monthly",
|
||||
monthlyTokens: 1_000_000,
|
||||
creditTokens: 0,
|
||||
},
|
||||
]);
|
||||
try {
|
||||
const map = await defaultOmniRouteEnrichmentFetcher("https://gw.example.com", "k", 1000);
|
||||
const namespaced = map.get("cf/@cf/meta/llama-3.3-70b-instruct-fp8-fast");
|
||||
assert.equal(namespaced?.freeType, "recurring-monthly");
|
||||
assert.equal(namespaced?.monthlyTokens, 1_000_000);
|
||||
} finally {
|
||||
globalThis.fetch = origFetch;
|
||||
}
|
||||
});
|
||||
|
||||
it("stamps the alias-served key built from the canonical provider entry", async () => {
|
||||
const origFetch = globalThis.fetch;
|
||||
globalThis.fetch = fetchFor([
|
||||
{
|
||||
provider: "cloudflare-ai",
|
||||
modelId: "@cf/meta/llama-3.3-70b-instruct-fp8-fast",
|
||||
freeType: "recurring-monthly",
|
||||
monthlyTokens: 1_000_000,
|
||||
},
|
||||
]);
|
||||
try {
|
||||
const map = await defaultOmniRouteEnrichmentFetcher("https://gw.example.com", "k", 1000);
|
||||
assert.equal(
|
||||
map.get("cf/@cf/meta/llama-3.3-70b-instruct-fp8-fast")?.freeType,
|
||||
"recurring-monthly"
|
||||
);
|
||||
} finally {
|
||||
globalThis.fetch = origFetch;
|
||||
}
|
||||
});
|
||||
|
||||
it("leaves the homonym of another provider unstamped", async () => {
|
||||
const origFetch = globalThis.fetch;
|
||||
globalThis.fetch = (async (url: unknown) => {
|
||||
const href = String(url);
|
||||
const body = href.endsWith("/api/pricing/models")
|
||||
? {
|
||||
cf: {
|
||||
id: "cloudflare-ai",
|
||||
alias: "cf",
|
||||
name: "Cloudflare",
|
||||
models: [{ id: "shared-model", name: "Shared" }],
|
||||
},
|
||||
xx: {
|
||||
id: "other-provider",
|
||||
alias: "xx",
|
||||
name: "Other",
|
||||
models: [{ id: "shared-model", name: "Shared" }],
|
||||
},
|
||||
}
|
||||
: href.endsWith("/api/pricing")
|
||||
? {}
|
||||
: {
|
||||
perModel: [
|
||||
{ provider: "cloudflare-ai", modelId: "shared-model", freeType: "keyless" },
|
||||
],
|
||||
};
|
||||
return { ok: true, status: 200, statusText: "OK", json: async () => body };
|
||||
}) as unknown as typeof fetch;
|
||||
try {
|
||||
const map = await defaultOmniRouteEnrichmentFetcher("https://gw.example.com", "k", 1000);
|
||||
assert.equal(map.get("cf/shared-model")?.freeType, "keyless");
|
||||
assert.equal(map.get("xx/shared-model")?.freeType, undefined);
|
||||
assert.equal(map.get("shared-model")?.providerCanonical, "cloudflare-ai");
|
||||
} finally {
|
||||
globalThis.fetch = origFetch;
|
||||
}
|
||||
});
|
||||
|
||||
it("stamps once when alias equals canonical", async () => {
|
||||
const origFetch = globalThis.fetch;
|
||||
globalThis.fetch = (async (url: unknown) => {
|
||||
const href = String(url);
|
||||
const body = href.endsWith("/api/pricing/models")
|
||||
? {
|
||||
kiro: {
|
||||
id: "kiro",
|
||||
alias: "kiro",
|
||||
name: "Kiro",
|
||||
models: [{ id: "m1", name: "Model One" }],
|
||||
},
|
||||
}
|
||||
: href.endsWith("/api/pricing")
|
||||
? {}
|
||||
: { perModel: [{ provider: "kiro", modelId: "m1", freeType: "keyless" }] };
|
||||
return { ok: true, status: 200, statusText: "OK", json: async () => body };
|
||||
}) as unknown as typeof fetch;
|
||||
try {
|
||||
const map = await defaultOmniRouteEnrichmentFetcher("https://gw.example.com", "k", 1000);
|
||||
assert.equal(map.get("kiro/m1")?.freeType, "keyless");
|
||||
} finally {
|
||||
globalThis.fetch = origFetch;
|
||||
}
|
||||
});
|
||||
|
||||
it("ignores a free-tier line without provider", async () => {
|
||||
const origFetch = globalThis.fetch;
|
||||
globalThis.fetch = fetchFor([
|
||||
{ provider: "", modelId: "@cf/meta/llama-3.3-70b-instruct-fp8-fast", freeType: "keyless" },
|
||||
]);
|
||||
try {
|
||||
const map = await defaultOmniRouteEnrichmentFetcher("https://gw.example.com", "k", 1000);
|
||||
assert.equal(map.get("cf/@cf/meta/llama-3.3-70b-instruct-fp8-fast")?.freeType, undefined);
|
||||
} finally {
|
||||
globalThis.fetch = origFetch;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { describe, it } from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import { createLogger, getLogLevel } from "../src/shared/logger.js";
|
||||
import { createLogger, getLogLevel, setHostSink } from "../src/shared/logger.js";
|
||||
|
||||
function capture(): {
|
||||
warns: string[];
|
||||
@@ -127,4 +127,86 @@ describe("shared leveled logger (v1 parity)", () => {
|
||||
assert.equal(cap.warns.length, 1);
|
||||
assert.match(cap.warns[0], /breadcrumb/);
|
||||
});
|
||||
|
||||
it("host sink receives the line in addition to the console", () => {
|
||||
const log = createLogger("warn");
|
||||
const cap = capture();
|
||||
const seen: Array<{ level: string; message: string }> = [];
|
||||
setHostSink((level, message) => {
|
||||
seen.push({ level, message });
|
||||
});
|
||||
try {
|
||||
log.warn("hello sink");
|
||||
} finally {
|
||||
setHostSink(undefined);
|
||||
cap.restore();
|
||||
}
|
||||
assert.equal(cap.warns.length, 1);
|
||||
assert.equal(seen.length, 1);
|
||||
assert.equal(seen[0].level, "warn");
|
||||
assert.match(seen[0].message, /hello sink/);
|
||||
});
|
||||
|
||||
it("host sink respects the logger level", () => {
|
||||
const log = createLogger("error");
|
||||
const cap = capture();
|
||||
const seen: string[] = [];
|
||||
setHostSink((level, message) => {
|
||||
seen.push(`${level}:${message}`);
|
||||
});
|
||||
try {
|
||||
log.warn("suppressed");
|
||||
log.error("loud");
|
||||
} finally {
|
||||
setHostSink(undefined);
|
||||
cap.restore();
|
||||
}
|
||||
assert.deepEqual(seen.length, 1);
|
||||
assert.match(seen[0], /loud/);
|
||||
});
|
||||
|
||||
it("a throwing host sink traces once on the console then stays silent", () => {
|
||||
const log = createLogger("warn");
|
||||
const cap = capture();
|
||||
let calls = 0;
|
||||
setHostSink(() => {
|
||||
calls += 1;
|
||||
throw new Error("sink down");
|
||||
});
|
||||
try {
|
||||
log.warn("first");
|
||||
log.warn("second");
|
||||
} finally {
|
||||
setHostSink(undefined);
|
||||
cap.restore();
|
||||
}
|
||||
assert.equal(calls, 1);
|
||||
assert.equal(cap.warns.length, 3);
|
||||
assert.match(cap.warns[1], /host log sink failed/);
|
||||
});
|
||||
|
||||
it("resetting the sink clears the failure marker for the next receiver", () => {
|
||||
const log = createLogger("warn");
|
||||
const cap = capture();
|
||||
setHostSink(() => {
|
||||
throw new Error("sink down");
|
||||
});
|
||||
const seen: string[] = [];
|
||||
try {
|
||||
log.warn("first");
|
||||
} finally {
|
||||
setHostSink(undefined);
|
||||
}
|
||||
setHostSink((_level, message) => {
|
||||
seen.push(message);
|
||||
});
|
||||
try {
|
||||
log.warn("second");
|
||||
} finally {
|
||||
setHostSink(undefined);
|
||||
cap.restore();
|
||||
}
|
||||
assert.equal(seen.length, 1);
|
||||
assert.match(seen[0], /second/);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -49,11 +49,15 @@ test("formatFreeBudget: missing token/credit counts default to 0", () => {
|
||||
assert.equal(formatFreeBudget({ freeType: "recurring-daily" }), "0 tokens/day");
|
||||
});
|
||||
|
||||
test("formatFreeBudget: unrecognised freeType falls through to the default branch", () => {
|
||||
test("formatFreeBudget: unknown future value renders its own name, never empty", () => {
|
||||
// `freeType` is populated from catalog data at runtime, so a value the
|
||||
// build doesn't know about is reachable even though TypeScript treats the
|
||||
// `default:` arm as dead code for a well-typed caller.
|
||||
assert.equal(formatFreeBudget({ freeType: "some-future-type" as FreeModelFreeType }), "");
|
||||
// `default:` arm as dead code for a well-typed caller. The picker shows
|
||||
// the value itself instead of an empty suffix.
|
||||
assert.equal(
|
||||
formatFreeBudget({ freeType: "some-future-type" as FreeModelFreeType }),
|
||||
"(some-future-type)"
|
||||
);
|
||||
});
|
||||
|
||||
test("formatFreeBudget: sub-1K token count is not abbreviated", () => {
|
||||
@@ -73,3 +77,10 @@ test("formatFreeBudget: the 999_999 rounding wart is fixed — promotes to 1M",
|
||||
"1M tokens/day"
|
||||
);
|
||||
});
|
||||
|
||||
test("formatFreeBudget: uncapped budget has no counters, label only", () => {
|
||||
assert.equal(
|
||||
formatFreeBudget({ freeType: "recurring-uncapped" as FreeModelFreeType }),
|
||||
"(uncapped)"
|
||||
);
|
||||
});
|
||||
|
||||
@@ -318,7 +318,7 @@ src/ # TypeScript (.ts / .tsx)
|
||||
└── sse/ # SSE proxy pipeline
|
||||
|
||||
open-sse/ # @omniroute/open-sse workspace
|
||||
├── executors/ # 89 executor implementation modules
|
||||
├── executors/ # 150 executor modules (executor classes + per-provider helpers)
|
||||
├── handlers/ # 11 request handlers (chat, responses, embeddings, images, etc.)
|
||||
├── mcp-server/ # MCP server (110 unique tools, 3 transports, 33 scopes)
|
||||
├── services/ # 178 top-level services (combo, autoCombo, rateLimitManager, etc.)
|
||||
|
||||
@@ -388,11 +388,16 @@ RUN --mount=type=cache,id=s/92ca8a61-c1ba-421f-a389-d48ac7258c2d-apt-cache,targe
|
||||
# 2. `codex` / `claude-code` dev pre-releases (`@next`, dist-tags) mutate
|
||||
# API surface without notice; reproducible builds need a SHA-pinned dev
|
||||
# build, not the floating `@latest`.
|
||||
# `@qoder-ai/qodercli` (#9292): the Qoder PAT (`pt-*`) login path shells out to
|
||||
# this binary for WASM-signed Cosy auth; without it the executor's own
|
||||
# `cli_not_found` handling is correct but every PAT login fails with
|
||||
# `spawn qodercli ENOENT`. Same pinning rationale as the tools above.
|
||||
RUN --mount=type=cache,id=s/92ca8a61-c1ba-421f-a389-d48ac7258c2d-npm-cache,target=/root/.npm \
|
||||
npm install -g --no-audit --no-fund \
|
||||
@openai/codex@0.159.2 \
|
||||
@anthropic-ai/claude-code@2.1.260 \
|
||||
droid@0.212.0 \
|
||||
openclaw@2026.9.1
|
||||
openclaw@2026.9.1 \
|
||||
@qoder-ai/qodercli@1.1.63
|
||||
|
||||
USER node
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# ── Multi-stage Dockerfile for Native Bun Runtime (web-latest-bun) ───────────
|
||||
FROM oven/bun:1.4.2-slim AS base
|
||||
FROM oven/bun:1.4.3-slim AS base
|
||||
WORKDIR /app
|
||||
|
||||
RUN apt-get update \
|
||||
@@ -56,7 +56,7 @@ ENV NODE_ENV=production
|
||||
RUN bun run --quiet build
|
||||
|
||||
# ── Runner Base stage (100% Bun Native Production Runtime) ──────────────────
|
||||
FROM oven/bun:1.4.2-slim AS runner-base
|
||||
FROM oven/bun:1.4.3-slim AS runner-base
|
||||
|
||||
LABEL org.opencontainers.image.title="omniroute" \
|
||||
org.opencontainers.image.description="Unified AI proxy — route any LLM through one endpoint (Bun Native)" \
|
||||
|
||||
18
README.md
18
README.md
@@ -19,9 +19,9 @@
|
||||
|
||||
> **Bring your own provider accounts.** This is an estimated aggregate across separately eligible third-party free tiers, not a token grant from OmniRoute. Sign up, obtain credentials where required, and connect the providers you can use; each provider controls its limits, availability, and terms.
|
||||
>
|
||||
> Stacking free tiers by hand is painful — dozens of SDKs, dozens of rate limits, and no idea how much you actually have. OmniRoute catalogs **489 free-tier entries across 35 recurring pool keys** and computes the token headline from the **17 pools with a published positive monthly budget plus five per-model Groq caps**, deduplicated by shared pool. Quotas that only open after a regional identity check (today: ModelScope) are shown apart, +~6M behind regional identity verification, and never summed into the headline. The result stays visible on the dashboard (`/dashboard/free-tiers`).
|
||||
> Stacking free tiers by hand is painful — dozens of SDKs, dozens of rate limits, and no idea how much you actually have. OmniRoute catalogs **485 free-tier entries across 35 recurring pool keys** and computes the token headline from the **17 pools with a published positive monthly budget plus five per-model Groq caps**, deduplicated by shared pool. Quotas that only open after a regional identity check (today: ModelScope) are shown apart, +~6M behind regional identity verification, and never summed into the headline. The result stays visible on the dashboard (`/dashboard/free-tiers`).
|
||||
|
||||
<img src="./docs/diagrams/free-tier-budget.svg" width="100%" alt="OmniRoute free-tier budget card: ~1.62B free tokens per month steady, up to ~2.22B in the first month with signup credits, from 35 documented recurring pool keys covering 489 cataloged free-tier entries behind one endpoint. Honest pool-deduped math — each shared pool counted once, including 17 recurring pools with a published positive monthly token budget plus five per-model Groq caps; 13 providers are marked avoid in the terms-risk catalog so you decide. Budget bar includes Mistral 1B, Nara 210M, LLM7 150M, xKiro 150M, Groq 30M (five per-model caps) and smaller pools, plus first-month signup credits and permanently-free no-token-cap providers surfaced separately so they never inflate the headline. Live used/remaining on /dashboard/free-tiers."/>
|
||||
<img src="./docs/diagrams/free-tier-budget.svg" width="100%" alt="OmniRoute free-tier budget card: ~1.62B free tokens per month steady, up to ~2.22B in the first month with signup credits, from 35 documented recurring pool keys covering 485 cataloged free-tier entries behind one endpoint. Honest pool-deduped math — each shared pool counted once, including 17 recurring pools with a published positive monthly token budget plus five per-model Groq caps; 13 providers are marked avoid in the terms-risk catalog so you decide. Budget bar includes Mistral 1B, Nara 210M, LLM7 150M, xKiro 150M, Groq 30M (five per-model caps) and smaller pools, plus first-month signup credits and permanently-free no-token-cap providers surfaced separately so they never inflate the headline. Live used/remaining on /dashboard/free-tiers."/>
|
||||
|
||||
> Animated summary of the live `/dashboard/free-tiers` page. Full methodology (pool dedupe, credit tiers, provider terms): **[docs/reference/FREE_TIERS.md](docs/reference/FREE_TIERS.md)**.
|
||||
>
|
||||
@@ -94,7 +94,7 @@
|
||||
<td align="right"><b>🚀 Start</b></td>
|
||||
<td align="center"><a href="#-quick-start">🚀 Quick Start</a></td>
|
||||
<td align="center"><a href="#-more-install-methods--docker-source-pnpm-arch">📦 Install</a></td>
|
||||
<td align="center"><a href="#-works-the-second-you-install-it--no-keys-no-config">🆓 Zero-config</a></td>
|
||||
<td align="center"><a href="#first-run">🆓 Connect a provider</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right"><b>💡 Learn</b></td>
|
||||
@@ -213,6 +213,8 @@
|
||||
|
||||
<div align="center">
|
||||
|
||||
<a id="first-run"></a>
|
||||
|
||||
## 🆓 Install, connect a provider, then route through one endpoint
|
||||
|
||||
</div>
|
||||
@@ -239,7 +241,7 @@ curl http://localhost:20128/v1/chat/completions \
|
||||
|
||||
</div>
|
||||
|
||||
<img src="./docs/diagrams/promise-pillars.svg" width="100%" alt="The Promise — One endpoint and 372 providers. Automatic fallback keeps routing while another healthy target is available. Six pillars: resilient fallback across 372 providers · up to 95% token savings on eligible workloads · $0 to start with 150+ free tiers and 54 recurring/keyless free-forever providers · 36 CLI/agent integrations through one config · OpenAI, Claude, Gemini and Responses API compatibility at /v1 · production controls including circuit breakers, TLS stealth, MCP 110 tools, A2A, memory, guardrails, evals and 39,000+ static test declarations across 5,100+ tracked test files."/>
|
||||
<img src="./docs/diagrams/promise-pillars.svg" width="100%" alt="The Promise — One endpoint and 372 providers. Automatic fallback keeps routing while another healthy target is available. Six pillars: resilient fallback across 372 providers · up to 95% token savings on eligible workloads · $0 to start with 150+ free tiers and 53 recurring/keyless free-forever providers · 37 CLI/agent integrations through one config · OpenAI, Claude, Gemini and Responses API compatibility at /v1 · production controls including circuit breakers, TLS stealth, MCP 110 tools, A2A, memory, guardrails, evals and 39,000+ static test declarations across 5,100+ tracked test files."/>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
@@ -592,7 +594,7 @@ the current catalog at **[radar.omniroute.online/planos](https://radar.omniroute
|
||||
- **🖼️ New endpoints** — `/v1/ocr` (Mistral OCR) and `/v1/audio/translations` (Whisper-style) round out the media surface. → [API Reference](docs/reference/API_REFERENCE.md)
|
||||
- **🎨 Image / video / audio generation** — one API for media: xAI Grok Imagine & Novita AI video, ComfyUI, Magnific, Adobe Firefly, Segmind, and speech providers such as ElevenLabs. → [API Reference](docs/reference/API_REFERENCE.md)
|
||||
- **🌍 Deployment & ops** — reverse-proxy `basePath`, browser-language auto-detect, per-key device tracking, root-less MITM trust, zh-TW localization. → [Environment](docs/reference/ENVIRONMENT.md)
|
||||
- **🤝 More providers & agents** — cloud agents (Codex Cloud, Cursor, Devin, Jules), Grok Build (xAI) with browser + OAuth login, Ollama first-class card, Claude Opus 5 & Sonnet 5, Kimi official partnership (Code/Web/Moonshot), Zed, Requesty, SenseNova, Yuanbao, Agnes AI… and a refreshed **352-provider catalog**. → [Providers](docs/reference/PROVIDER_REFERENCE.md)
|
||||
- **🤝 More providers & agents** — cloud agents (Codex Cloud, Cursor, Devin, Jules), Grok Build (xAI) with browser + OAuth login, Ollama first-class card, Claude Opus 5 & Sonnet 5, Kimi official partnership (Code/Web/Moonshot), Zed, Requesty, SenseNova, Yuanbao, Agnes AI… and a refreshed **372-provider catalog**. → [Providers](docs/reference/PROVIDER_REFERENCE.md)
|
||||
- **📡 Routing transparency** — every response carries an `X-OmniRoute-Decision` header naming the strategy/provider/latency that served it, a new `cache-optimized` combo strategy + Auto-Combo `cacheAffinity` factor route repeat requests back to the connection holding the cached prefix, and a read-only `/v1/auto-combo/{channel}/candidates` endpoint exposes an `auto/*` channel's live candidate pool. → [Auto-Combo](docs/routing/AUTO-COMBO.md)
|
||||
- **⚡ Local performance & infra** — one-click local Redis, Cloudflare Workers / Deno Deploy relay deployers, Bifrost & Mux as supervised embedded services. → [Embedded Services](docs/frameworks/EMBEDDED-SERVICES.md)
|
||||
- **🧩 Also in the box** — plugin framework + marketplace, Omni/Agent/GitHub skills frameworks, Obsidian vault integration (22 MCP tools), OpenAI-compatible Batch & Files APIs, semantic response cache, gamification with leaderboards, ACP agent discovery (15 built-in agents), scheduled log export to BigQuery, `auto/chaos` parallel multi-model fan-out, a Telegram bot bridge, an in-app version manager and LMArena-ELO free-provider rankings. → [Docs](docs/README.md)
|
||||
@@ -646,7 +648,7 @@ the current catalog at **[radar.omniroute.online/planos](https://radar.omniroute
|
||||
<b>+ also works with</b> · Agent Deck · Kiro · Command Code · Antigravity · Windsurf · AMP · <b>any OpenAI-compatible tool</b>
|
||||
</div>
|
||||
|
||||
<sub>📖 Per-tool setup for all 36 tools (26 CLI Code's + 10 CLI Agents) → [`docs/reference/CLI-TOOLS.md`](docs/reference/CLI-TOOLS.md) · 🧩 OpenCode plugin → [`@omniroute/opencode-provider`](https://www.npmjs.com/package/@omniroute/opencode-provider)</sub>
|
||||
<sub>📖 Per-tool setup for all 37 tools (27 CLI Code's + 10 CLI Agents) → [`docs/reference/CLI-TOOLS.md`](docs/reference/CLI-TOOLS.md) · 🧩 OpenCode plugin → [`@omniroute/opencode-provider`](https://www.npmjs.com/package/@omniroute/opencode-provider)</sub>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -680,7 +682,7 @@ of your shell history. → [CLI Integrations](docs/guides/CLI-INTEGRATIONS.md)
|
||||
|
||||
</div>
|
||||
|
||||
> **372 registered providers** across the canonical chat, media, search, local, cloud-agent and system collections, including **154 carrying `hasFree: true` discovery metadata**. The chat model registry covers **237 providers / 3,009 distinct provider-model pairs / 1,443 raw model IDs**; the separate free-budget catalog has **491 per-model rows**, **35 recurring pools** and **54 recurring/keyless free-forever providers**. These are different denominators by design; definitions and pool-deduped calculations live in the [Provider Reference](docs/reference/PROVIDER_REFERENCE.md) and [Free Tiers](docs/reference/FREE_TIERS.md).
|
||||
> **372 registered providers** across the canonical chat, media, search, local, cloud-agent and system collections, including **154 carrying `hasFree: true` discovery metadata**. The chat model registry covers **237 providers / 3,009 distinct provider-model pairs / 1,443 raw model IDs**; the separate free-budget catalog has **485 per-model rows**, **35 recurring pools** and **53 recurring/keyless free-forever providers**. These are different denominators by design; definitions and pool-deduped calculations live in the [Provider Reference](docs/reference/PROVIDER_REFERENCE.md) and [Free Tiers](docs/reference/FREE_TIERS.md).
|
||||
|
||||
<div align="center">
|
||||
|
||||
@@ -1359,7 +1361,7 @@ Métricas canônicas em 2026-08-24: **1.029 vídeos únicos** · **11.132.922 vi
|
||||
<tr><td nowrap><b><a href="docs/architecture/RESILIENCE_GUIDE.md">Resilience Guide</a></b></td><td>Circuit breakers, cooldowns, queue, anti-thundering herd, TLS spoofing</td></tr>
|
||||
<tr><td nowrap><b><a href="docs/routing/AUTO-COMBO.md">Auto-Combo Engine</a></b></td><td>16-factor scoring, mode packs, self-healing</td></tr>
|
||||
<tr><td nowrap><b><a href="docs/ops/PROXY_GUIDE.md">Proxy Guide</a></b></td><td>3-level proxy system, 1proxy marketplace, registry CRUD</td></tr>
|
||||
<tr><td nowrap><b><a href="docs/reference/FREE_TIERS.md">Free Tiers</a></b></td><td>Consolidated directory: 35 documented recurring pools / 489 cataloged free-tier entries</td></tr>
|
||||
<tr><td nowrap><b><a href="docs/reference/FREE_TIERS.md">Free Tiers</a></b></td><td>Consolidated directory: 35 documented recurring pools / 485 cataloged free-tier entries</td></tr>
|
||||
<tr><td nowrap><b><a href="docs/guides/FEATURES.md">Features Gallery</a></b></td><td>Visual dashboard tour with screenshots</td></tr>
|
||||
<tr><td nowrap><b><a href="docs/architecture/CODEBASE_DOCUMENTATION.md">Codebase Documentation</a></b></td><td>Beginner-friendly codebase walkthrough</td></tr>
|
||||
</table>
|
||||
|
||||
32
ROADMAP.md
32
ROADMAP.md
@@ -1,13 +1,13 @@
|
||||
---
|
||||
title: "OmniRoute Roadmap"
|
||||
version: 3.8.52
|
||||
lastUpdated: 2026-10-10
|
||||
lastUpdated: 2026-10-16
|
||||
---
|
||||
|
||||
# OmniRoute Roadmap
|
||||
|
||||
> Version-gated, not date-gated: each milestone ships when its quality gates pass.
|
||||
> Current line: **v3.8.52** (`release/v3.8.52`). Last updated: 2026-10-10.
|
||||
> Current line: **v3.8.52** (`release/v3.8.52`). Last updated: 2026-10-16.
|
||||
> Status legend: ✅ landed · 🟡 partly landed / in review · ⏳ pending (owner action).
|
||||
|
||||
OmniRoute is heading from a monolithic router to a **modular AI platform**: a lightweight
|
||||
@@ -30,26 +30,26 @@ modular **4.0**.
|
||||
Non-breaking structural work that de-risks the modular split. Every version closes with a
|
||||
mandatory quality-gate battery before new merges open.
|
||||
|
||||
| Version | Focus | Status |
|
||||
| ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------- |
|
||||
| 3.8.50 | CI safety net on release branches · dead-code cleanup · community-reported catalog/topology bug fixes · contributor "golden path" guide | ✅ shipped |
|
||||
| 3.8.51 | Executor registry (in-place) · end-to-end provider-journey contract test becomes a CI gate · official scoped-test dev loop · CI lane consolidation (shared install/setup across gate jobs, #8084) | ✅ shipped (#10633, #12353, #12408) |
|
||||
| 3.8.52 | `combo.ts` decomposition · routing-strategy registry · unified model-catalog contract for `/v1/models` · one CI policy for PRs to `release/**` and `main` (#8084) | 🟡 in progress (#12746, #12811, #16078 landed; strategy registry #16206 open) |
|
||||
| 3.8.53 | `chatCore.ts` decomposition · headless mode (`OMNIROUTE_HEADLESS=1`) · local candidate build/promote loop | ✅ landed early (#14725, #16079, #16180); next slice #15709 open |
|
||||
| 3.8.54 | Release infrastructure (dormant): channels, labels, PR templates, merge queue · full-regression authority moves to the merge queue once TIA shadow evidence clears (#8084) · public feature-freeze announcement | 🟡 infra landed (#16073, #16172, #16066); freeze announcement ⏳ owner |
|
||||
| Version | Focus | Status |
|
||||
| ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| 3.8.50 | CI safety net on release branches · dead-code cleanup · community-reported catalog/topology bug fixes · contributor "golden path" guide | ✅ shipped |
|
||||
| 3.8.51 | Executor registry (in-place) · end-to-end provider-journey contract test becomes a CI gate · official scoped-test dev loop · CI lane consolidation (shared install/setup across gate jobs, #8084) | ✅ shipped (#10633, #12353, #12408) |
|
||||
| 3.8.52 | `combo.ts` decomposition · routing-strategy registry · unified model-catalog contract for `/v1/models` · one CI policy for PRs to `release/**` and `main` (#8084) | ✅ structural work landed (#12746, #12811, #16206 registry, #16078 classifier step 1); one CI policy deferred (RFC #16075 closed) |
|
||||
| 3.8.53 | `chatCore.ts` decomposition · headless mode (`OMNIROUTE_HEADLESS=1`) · local candidate build/promote loop | ✅ landed early (#14725, #16079, #16180); further `chatCore.ts` slices unowned (#15709 closed by its author) |
|
||||
| 3.8.54 | Release infrastructure (dormant): channels, labels, PR templates, merge queue · full-regression authority moves to the merge queue once TIA shadow evidence clears (#8084) · public feature-freeze announcement | 🟡 infra landed (#16073, #16172, #16066); freeze announcement ⏳ owner |
|
||||
|
||||
## Phase 2 — Validation (3.8.55 → 3.8.59)
|
||||
|
||||
**External feature PRs pause here** (they get the `v4-feature` label and are re-targeted to
|
||||
the v4 channel when it opens). Fixes, docs, i18n, and provider updates keep flowing.
|
||||
|
||||
| Version | Focus | Status |
|
||||
| ------- | -------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------- |
|
||||
| 3.8.55 | Characterization tests for every extraction candidate · coupling re-measurement | ✅ prepared early (#16179, #16192, #16205) |
|
||||
| 3.8.56 | Extended canary · performance baselines (heap, TTFB, build) | 🟡 script + preliminary report (#16211); VPS canary/baseline ⏳ |
|
||||
| 3.8.57 | Security & compliance sweep · publish provenance (OIDC) rehearsal | 🟡 sweep landed (#16209); OIDC registry rehearsal ⏳ |
|
||||
| 3.8.58 | Full dry-run of the 3.9.0 cut (branches, channels, forward-port) — includes the PR preview-artifact + build-once promotion rehearsal (#8084) | 🟡 tooling landed (#16210); fork rehearsal ⏳ owner |
|
||||
| 3.8.59 | Final freeze · full-suite audit · GO/NO-GO | ⏳ pending (owner GO/NO-GO; checklist in #16210) |
|
||||
| Version | Focus | Status |
|
||||
| ------- | -------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| 3.8.55 | Characterization tests for every extraction candidate · coupling re-measurement | ✅ prepared early (#16179, #16192, #16205); coupling re-measured 2026-10-16: `open-sse → src` 768 edges (745 on 10-10), still growing |
|
||||
| 3.8.56 | Extended canary · performance baselines (heap, TTFB, build) | 🟡 script + preliminary report (#16211); VPS canary/baseline ⏳ (needs an idle dedicated host) |
|
||||
| 3.8.57 | Security & compliance sweep · publish provenance (OIDC) rehearsal | 🟡 sweep landed (#16209); nightly LLM-security eval restored (#16847); OIDC registry rehearsal ⏳ |
|
||||
| 3.8.58 | Full dry-run of the 3.9.0 cut (branches, channels, forward-port) — includes the PR preview-artifact + build-once promotion rehearsal (#8084) | ✅ tooling (#16210) · cut rehearsed 2026-10-16 on a private scratch remote (`stable/v3` + `develop` 4.0.0 created and rolled back; shallow-clone guard #16875) · real cut needs a full clone + open freeze |
|
||||
| 3.8.59 | Final freeze · full-suite audit · GO/NO-GO | ⏳ pending (owner GO/NO-GO; checklist in #16210) |
|
||||
|
||||
## Phase 3 — v3.9.0 LTS
|
||||
|
||||
|
||||
@@ -13,9 +13,12 @@ import net from "node:net";
|
||||
import http from "node:http";
|
||||
import https from "node:https";
|
||||
import tls from "node:tls";
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
// CommonJS twin of the MITM data-dir + cert-model resolution (src/mitm/dataDir.ts,
|
||||
// src/mitm/cert/migration.ts): this script runs with plain `node`, so it cannot load
|
||||
// the TypeScript sources. src/mitm/ ships in the npm package next to bin/.
|
||||
import { createBridgeTlsProvider } from "../src/mitm/_internal/bridgeCert.cjs";
|
||||
|
||||
const PORT = parseInt(process.env.BRIDGE_PORT || "20129", 10);
|
||||
const ROUTER_URL = process.env.ROUTER_URL || "http://127.0.0.1:20128/v1/antigravity";
|
||||
@@ -39,24 +42,19 @@ const httpsAgent = new https.Agent({
|
||||
timeout: 120000,
|
||||
});
|
||||
|
||||
let cachedSslOptions = null;
|
||||
function getSslOptions() {
|
||||
if (cachedSslOptions) return cachedSslOptions;
|
||||
const certDir =
|
||||
process.env.CERT_DIR || path.join(process.env.HOME || process.cwd(), ".omniroute", "mitm");
|
||||
const serverKey = path.join(certDir, "server.key");
|
||||
const serverCrt = path.join(certDir, "server.crt");
|
||||
|
||||
if (!fs.existsSync(serverKey) || !fs.existsSync(serverCrt)) {
|
||||
console.error("❌ Certificate files not found in", certDir);
|
||||
// TLS material for intercepted hosts, resolved like the AgentBridge MITM server does:
|
||||
// `CERT_DIR` (explicit override) or `<DATA_DIR>/mitm`; legacy `server.crt`/`server.key`
|
||||
// leaf, or the root CA (`ca.crt`/`ca.key`) minting a leaf per intercepted host.
|
||||
let cachedTlsProvider = null;
|
||||
function getTlsProvider() {
|
||||
if (cachedTlsProvider) return cachedTlsProvider;
|
||||
try {
|
||||
cachedTlsProvider = createBridgeTlsProvider();
|
||||
} catch (err) {
|
||||
console.error(`❌ ${err.message}`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
cachedSslOptions = {
|
||||
key: fs.readFileSync(serverKey),
|
||||
cert: fs.readFileSync(serverCrt),
|
||||
};
|
||||
return cachedSslOptions;
|
||||
return cachedTlsProvider;
|
||||
}
|
||||
|
||||
const TARGET_HOSTS = new Set([
|
||||
@@ -522,23 +520,37 @@ proxyServer.on("connect", (req, clientSocket, head) => {
|
||||
const targetPort = parseInt(targetPortStr || "443", 10);
|
||||
|
||||
if (TARGET_HOSTS.has(targetHost)) {
|
||||
// Target host: Terminate TLS locally and route via internalApp
|
||||
clientSocket.write("HTTP/1.1 200 Connection Established\r\n\r\n");
|
||||
// Target host: Terminate TLS locally and route via internalApp. The leaf is
|
||||
// resolved before answering the CONNECT, so the client's ClientHello can only
|
||||
// arrive once the socket is wrapped.
|
||||
getTlsProvider()
|
||||
.getSecureContext(targetHost)
|
||||
.then((secureContext) => {
|
||||
if (clientSocket.destroyed) return;
|
||||
clientSocket.write("HTTP/1.1 200 Connection Established\r\n\r\n");
|
||||
|
||||
const ssl = getSslOptions();
|
||||
const tlsSocket = new tls.TLSSocket(clientSocket, {
|
||||
isServer: true,
|
||||
key: ssl.key,
|
||||
cert: ssl.cert,
|
||||
});
|
||||
tlsSocket.setNoDelay(true);
|
||||
const tlsSocket = new tls.TLSSocket(clientSocket, {
|
||||
isServer: true,
|
||||
secureContext,
|
||||
});
|
||||
tlsSocket.setNoDelay(true);
|
||||
|
||||
tlsSocket.on("error", (err) => {
|
||||
// Client closed or TLS error
|
||||
clientSocket.destroy();
|
||||
});
|
||||
tlsSocket.on("error", (err) => {
|
||||
// Client closed or TLS error
|
||||
clientSocket.destroy();
|
||||
});
|
||||
|
||||
internalApp.emit("connection", tlsSocket);
|
||||
internalApp.emit("connection", tlsSocket);
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(
|
||||
`[Bridge] ❌ Could not issue a certificate for ${targetHost}: ${err.message}`
|
||||
);
|
||||
if (!clientSocket.destroyed) {
|
||||
clientSocket.end("HTTP/1.1 502 Bad Gateway\r\n\r\n");
|
||||
}
|
||||
});
|
||||
clientSocket.on("error", () => clientSocket.destroy());
|
||||
} else {
|
||||
// Non-target host: Transparent raw TCP tunnel
|
||||
const upstreamSocket = net.connect(targetPort, targetHost, () => {
|
||||
@@ -574,9 +586,14 @@ export {
|
||||
const isMain = process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url);
|
||||
|
||||
if (isMain) {
|
||||
// Fail at startup (not on the first intercepted CONNECT) when the cert is missing.
|
||||
const tlsProvider = getTlsProvider();
|
||||
const certModel =
|
||||
tlsProvider.mode === "use-root-ca" ? "root CA, per-host leaf" : "legacy leaf certificate";
|
||||
proxyServer.listen(PORT, "127.0.0.1", () => {
|
||||
console.log(`🚀 OmniRoute Antigravity Bridge listening on 127.0.0.1:${PORT}`);
|
||||
console.log(` Routing non-Gemini 3.8 model traffic -> ${ROUTER_URL}`);
|
||||
console.log(` Preserving Gemini 3.8 native traffic -> Google`);
|
||||
console.log(` TLS: ${certModel} from ${tlsProvider.certDir}`);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { showKeyPolicy, setKeyPolicy } from "../key-policy.mjs";
|
||||
import { printHeading } from "../io.mjs";
|
||||
import {
|
||||
ensureProviderSchema,
|
||||
@@ -111,9 +112,11 @@ export function registerKeys(program) {
|
||||
policy
|
||||
.command("set <id>")
|
||||
.description(t("keys.policy.setDescription"))
|
||||
.option("--rate-limit <n>", t("keys.policy.rateLimitOpt"), parseInt)
|
||||
.option("--max-cost <n>", t("keys.policy.maxCostOpt"), parseFloat)
|
||||
.option("--rate-limit <n>", t("keys.policy.rateLimitOpt"))
|
||||
.option("--max-cost <n>", t("keys.policy.maxCostOpt"))
|
||||
.option("--allowed-models <list>", t("keys.policy.allowedModelsOpt"))
|
||||
.option("--model-access-mode <mode>", t("keys.policy.modelAccessModeOpt"))
|
||||
.option("--unrestricted", t("keys.policy.unrestrictedOpt"))
|
||||
.action(async (id, opts, cmd) => {
|
||||
const globalOpts = cmd.parent.parent.optsWithGlobals();
|
||||
const exitCode = await runKeysPolicySetCommand(id, { ...opts, ...globalOpts });
|
||||
@@ -487,68 +490,11 @@ export async function runKeysUsageCommand(id, opts = {}) {
|
||||
}
|
||||
|
||||
export async function runKeysPolicyShowCommand(id, opts = {}) {
|
||||
if (!(await isServerUp())) {
|
||||
console.error(t("common.serverOffline"));
|
||||
return 1;
|
||||
}
|
||||
try {
|
||||
const res = await apiFetch(`/api/v1/registered-keys/${encodeURIComponent(id)}/policy`, {
|
||||
acceptNotOk: true,
|
||||
retry: false,
|
||||
});
|
||||
if (!res.ok) {
|
||||
console.error(t("common.error", { message: `HTTP ${res.status}` }));
|
||||
return 1;
|
||||
}
|
||||
const data = await res.json();
|
||||
if (opts.output === "json" || opts.json) {
|
||||
console.log(JSON.stringify(data, null, 2));
|
||||
return 0;
|
||||
}
|
||||
console.log(t("keys.policy.title") + ` (${id}):`);
|
||||
console.log(` rate_limit: ${data.rateLimit ?? data.rate_limit ?? "(unset)"}`);
|
||||
console.log(` max_cost: ${data.maxCost ?? data.max_cost ?? "(unset)"}`);
|
||||
console.log(
|
||||
` allowed_models: ${(data.allowedModels ?? data.allowed_models ?? []).join(", ") || "(all)"}`
|
||||
);
|
||||
return 0;
|
||||
} catch (err) {
|
||||
console.error(t("common.error", { message: err instanceof Error ? err.message : String(err) }));
|
||||
return 1;
|
||||
}
|
||||
return showKeyPolicy(id, opts);
|
||||
}
|
||||
|
||||
export async function runKeysPolicySetCommand(id, opts = {}) {
|
||||
const body = {};
|
||||
if (opts.rateLimit != null) body.rateLimit = Number(opts.rateLimit);
|
||||
if (opts.maxCost != null) body.maxCost = Number(opts.maxCost);
|
||||
if (opts.allowedModels) body.allowedModels = opts.allowedModels.split(",").map((s) => s.trim());
|
||||
|
||||
if (Object.keys(body).length === 0) {
|
||||
console.error(t("keys.policy.nothingToSet"));
|
||||
return 1;
|
||||
}
|
||||
if (!(await isServerUp())) {
|
||||
console.error(t("common.serverOffline"));
|
||||
return 1;
|
||||
}
|
||||
try {
|
||||
const res = await apiFetch(`/api/v1/registered-keys/${encodeURIComponent(id)}/policy`, {
|
||||
method: "PATCH",
|
||||
body,
|
||||
acceptNotOk: true,
|
||||
retry: false,
|
||||
});
|
||||
if (!res.ok) {
|
||||
console.error(t("common.error", { message: `HTTP ${res.status}` }));
|
||||
return 1;
|
||||
}
|
||||
console.log(t("keys.policy.updated"));
|
||||
return 0;
|
||||
} catch (err) {
|
||||
console.error(t("common.error", { message: err instanceof Error ? err.message : String(err) }));
|
||||
return 1;
|
||||
}
|
||||
return setKeyPolicy(id, opts);
|
||||
}
|
||||
|
||||
export async function runKeysExpirationListCommand(opts = {}) {
|
||||
|
||||
@@ -73,6 +73,7 @@ import { registerSetupContinue } from "./setup-continue.mjs";
|
||||
import { registerSetupCursor } from "./setup-cursor.mjs";
|
||||
import { registerSetupRoo } from "./setup-roo.mjs";
|
||||
import { registerSetupCrush } from "./setup-crush.mjs";
|
||||
import { registerSetupZed } from "./setup-zed.mjs";
|
||||
import { registerSetupGoose } from "./setup-goose.mjs";
|
||||
import { registerSetupAider } from "./setup-aider.mjs";
|
||||
import { registerSetupQwen } from "./setup-qwen.mjs";
|
||||
@@ -163,6 +164,7 @@ export function registerCommands(program) {
|
||||
registerSetupCursor(program);
|
||||
registerSetupRoo(program);
|
||||
registerSetupCrush(program);
|
||||
registerSetupZed(program);
|
||||
registerSetupGoose(program);
|
||||
registerSetupAider(program);
|
||||
registerSetupQwen(program);
|
||||
|
||||
233
bin/cli/commands/setup-zed.mjs
Normal file
233
bin/cli/commands/setup-zed.mjs
Normal file
@@ -0,0 +1,233 @@
|
||||
/**
|
||||
* omniroute setup-zed — point Zed's built-in agent at OmniRoute.
|
||||
*
|
||||
* Writes `language_models.openai_compatible.omniroute` into Zed's settings.json
|
||||
* (`$XDG_CONFIG_HOME/zed` or `~/.config/zed`; `%APPDATA%\Zed` on Windows) with
|
||||
* `api_url` (WITH /v1) and `available_models` pulled from /v1/models: combos
|
||||
* first, chat models with tool support only, capped at 25.
|
||||
*
|
||||
* The API key is never written. settings.json is plaintext, and Zed reads the
|
||||
* key from the env var derived from the provider id: `omniroute` →
|
||||
* `OMNIROUTE_API_KEY`. The file is JSONC, so it is edited in place with
|
||||
* jsonc-parser: comments survive, and a file that fails to parse is left alone.
|
||||
*/
|
||||
|
||||
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
||||
import { dirname, join } from "node:path";
|
||||
import os from "node:os";
|
||||
import { applyEdits, modify, parse, printParseErrorCode, stripComments } from "jsonc-parser";
|
||||
import { printHeading, printInfo, printSuccess, printError } from "../io.mjs";
|
||||
import { guardHostConfigTarget } from "../utils/config-home-guard.mjs";
|
||||
import { resolveCrushTarget } from "./setup-crush.mjs";
|
||||
|
||||
export const ZED_PROVIDER_ID = "omniroute";
|
||||
export const ZED_MODEL_CAP = 25;
|
||||
export const ZED_DEFAULT_CONTEXT = 200000;
|
||||
|
||||
const PROVIDER_PATH = ["language_models", "openai_compatible", ZED_PROVIDER_ID];
|
||||
const JSON_FORMATTING_OPTIONS = { insertSpaces: true, tabSize: 2 };
|
||||
|
||||
/** Zed's user settings file for this platform. */
|
||||
export function resolveZedSettingsPath({
|
||||
env = process.env,
|
||||
platform = process.platform,
|
||||
homedir = os.homedir(),
|
||||
} = {}) {
|
||||
if (platform === "win32") {
|
||||
return join(env.APPDATA || join(homedir, "AppData", "Roaming"), "Zed", "settings.json");
|
||||
}
|
||||
return join(env.XDG_CONFIG_HOME || join(homedir, ".config"), "zed", "settings.json");
|
||||
}
|
||||
|
||||
function isAgentModel(m) {
|
||||
if (!m || typeof m.id !== "string" || !m.id) return false;
|
||||
// Non-chat endpoints (web search, TTS, embeddings, images, ...) are useless to an agent.
|
||||
if (m.kind) return false;
|
||||
if (typeof m.type === "string" && m.type !== "chat") return false;
|
||||
const caps = m.capabilities || {};
|
||||
return caps.tool_calling !== false && caps.tools !== false;
|
||||
}
|
||||
|
||||
/** Combos first, then the other tool-capable chat models; capped at ZED_MODEL_CAP. */
|
||||
export function pickZedModels(models) {
|
||||
const usable = (Array.isArray(models) ? models : []).filter(isAgentModel);
|
||||
const combos = usable.filter((m) => m.owned_by === "combo");
|
||||
const rest = usable.filter((m) => m.owned_by !== "combo");
|
||||
return [...combos, ...rest].slice(0, ZED_MODEL_CAP);
|
||||
}
|
||||
|
||||
/** One `available_models` entry in Zed's openai_compatible schema. */
|
||||
export function zedModelEntry(m) {
|
||||
const entry = {
|
||||
name: m.id,
|
||||
display_name: m.id,
|
||||
max_tokens: m.context_length || ZED_DEFAULT_CONTEXT,
|
||||
};
|
||||
const maxOutput = m.max_output_tokens || m.max_completion_tokens;
|
||||
if (maxOutput) entry.max_output_tokens = maxOutput;
|
||||
return entry;
|
||||
}
|
||||
|
||||
/** The provider block. Deliberately has no api_key field. */
|
||||
export function buildZedProvider(models, baseUrl) {
|
||||
return { api_url: baseUrl, available_models: pickZedModels(models).map(zedModelEntry) };
|
||||
}
|
||||
|
||||
/** Parse settings.json (JSONC). Throws on anything that is not an object. */
|
||||
export function parseZedSettings(text) {
|
||||
if (!stripComments(String(text || "")).trim()) return {};
|
||||
const errors = [];
|
||||
const value = parse(text, errors, { allowTrailingComma: true, disallowComments: false });
|
||||
if (errors.length > 0 || (value !== undefined && (!value || typeof value !== "object"))) {
|
||||
const details = errors
|
||||
.map((e) => `${printParseErrorCode(e.error)} at offset ${e.offset}`)
|
||||
.join(", ");
|
||||
throw new Error(`Zed settings.json is not a valid JSON object${details ? `: ${details}` : ""}`);
|
||||
}
|
||||
if (Array.isArray(value))
|
||||
throw new Error("Zed settings.json must be a JSON object, not an array");
|
||||
return value || {};
|
||||
}
|
||||
|
||||
function finish(text) {
|
||||
return text.endsWith("\n") ? text : `${text}\n`;
|
||||
}
|
||||
|
||||
function setPath(text, path, value) {
|
||||
return applyEdits(
|
||||
text,
|
||||
modify(text, path, value, { formattingOptions: JSON_FORMATTING_OPTIONS })
|
||||
);
|
||||
}
|
||||
|
||||
/** Add/replace our provider in the settings text, keeping everything else (comments too). */
|
||||
export function mergeZedSettings(text, provider) {
|
||||
parseZedSettings(text);
|
||||
const base = stripComments(String(text || "")).trim() ? text : "{}";
|
||||
return finish(setPath(base, PROVIDER_PATH, provider));
|
||||
}
|
||||
|
||||
/** Remove only our provider; drop `openai_compatible` / `language_models` once empty. */
|
||||
export function removeZedProvider(text) {
|
||||
const cfg = parseZedSettings(text);
|
||||
if (!cfg.language_models?.openai_compatible?.[ZED_PROVIDER_ID]) return finish(text);
|
||||
let out = setPath(text, PROVIDER_PATH, undefined);
|
||||
const lm = parseZedSettings(out).language_models;
|
||||
if (lm?.openai_compatible && Object.keys(lm.openai_compatible).length === 0) {
|
||||
out = setPath(out, ["language_models", "openai_compatible"], undefined);
|
||||
}
|
||||
const lmAfter = parseZedSettings(out).language_models;
|
||||
if (lmAfter && typeof lmAfter === "object" && Object.keys(lmAfter).length === 0) {
|
||||
out = setPath(out, ["language_models"], undefined);
|
||||
}
|
||||
return finish(out);
|
||||
}
|
||||
|
||||
async function fetchModels(baseUrl, apiKey) {
|
||||
const headers = { "Content-Type": "application/json" };
|
||||
if (apiKey) headers["Authorization"] = `Bearer ${apiKey}`;
|
||||
const res = await fetch(`${baseUrl}/models`, { headers, signal: AbortSignal.timeout(10000) });
|
||||
if (!res.ok) throw new Error(`HTTP ${res.status}`);
|
||||
const body = await res.json();
|
||||
const list = Array.isArray(body) ? body : (body.data ?? body.models ?? []);
|
||||
return list.map((m) => (typeof m === "string" ? { id: m } : m)).filter(Boolean);
|
||||
}
|
||||
|
||||
function readSettings(configPath) {
|
||||
return existsSync(configPath) ? readFileSync(configPath, "utf8") : "";
|
||||
}
|
||||
|
||||
export async function runSetupZedCommand(opts = {}) {
|
||||
const { baseUrl, apiKey } = resolveCrushTarget(opts);
|
||||
const dryRun = Boolean(opts.dryRun ?? opts["dry-run"]);
|
||||
const reset = Boolean(opts.reset);
|
||||
const only = opts.only
|
||||
? String(opts.only)
|
||||
.split(",")
|
||||
.map((s) => s.trim())
|
||||
.filter(Boolean)
|
||||
: null;
|
||||
const configPath = opts.configPath ?? opts["config-path"] ?? resolveZedSettingsPath();
|
||||
|
||||
const guard = await guardHostConfigTarget(configPath, {
|
||||
toolLabel: "Zed",
|
||||
hostCommand: "omniroute setup-zed",
|
||||
allowContainerWrite: Boolean(opts.allowContainerWrite ?? opts["allow-container-write"]),
|
||||
dryRun,
|
||||
});
|
||||
if (guard !== 0) return guard;
|
||||
|
||||
printHeading("OmniRoute → Zed (openai_compatible)");
|
||||
const current = readSettings(configPath);
|
||||
|
||||
let out;
|
||||
let summary;
|
||||
try {
|
||||
if (reset) {
|
||||
out = removeZedProvider(current);
|
||||
summary = `Removed language_models.openai_compatible.${ZED_PROVIDER_ID} from ${configPath}`;
|
||||
} else {
|
||||
parseZedSettings(current);
|
||||
printInfo(`api_url: ${baseUrl}`);
|
||||
let models;
|
||||
try {
|
||||
models = await fetchModels(baseUrl, apiKey);
|
||||
} catch (e) {
|
||||
printError(`Could not fetch models: ${e.message}`);
|
||||
printInfo("Make sure OmniRoute is running and --remote/--api-key are correct.");
|
||||
return 1;
|
||||
}
|
||||
if (only) models = models.filter((m) => only.some((f) => String(m.id).includes(f)));
|
||||
const provider = buildZedProvider(models, baseUrl);
|
||||
if (!provider.available_models.length) {
|
||||
printError("No tool-capable chat models found (try --only or check the server).");
|
||||
return 1;
|
||||
}
|
||||
out = mergeZedSettings(current, provider);
|
||||
summary = `Wrote ${configPath} (${provider.available_models.length} models under language_models.openai_compatible.${ZED_PROVIDER_ID})`;
|
||||
}
|
||||
} catch (e) {
|
||||
printError(`${e.message} — fix ${configPath} first; nothing was written.`);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (dryRun) {
|
||||
console.log("\n" + (out.length > 3500 ? out.slice(0, 3500) + "\n… (truncated)" : out));
|
||||
printInfo(`[dry-run] ${summary.replace(/^(Wrote|Removed)/, "Would update")}`);
|
||||
return 0;
|
||||
}
|
||||
if (reset && !current) {
|
||||
printInfo(`Nothing to remove: ${configPath} does not exist.`);
|
||||
return 0;
|
||||
}
|
||||
mkdirSync(dirname(configPath), { recursive: true });
|
||||
writeFileSync(configPath, out, "utf8");
|
||||
printSuccess(summary);
|
||||
if (!reset) {
|
||||
printInfo("Zed reads the key from the environment (it is never written to settings.json):");
|
||||
printInfo(" export OMNIROUTE_API_KEY=...");
|
||||
printInfo("Then start Zed from that shell (e.g. `zed .`) and pick a model in the Agent Panel.");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
export function registerSetupZed(program) {
|
||||
program
|
||||
.command("setup-zed")
|
||||
.description("Add OmniRoute as an OpenAI-compatible provider in Zed's settings.json")
|
||||
.option("--port <port>", "Local OmniRoute port (ignored when --remote is set)", "20128")
|
||||
.option("--remote <url>", "Remote OmniRoute URL, e.g. http://192.168.0.15:20128")
|
||||
.option("--api-key <key>", "OmniRoute API key used to list models (never written to disk)")
|
||||
.option("--only <patterns>", "Comma-separated substrings — keep only matching model IDs")
|
||||
.option("--config-path <path>", "settings.json path (default: ~/.config/zed/settings.json)")
|
||||
.option("--reset", "Remove the OmniRoute provider from settings.json")
|
||||
.option("--dry-run", "Print what would be written without touching the filesystem")
|
||||
.option(
|
||||
"--allow-container-write",
|
||||
"Write even when the target is inside a container and not mounted from the host"
|
||||
)
|
||||
.action(async (opts) => {
|
||||
const code = await runSetupZedCommand(opts);
|
||||
if (code !== 0) process.exit(code);
|
||||
});
|
||||
}
|
||||
@@ -244,8 +244,9 @@ const IMPORT_TIMEOUT_MS = 300_000;
|
||||
function importFailureHint(status) {
|
||||
if (status === 401 || status === 403) {
|
||||
return (
|
||||
"importing replaces the whole database: run this on the server host (local CLI " +
|
||||
"credential), sign in to the dashboard, or pass an API key with the 'manage' scope."
|
||||
"importing replaces the whole database, so it requires an operator credential: run this " +
|
||||
"on the server host (local CLI credential) or sign in to the dashboard; API keys and " +
|
||||
"remote access tokens are refused."
|
||||
);
|
||||
}
|
||||
return routeUnavailableHint(status, `POST ${IMPORT_PATH}`);
|
||||
|
||||
134
bin/cli/key-policy.mjs
Normal file
134
bin/cli/key-policy.mjs
Normal file
@@ -0,0 +1,134 @@
|
||||
import { apiFetch, isServerUp } from "./api.mjs";
|
||||
import { t } from "./i18n.mjs";
|
||||
|
||||
class PolicyCommandError extends Error {}
|
||||
|
||||
function numericOption(value, flag, integer = false) {
|
||||
const number = Number(value);
|
||||
if (
|
||||
String(value).trim() === "" ||
|
||||
!Number.isFinite(number) ||
|
||||
number < 0 ||
|
||||
(integer && (!Number.isSafeInteger(number) || number === 0))
|
||||
) {
|
||||
throw new PolicyCommandError(`Invalid ${flag}`);
|
||||
}
|
||||
return number;
|
||||
}
|
||||
|
||||
function modelPolicy(opts) {
|
||||
const mode = opts.unrestricted ? "all" : opts.modelAccessMode;
|
||||
if (opts.unrestricted && opts.modelAccessMode && opts.modelAccessMode !== "all") {
|
||||
throw new PolicyCommandError("--unrestricted conflicts with --model-access-mode restricted");
|
||||
}
|
||||
if (mode !== undefined && !["all", "restricted"].includes(mode)) {
|
||||
throw new PolicyCommandError("--model-access-mode must be all or restricted");
|
||||
}
|
||||
const body = {};
|
||||
if (mode !== undefined) body.modelAccessMode = mode;
|
||||
if (opts.allowedModels !== undefined) {
|
||||
body.allowedModels = String(opts.allowedModels)
|
||||
.split(",")
|
||||
.map((value) => value.trim())
|
||||
.filter(Boolean);
|
||||
if (mode === "all" && body.allowedModels.length) {
|
||||
throw new PolicyCommandError("Unrestricted model access conflicts with --allowed-models");
|
||||
}
|
||||
body.modelAccessMode ??= body.allowedModels.length ? "restricted" : "all";
|
||||
}
|
||||
return body;
|
||||
}
|
||||
|
||||
export function publicKeyPolicy(data) {
|
||||
const fields = [
|
||||
"id",
|
||||
"modelAccessMode",
|
||||
"allowedModels",
|
||||
"blockedModels",
|
||||
"allowedCombos",
|
||||
"connectionAccessMode",
|
||||
"allowedConnections",
|
||||
"scopes",
|
||||
"rateLimits",
|
||||
"usageLimitEnabled",
|
||||
"dailyUsageLimitUsd",
|
||||
"weeklyUsageLimitUsd",
|
||||
"allowAutoCombos",
|
||||
"disableNonPublicModels",
|
||||
];
|
||||
return Object.fromEntries(
|
||||
fields.filter((field) => data[field] !== undefined).map((field) => [field, data[field]])
|
||||
);
|
||||
}
|
||||
|
||||
async function policyRequest(id, opts, method = "GET", body) {
|
||||
const response = await apiFetch(`/api/keys/${encodeURIComponent(id)}`, {
|
||||
...opts,
|
||||
method,
|
||||
body,
|
||||
acceptNotOk: true,
|
||||
retry: false,
|
||||
});
|
||||
if (!response.ok) {
|
||||
const hint = [401, 403].includes(response.status)
|
||||
? ": verify the active context or supply a management credential with --api-key; inference-only keys cannot manage policies"
|
||||
: "";
|
||||
throw new PolicyCommandError(`HTTP ${response.status}${hint}`);
|
||||
}
|
||||
return response.json();
|
||||
}
|
||||
|
||||
function reportError(error) {
|
||||
console.error(
|
||||
t("common.error", {
|
||||
message:
|
||||
error instanceof PolicyCommandError
|
||||
? error.message
|
||||
: "Unable to read or update key policy; check the active context and server connection",
|
||||
})
|
||||
);
|
||||
return 1;
|
||||
}
|
||||
|
||||
export async function showKeyPolicy(id, opts = {}) {
|
||||
try {
|
||||
if (!(await isServerUp(opts))) throw new PolicyCommandError(t("common.serverOffline"));
|
||||
const policy = publicKeyPolicy(await policyRequest(id, opts));
|
||||
if (opts.output === "json" || opts.json) console.log(JSON.stringify(policy, null, 2));
|
||||
else {
|
||||
console.log(t("keys.policy.title") + ` (${id}):`);
|
||||
for (const [field, value] of Object.entries(policy))
|
||||
console.log(` ${field}: ${JSON.stringify(value)}`);
|
||||
}
|
||||
return 0;
|
||||
} catch (error) {
|
||||
return reportError(error);
|
||||
}
|
||||
}
|
||||
|
||||
export async function setKeyPolicy(id, opts = {}) {
|
||||
try {
|
||||
const body = modelPolicy(opts);
|
||||
const minuteLimit =
|
||||
opts.rateLimit == null ? undefined : numericOption(opts.rateLimit, "--rate-limit", true);
|
||||
if (opts.maxCost != null) {
|
||||
body.dailyUsageLimitUsd = numericOption(opts.maxCost, "--max-cost");
|
||||
if (body.dailyUsageLimitUsd > 0) body.usageLimitEnabled = true;
|
||||
}
|
||||
if (!Object.keys(body).length && minuteLimit === undefined)
|
||||
throw new PolicyCommandError(t("keys.policy.nothingToSet"));
|
||||
if (!(await isServerUp(opts))) throw new PolicyCommandError(t("common.serverOffline"));
|
||||
if (minuteLimit !== undefined) {
|
||||
const current = await policyRequest(id, opts);
|
||||
body.rateLimits = [
|
||||
...(current.rateLimits ?? []).filter((rule) => rule.window !== 60),
|
||||
{ limit: minuteLimit, window: 60 },
|
||||
];
|
||||
}
|
||||
await policyRequest(id, opts, "PATCH", body);
|
||||
console.log(t("keys.policy.updated"));
|
||||
return 0;
|
||||
} catch (error) {
|
||||
return reportError(error);
|
||||
}
|
||||
}
|
||||
@@ -123,7 +123,9 @@
|
||||
"maxCostOpt": "በቀን ከፍተኛው ወጪ (USD)",
|
||||
"allowedModelsOpt": "በነጠላ ሰረዝ የተለዩ የተፈቀዱ ሞዴሎች ዝርዝር",
|
||||
"nothingToSet": "ምንም የፖሊሲ መስኮች አልቀረቡም። --rate-limit፣ --max-cost ወይም --allowed-models ይጠቀሙ።",
|
||||
"updated": "ፖሊሲው ዘምኗል።"
|
||||
"updated": "ፖሊሲው ዘምኗል።",
|
||||
"modelAccessModeOpt": "የሞዴል መዳረሻ ሁነታ (all | restricted)",
|
||||
"unrestrictedOpt": "ሁሉንም ሞዴሎች ፍቀድ (--model-access-mode all)"
|
||||
},
|
||||
"expiration": {
|
||||
"title": "የቁልፍ ጊዜ ማብቂያ",
|
||||
|
||||
@@ -123,7 +123,9 @@
|
||||
"maxCostOpt": "الحد الأقصى للتكلفة اليومية (USD)",
|
||||
"allowedModelsOpt": "قائمة بالنماذج المسموح بها مفصولة بفواصل",
|
||||
"nothingToSet": "لم يتم توفير أي حقول للسياسة. استخدم --rate-limit أو --max-cost أو --allowed-models.",
|
||||
"updated": "تم تحديث السياسة."
|
||||
"updated": "تم تحديث السياسة.",
|
||||
"modelAccessModeOpt": "وضع الوصول إلى النماذج (all | restricted)",
|
||||
"unrestrictedOpt": "السماح بجميع النماذج (--model-access-mode all)"
|
||||
},
|
||||
"expiration": {
|
||||
"title": "انتهاء صلاحية المفتاح",
|
||||
|
||||
@@ -123,7 +123,9 @@
|
||||
"maxCostOpt": "Gündəlik maksimum xərc (USD)",
|
||||
"allowedModelsOpt": "İcazə verilən modellərin vergüllə ayrılmış siyahısı",
|
||||
"nothingToSet": "Heç bir siyasət sahəsi təqdim edilməyib. --rate-limit, --max-cost və ya --allowed-models istifadə edin.",
|
||||
"updated": "Siyasət yeniləndi."
|
||||
"updated": "Siyasət yeniləndi.",
|
||||
"modelAccessModeOpt": "Modelə giriş rejimi (all | restricted)",
|
||||
"unrestrictedOpt": "Bütün modellərə icazə ver (--model-access-mode all)"
|
||||
},
|
||||
"expiration": {
|
||||
"title": "Açarın etibarlılıq müddəti",
|
||||
|
||||
@@ -123,7 +123,9 @@
|
||||
"maxCostOpt": "Максимален разход на ден (USD)",
|
||||
"allowedModelsOpt": "Списък с разрешени модели, разделени със запетаи",
|
||||
"nothingToSet": "Не са предоставени полета за политиката. Използвайте --rate-limit, --max-cost или --allowed-models.",
|
||||
"updated": "Политиката е актуализирана."
|
||||
"updated": "Политиката е актуализирана.",
|
||||
"modelAccessModeOpt": "Режим на достъп до модели (all | restricted)",
|
||||
"unrestrictedOpt": "Разрешаване на всички модели (--model-access-mode all)"
|
||||
},
|
||||
"expiration": {
|
||||
"title": "Изтичане на валидността на ключа",
|
||||
|
||||
@@ -123,7 +123,9 @@
|
||||
"maxCostOpt": "প্রতিদিনের সর্বোচ্চ খরচ (USD)",
|
||||
"allowedModelsOpt": "অনুমোদিত মডেলগুলোর কমা-বিভাজিত তালিকা",
|
||||
"nothingToSet": "কোনো নীতি ফিল্ড দেওয়া হয়নি। --rate-limit, --max-cost, অথবা --allowed-models ব্যবহার করুন।",
|
||||
"updated": "নীতি আপডেট করা হয়েছে।"
|
||||
"updated": "নীতি আপডেট করা হয়েছে।",
|
||||
"modelAccessModeOpt": "মডেল অ্যাক্সেস মোড (all | restricted)",
|
||||
"unrestrictedOpt": "সব মডেল অনুমোদন করুন (--model-access-mode all)"
|
||||
},
|
||||
"expiration": {
|
||||
"title": "কী-এর মেয়াদ শেষ হওয়া",
|
||||
|
||||
@@ -123,7 +123,9 @@
|
||||
"maxCostOpt": "Maksimalni trošak po danu (USD)",
|
||||
"allowedModelsOpt": "Lista dozvoljenih modela odvojena zarezima",
|
||||
"nothingToSet": "Nisu navedena polja polise. Koristite --rate-limit, --max-cost ili --allowed-models.",
|
||||
"updated": "Polisa je ažurirana."
|
||||
"updated": "Polisa je ažurirana.",
|
||||
"modelAccessModeOpt": "Način pristupa modelima (all | restricted)",
|
||||
"unrestrictedOpt": "Dozvoli sve modele (--model-access-mode all)"
|
||||
},
|
||||
"expiration": {
|
||||
"title": "Istek ključa",
|
||||
|
||||
@@ -123,7 +123,9 @@
|
||||
"maxCostOpt": "Maximální náklady za den (USD)",
|
||||
"allowedModelsOpt": "Čárkami oddělený seznam povolených modelů",
|
||||
"nothingToSet": "Nebyla zadána žádná pole zásad. Použijte --rate-limit, --max-cost nebo --allowed-models.",
|
||||
"updated": "Zásady byly aktualizovány."
|
||||
"updated": "Zásady byly aktualizovány.",
|
||||
"modelAccessModeOpt": "Režim přístupu k modelům (all | restricted)",
|
||||
"unrestrictedOpt": "Povolit všechny modely (--model-access-mode all)"
|
||||
},
|
||||
"expiration": {
|
||||
"title": "Vypršení platnosti klíče",
|
||||
|
||||
@@ -123,7 +123,9 @@
|
||||
"maxCostOpt": "Maks. omkostning pr. dag (USD)",
|
||||
"allowedModelsOpt": "Kommaadskilt liste over tilladte modeller",
|
||||
"nothingToSet": "Der blev ikke angivet nogen politikfelter. Brug --rate-limit, --max-cost eller --allowed-models.",
|
||||
"updated": "Politikken blev opdateret."
|
||||
"updated": "Politikken blev opdateret.",
|
||||
"modelAccessModeOpt": "Adgangstilstand for modeller (all | restricted)",
|
||||
"unrestrictedOpt": "Tillad alle modeller (--model-access-mode all)"
|
||||
},
|
||||
"expiration": {
|
||||
"title": "Nøgleudløb",
|
||||
|
||||
@@ -123,7 +123,9 @@
|
||||
"maxCostOpt": "Maximale Kosten pro Tag (USD)",
|
||||
"allowedModelsOpt": "Kommagetrennte Liste zulässiger Modelle",
|
||||
"nothingToSet": "Keine Richtlinienfelder angegeben. Verwenden Sie --rate-limit, --max-cost oder --allowed-models.",
|
||||
"updated": "Richtlinie aktualisiert."
|
||||
"updated": "Richtlinie aktualisiert.",
|
||||
"modelAccessModeOpt": "Modellzugriffsmodus (all | restricted)",
|
||||
"unrestrictedOpt": "Alle Modelle erlauben (--model-access-mode all)"
|
||||
},
|
||||
"expiration": {
|
||||
"title": "Schlüsselablauf",
|
||||
|
||||
@@ -123,7 +123,9 @@
|
||||
"maxCostOpt": "Μέγιστο κόστος ανά ημέρα (USD)",
|
||||
"allowedModelsOpt": "Λίστα επιτρεπόμενων μοντέλων διαχωρισμένη με κόμμα",
|
||||
"nothingToSet": "Δεν παρασχέθηκαν πεδία πολιτικής. Χρησιμοποιήστε --rate-limit, --max-cost ή --allowed-models.",
|
||||
"updated": "Η πολιτική ενημερώθηκε."
|
||||
"updated": "Η πολιτική ενημερώθηκε.",
|
||||
"modelAccessModeOpt": "Λειτουργία πρόσβασης μοντέλων (all | restricted)",
|
||||
"unrestrictedOpt": "Να επιτρέπονται όλα τα μοντέλα (--model-access-mode all)"
|
||||
},
|
||||
"expiration": {
|
||||
"title": "Λήξη Κλειδιού",
|
||||
|
||||
@@ -123,7 +123,9 @@
|
||||
"maxCostOpt": "Max cost per day (USD)",
|
||||
"allowedModelsOpt": "Comma-separated list of allowed models",
|
||||
"nothingToSet": "No policy fields provided. Use --rate-limit, --max-cost, or --allowed-models.",
|
||||
"updated": "Policy updated."
|
||||
"updated": "Policy updated.",
|
||||
"modelAccessModeOpt": "Model access mode (all | restricted)",
|
||||
"unrestrictedOpt": "Allow all models (--model-access-mode all)"
|
||||
},
|
||||
"expiration": {
|
||||
"title": "Key Expiration",
|
||||
|
||||
@@ -123,7 +123,9 @@
|
||||
"maxCostOpt": "Coste máximo por día (USD)",
|
||||
"allowedModelsOpt": "Lista de modelos permitidos separados por comas",
|
||||
"nothingToSet": "No se proporcionaron campos de política. Usa --rate-limit, --max-cost o --allowed-models.",
|
||||
"updated": "Política actualizada."
|
||||
"updated": "Política actualizada.",
|
||||
"modelAccessModeOpt": "Modo de acceso a modelos (all | restricted)",
|
||||
"unrestrictedOpt": "Permitir todos los modelos (--model-access-mode all)"
|
||||
},
|
||||
"expiration": {
|
||||
"title": "Caducidad de claves",
|
||||
|
||||
@@ -123,7 +123,9 @@
|
||||
"maxCostOpt": "Maksimaalne kulu päevas (USD)",
|
||||
"allowedModelsOpt": "Komadega eraldatud lubatud mudelite loend",
|
||||
"nothingToSet": "Reeglistiku välju ei esitatud. Kasuta --rate-limit, --max-cost või --allowed-models.",
|
||||
"updated": "Reeglistik on uuendatud."
|
||||
"updated": "Reeglistik on uuendatud.",
|
||||
"modelAccessModeOpt": "Mudelite juurdepääsurežiim (all | restricted)",
|
||||
"unrestrictedOpt": "Luba kõik mudelid (--model-access-mode all)"
|
||||
},
|
||||
"expiration": {
|
||||
"title": "Võtme kehtivusaeg",
|
||||
|
||||
@@ -123,7 +123,9 @@
|
||||
"maxCostOpt": "حداکثر هزینه روزانه (USD)",
|
||||
"allowedModelsOpt": "فهرست مدلهای مجاز، با ویرگول از هم جداشده",
|
||||
"nothingToSet": "هیچ فیلدی برای سیاست ارائه نشده است. از --rate-limit، --max-cost یا --allowed-models استفاده کنید.",
|
||||
"updated": "سیاست بهروزرسانی شد."
|
||||
"updated": "سیاست بهروزرسانی شد.",
|
||||
"modelAccessModeOpt": "حالت دسترسی به مدلها (all | restricted)",
|
||||
"unrestrictedOpt": "اجازه دادن به همه مدلها (--model-access-mode all)"
|
||||
},
|
||||
"expiration": {
|
||||
"title": "انقضای کلید",
|
||||
|
||||
@@ -123,7 +123,9 @@
|
||||
"maxCostOpt": "Enimmäiskustannus päivässä (USD)",
|
||||
"allowedModelsOpt": "Pilkuilla eroteltu luettelo sallituista malleista",
|
||||
"nothingToSet": "Käytäntökenttiä ei annettu. Käytä valintaa --rate-limit, --max-cost tai --allowed-models.",
|
||||
"updated": "Käytäntö päivitettiin."
|
||||
"updated": "Käytäntö päivitettiin.",
|
||||
"modelAccessModeOpt": "Mallien käyttötila (all | restricted)",
|
||||
"unrestrictedOpt": "Salli kaikki mallit (--model-access-mode all)"
|
||||
},
|
||||
"expiration": {
|
||||
"title": "Avaimen vanheneminen",
|
||||
|
||||
@@ -123,7 +123,9 @@
|
||||
"maxCostOpt": "Coût maximal par jour (USD)",
|
||||
"allowedModelsOpt": "Liste des modèles autorisés, séparés par des virgules",
|
||||
"nothingToSet": "Aucun champ de politique fourni. Utilisez --rate-limit, --max-cost ou --allowed-models.",
|
||||
"updated": "Politique mise à jour."
|
||||
"updated": "Politique mise à jour.",
|
||||
"modelAccessModeOpt": "Mode d’accès aux modèles (all | restricted)",
|
||||
"unrestrictedOpt": "Autoriser tous les modèles (--model-access-mode all)"
|
||||
},
|
||||
"expiration": {
|
||||
"title": "Expiration des clés",
|
||||
|
||||
@@ -123,7 +123,9 @@
|
||||
"maxCostOpt": "Costas uasta in aghaidh an lae (USD)",
|
||||
"allowedModelsOpt": "Liosta de mhúnlaí ceadaithe scartha le camóga",
|
||||
"nothingToSet": "Níor soláthraíodh aon réimsí polasaí. Úsáid --rate-limit, --max-cost, nó --allowed-models.",
|
||||
"updated": "Polasaí nuashonraithe."
|
||||
"updated": "Polasaí nuashonraithe.",
|
||||
"modelAccessModeOpt": "Mód rochtana samhlacha (all | restricted)",
|
||||
"unrestrictedOpt": "Ceadaigh gach samhail (--model-access-mode all)"
|
||||
},
|
||||
"expiration": {
|
||||
"title": "Seanlá Eochrach",
|
||||
|
||||
@@ -123,7 +123,9 @@
|
||||
"maxCostOpt": "પ્રતિ દિવસ મહત્તમ ખર્ચ (USD)",
|
||||
"allowedModelsOpt": "મંજૂર મોડેલોની અલ્પવિરામથી અલગ કરેલી સૂચિ",
|
||||
"nothingToSet": "કોઈ નીતિ ફીલ્ડ આપવામાં આવી નથી. --rate-limit, --max-cost, અથવા --allowed-models નો ઉપયોગ કરો.",
|
||||
"updated": "નીતિ અપડેટ થઈ."
|
||||
"updated": "નીતિ અપડેટ થઈ.",
|
||||
"modelAccessModeOpt": "મોડેલ ઍક્સેસ મોડ (all | restricted)",
|
||||
"unrestrictedOpt": "બધા મોડેલને મંજૂરી આપો (--model-access-mode all)"
|
||||
},
|
||||
"expiration": {
|
||||
"title": "કીની સમાપ્તિ",
|
||||
|
||||
@@ -123,7 +123,9 @@
|
||||
"maxCostOpt": "Matsakaicin kuɗi a rana (USD)",
|
||||
"allowedModelsOpt": "Jerin samfuran da aka yarda da su, waɗanda aka raba da waƙafi",
|
||||
"nothingToSet": "Ba a bayar da wani filin manufa ba. Yi amfani da --rate-limit, --max-cost, ko --allowed-models.",
|
||||
"updated": "An sabunta manufar."
|
||||
"updated": "An sabunta manufar.",
|
||||
"modelAccessModeOpt": "Yanayin samun damar samfura (all | restricted)",
|
||||
"unrestrictedOpt": "Ba da izinin duk samfura (--model-access-mode all)"
|
||||
},
|
||||
"expiration": {
|
||||
"title": "Ƙarewar Wa'adin Maɓalli",
|
||||
|
||||
@@ -123,7 +123,9 @@
|
||||
"maxCostOpt": "עלות מרבית ליום (USD)",
|
||||
"allowedModelsOpt": "רשימה מופרדת בפסיקים של מודלים מורשים",
|
||||
"nothingToSet": "לא סופקו שדות מדיניות. השתמשו ב---rate-limit, ב---max-cost או ב---allowed-models.",
|
||||
"updated": "המדיניות עודכנה."
|
||||
"updated": "המדיניות עודכנה.",
|
||||
"modelAccessModeOpt": "מצב גישה למודלים (all | restricted)",
|
||||
"unrestrictedOpt": "אפשר את כל המודלים (--model-access-mode all)"
|
||||
},
|
||||
"expiration": {
|
||||
"title": "תפוגת מפתח",
|
||||
|
||||
@@ -123,7 +123,9 @@
|
||||
"maxCostOpt": "प्रति दिन अधिकतम लागत (USD)",
|
||||
"allowedModelsOpt": "अनुमत मॉडल की कॉमा से अलग की गई सूची",
|
||||
"nothingToSet": "कोई नीति फ़ील्ड प्रदान नहीं की गई। --rate-limit, --max-cost, या --allowed-models का उपयोग करें।",
|
||||
"updated": "नीति अपडेट की गई।"
|
||||
"updated": "नीति अपडेट की गई।",
|
||||
"modelAccessModeOpt": "मॉडल एक्सेस मोड (all | restricted)",
|
||||
"unrestrictedOpt": "सभी मॉडल की अनुमति दें (--model-access-mode all)"
|
||||
},
|
||||
"expiration": {
|
||||
"title": "कुंजी की समाप्ति",
|
||||
|
||||
@@ -123,7 +123,9 @@
|
||||
"maxCostOpt": "Maksimalni trošak po danu (USD)",
|
||||
"allowedModelsOpt": "Popis dopuštenih modela odvojen zarezima",
|
||||
"nothingToSet": "Nisu navedena polja pravila. Koristite --rate-limit, --max-cost ili --allowed-models.",
|
||||
"updated": "Pravila ažurirana."
|
||||
"updated": "Pravila ažurirana.",
|
||||
"modelAccessModeOpt": "Način pristupa modelima (all | restricted)",
|
||||
"unrestrictedOpt": "Dopusti sve modele (--model-access-mode all)"
|
||||
},
|
||||
"expiration": {
|
||||
"title": "Istek ključa",
|
||||
|
||||
@@ -123,7 +123,9 @@
|
||||
"maxCostOpt": "Napi maximális költség (USD)",
|
||||
"allowedModelsOpt": "Engedélyezett modellek vesszővel elválasztott listája",
|
||||
"nothingToSet": "Nincsenek megadva házirendmezők. Használja a --rate-limit, --max-cost vagy --allowed-models kapcsolót.",
|
||||
"updated": "A házirend frissítve."
|
||||
"updated": "A házirend frissítve.",
|
||||
"modelAccessModeOpt": "Modellhozzáférési mód (all | restricted)",
|
||||
"unrestrictedOpt": "Minden modell engedélyezése (--model-access-mode all)"
|
||||
},
|
||||
"expiration": {
|
||||
"title": "Kulcs lejárata",
|
||||
|
||||
@@ -123,7 +123,9 @@
|
||||
"maxCostOpt": "Օրական առավելագույն ծախսը (USD)",
|
||||
"allowedModelsOpt": "Թույլատրված մոդելների՝ ստորակետերով բաժանված ցանկը",
|
||||
"nothingToSet": "Քաղաքականության դաշտեր չեն տրամադրվել։ Օգտագործեք --rate-limit, --max-cost կամ --allowed-models։",
|
||||
"updated": "Քաղաքականությունը թարմացվել է։"
|
||||
"updated": "Քաղաքականությունը թարմացվել է։",
|
||||
"modelAccessModeOpt": "Մոդելների հասանելիության ռեժիմ (all | restricted)",
|
||||
"unrestrictedOpt": "Թույլատրել բոլոր մոդելները (--model-access-mode all)"
|
||||
},
|
||||
"expiration": {
|
||||
"title": "Բանալու վավերականության ժամկետի ավարտ",
|
||||
|
||||
@@ -123,7 +123,9 @@
|
||||
"maxCostOpt": "Biaya maksimum per hari (USD)",
|
||||
"allowedModelsOpt": "Daftar model yang diizinkan, dipisahkan dengan koma",
|
||||
"nothingToSet": "Tidak ada kolom kebijakan yang diberikan. Gunakan --rate-limit, --max-cost, atau --allowed-models.",
|
||||
"updated": "Kebijakan telah diperbarui."
|
||||
"updated": "Kebijakan telah diperbarui.",
|
||||
"modelAccessModeOpt": "Mode akses model (all | restricted)",
|
||||
"unrestrictedOpt": "Izinkan semua model (--model-access-mode all)"
|
||||
},
|
||||
"expiration": {
|
||||
"title": "Kedaluwarsa Kunci",
|
||||
|
||||
@@ -123,7 +123,9 @@
|
||||
"maxCostOpt": "Ọnụ ahịa kachasị kwa ụbọchị (USD)",
|
||||
"allowedModelsOpt": "Ndepụta ụdịdị e kwere ekwe nke rikoma kewara",
|
||||
"nothingToSet": "Enweghị mpaghara iwu e nyere. Jiri --rate-limit, --max-cost, ma ọ bụ --allowed-models.",
|
||||
"updated": "Emelitela iwu."
|
||||
"updated": "Emelitela iwu.",
|
||||
"modelAccessModeOpt": "Ụdị ohere ịnweta ụdị (all | restricted)",
|
||||
"unrestrictedOpt": "Kwe ka ụdị niile (--model-access-mode all)"
|
||||
},
|
||||
"expiration": {
|
||||
"title": "Mmebi Oge Igodo",
|
||||
|
||||
@@ -123,7 +123,9 @@
|
||||
"maxCostOpt": "Costo massimo giornaliero (USD)",
|
||||
"allowedModelsOpt": "Elenco separato da virgole dei modelli consentiti",
|
||||
"nothingToSet": "Nessun campo dei criteri specificato. Usa --rate-limit, --max-cost o --allowed-models.",
|
||||
"updated": "Criteri aggiornati."
|
||||
"updated": "Criteri aggiornati.",
|
||||
"modelAccessModeOpt": "Modalità di accesso ai modelli (all | restricted)",
|
||||
"unrestrictedOpt": "Consenti tutti i modelli (--model-access-mode all)"
|
||||
},
|
||||
"expiration": {
|
||||
"title": "Scadenza della chiave",
|
||||
|
||||
@@ -123,7 +123,9 @@
|
||||
"maxCostOpt": "1 日あたりの最大コスト(USD)",
|
||||
"allowedModelsOpt": "許可するモデルのカンマ区切りリスト",
|
||||
"nothingToSet": "ポリシーフィールドが指定されていません。--rate-limit、--max-cost、または --allowed-models を使用してください。",
|
||||
"updated": "ポリシーを更新しました。"
|
||||
"updated": "ポリシーを更新しました。",
|
||||
"modelAccessModeOpt": "モデルアクセスモード (all | restricted)",
|
||||
"unrestrictedOpt": "すべてのモデルを許可 (--model-access-mode all)"
|
||||
},
|
||||
"expiration": {
|
||||
"title": "キーの有効期限",
|
||||
|
||||
@@ -123,7 +123,9 @@
|
||||
"maxCostOpt": "მაქსიმალური დღიური ხარჯი (USD)",
|
||||
"allowedModelsOpt": "ნებადართული მოდელების მძიმით გამოყოფილი სია",
|
||||
"nothingToSet": "პოლიტიკის ველები არ არის მოწოდებული. გამოიყენეთ --rate-limit, --max-cost ან --allowed-models.",
|
||||
"updated": "პოლიტიკა განახლდა."
|
||||
"updated": "პოლიტიკა განახლდა.",
|
||||
"modelAccessModeOpt": "მოდელებზე წვდომის რეჟიმი (all | restricted)",
|
||||
"unrestrictedOpt": "ყველა მოდელის დაშვება (--model-access-mode all)"
|
||||
},
|
||||
"expiration": {
|
||||
"title": "გასაღების მოქმედების ვადა",
|
||||
|
||||
@@ -123,7 +123,9 @@
|
||||
"maxCostOpt": "ថ្លៃចំណាយអតិបរមាក្នុងមួយថ្ងៃ (USD)",
|
||||
"allowedModelsOpt": "បញ្ជីម៉ូដែលដែលអនុញ្ញាត បំបែកដោយសញ្ញាក្បៀស",
|
||||
"nothingToSet": "មិនមានវាលគោលការណ៍ដែលបានផ្ដល់ទេ។ ប្រើ --rate-limit, --max-cost ឬ --allowed-models។",
|
||||
"updated": "បានធ្វើបច្ចុប្បន្នភាពគោលការណ៍។"
|
||||
"updated": "បានធ្វើបច្ចុប្បន្នភាពគោលការណ៍។",
|
||||
"modelAccessModeOpt": "របៀបចូលប្រើម៉ូដែល (all | restricted)",
|
||||
"unrestrictedOpt": "អនុញ្ញាតម៉ូដែលទាំងអស់ (--model-access-mode all)"
|
||||
},
|
||||
"expiration": {
|
||||
"title": "ការផុតកំណត់សោ",
|
||||
|
||||
@@ -123,7 +123,9 @@
|
||||
"maxCostOpt": "ಪ್ರತಿ ದಿನದ ಗರಿಷ್ಠ ವೆಚ್ಚ (USD)",
|
||||
"allowedModelsOpt": "ಅನುಮತಿಸಲಾದ ಮಾದರಿಗಳ ಅಲ್ಪವಿರಾಮದಿಂದ ಬೇರ್ಪಡಿಸಿದ ಪಟ್ಟಿ",
|
||||
"nothingToSet": "ಯಾವುದೇ ನೀತಿ ಕ್ಷೇತ್ರಗಳನ್ನು ಒದಗಿಸಲಾಗಿಲ್ಲ. --rate-limit, --max-cost, ಅಥವಾ --allowed-models ಬಳಸಿ.",
|
||||
"updated": "ನೀತಿಯನ್ನು ನವೀಕರಿಸಲಾಗಿದೆ."
|
||||
"updated": "ನೀತಿಯನ್ನು ನವೀಕರಿಸಲಾಗಿದೆ.",
|
||||
"modelAccessModeOpt": "ಮಾದರಿ ಪ್ರವೇಶ ಮೋಡ್ (all | restricted)",
|
||||
"unrestrictedOpt": "ಎಲ್ಲಾ ಮಾದರಿಗಳನ್ನು ಅನುಮತಿಸಿ (--model-access-mode all)"
|
||||
},
|
||||
"expiration": {
|
||||
"title": "ಕೀ ಅವಧಿ ಮುಕ್ತಾಯ",
|
||||
|
||||
@@ -123,7 +123,9 @@
|
||||
"maxCostOpt": "일일 최대 비용(USD)",
|
||||
"allowedModelsOpt": "허용된 모델의 쉼표로 구분된 목록",
|
||||
"nothingToSet": "제공된 정책 필드가 없습니다. --rate-limit, --max-cost 또는 --allowed-models를 사용하세요.",
|
||||
"updated": "정책이 업데이트되었습니다."
|
||||
"updated": "정책이 업데이트되었습니다.",
|
||||
"modelAccessModeOpt": "모델 접근 모드 (all | restricted)",
|
||||
"unrestrictedOpt": "모든 모델 허용 (--model-access-mode all)"
|
||||
},
|
||||
"expiration": {
|
||||
"title": "키 만료",
|
||||
|
||||
@@ -123,7 +123,9 @@
|
||||
"maxCostOpt": "Didžiausios išlaidos per dieną (USD)",
|
||||
"allowedModelsOpt": "Kableliais atskirtas leidžiamų modelių sąrašas",
|
||||
"nothingToSet": "Nepateiktas nė vienas politikos laukas. Naudokite --rate-limit, --max-cost arba --allowed-models.",
|
||||
"updated": "Politika atnaujinta."
|
||||
"updated": "Politika atnaujinta.",
|
||||
"modelAccessModeOpt": "Prieigos prie modelių režimas (all | restricted)",
|
||||
"unrestrictedOpt": "Leisti visus modelius (--model-access-mode all)"
|
||||
},
|
||||
"expiration": {
|
||||
"title": "Rakto galiojimo pabaiga",
|
||||
|
||||
@@ -123,7 +123,9 @@
|
||||
"maxCostOpt": "Maksimālā izmaksas dienā (USD)",
|
||||
"allowedModelsOpt": "Ar komatiem atdalīts atļauto modeļu saraksts",
|
||||
"nothingToSet": "Nav sniegtu politikas lauku. Izmantojiet --rate-limit, --max-cost vai --allowed-models.",
|
||||
"updated": "Politika atjaunināta."
|
||||
"updated": "Politika atjaunināta.",
|
||||
"modelAccessModeOpt": "Modeļu piekļuves režīms (all | restricted)",
|
||||
"unrestrictedOpt": "Atļaut visus modeļus (--model-access-mode all)"
|
||||
},
|
||||
"expiration": {
|
||||
"title": "Atslēgu derīguma termiņš",
|
||||
|
||||
@@ -123,7 +123,9 @@
|
||||
"maxCostOpt": "പ്രതിദിന പരമാവധി ചെലവ് (USD)",
|
||||
"allowedModelsOpt": "അനുവദിച്ച മോഡലുകളുടെ കോമ ഉപയോഗിച്ച് വേർതിരിച്ച പട്ടിക",
|
||||
"nothingToSet": "നയ ഫീൽഡുകളൊന്നും നൽകിയിട്ടില്ല. --rate-limit, --max-cost, അല്ലെങ്കിൽ --allowed-models ഉപയോഗിക്കുക.",
|
||||
"updated": "നയം അപ്ഡേറ്റ് ചെയ്തു."
|
||||
"updated": "നയം അപ്ഡേറ്റ് ചെയ്തു.",
|
||||
"modelAccessModeOpt": "മോഡൽ ആക്സസ് മോഡ് (all | restricted)",
|
||||
"unrestrictedOpt": "എല്ലാ മോഡലുകളും അനുവദിക്കുക (--model-access-mode all)"
|
||||
},
|
||||
"expiration": {
|
||||
"title": "കീ കാലഹരണപ്പെടൽ",
|
||||
|
||||
@@ -123,7 +123,9 @@
|
||||
"maxCostOpt": "प्रतिदिन कमाल खर्च (USD)",
|
||||
"allowedModelsOpt": "अनुमत मॉडेल्सची स्वल्पविरामाने विभक्त केलेली सूची",
|
||||
"nothingToSet": "कोणतीही धोरण फील्ड प्रदान केलेली नाहीत. --rate-limit, --max-cost किंवा --allowed-models वापरा.",
|
||||
"updated": "धोरण अपडेट केले."
|
||||
"updated": "धोरण अपडेट केले.",
|
||||
"modelAccessModeOpt": "मॉडेल प्रवेश मोड (all | restricted)",
|
||||
"unrestrictedOpt": "सर्व मॉडेलना परवानगी द्या (--model-access-mode all)"
|
||||
},
|
||||
"expiration": {
|
||||
"title": "कीची कालबाह्यता",
|
||||
|
||||
@@ -123,7 +123,9 @@
|
||||
"maxCostOpt": "Kos maksimum sehari (USD)",
|
||||
"allowedModelsOpt": "Senarai model yang dibenarkan, dipisahkan dengan koma",
|
||||
"nothingToSet": "Tiada medan dasar diberikan. Gunakan --rate-limit, --max-cost, atau --allowed-models.",
|
||||
"updated": "Dasar telah dikemas kini."
|
||||
"updated": "Dasar telah dikemas kini.",
|
||||
"modelAccessModeOpt": "Mod akses model (all | restricted)",
|
||||
"unrestrictedOpt": "Benarkan semua model (--model-access-mode all)"
|
||||
},
|
||||
"expiration": {
|
||||
"title": "Tamat Tempoh Kunci",
|
||||
|
||||
@@ -123,7 +123,9 @@
|
||||
"maxCostOpt": "Spiża massima kuljum (USD)",
|
||||
"allowedModelsOpt": "Lista ta' mudelli permessi separati b'virgola",
|
||||
"nothingToSet": "L-ebda qasam ta' politika pprovdut. Uża --rate-limit, --max-cost, jew --allowed-models.",
|
||||
"updated": "Politika aġġornata."
|
||||
"updated": "Politika aġġornata.",
|
||||
"modelAccessModeOpt": "Modalità ta’ aċċess għall-mudelli (all | restricted)",
|
||||
"unrestrictedOpt": "Ippermetti l-mudelli kollha (--model-access-mode all)"
|
||||
},
|
||||
"expiration": {
|
||||
"title": "Skadenza taċ-Ċavetta",
|
||||
|
||||
@@ -123,7 +123,9 @@
|
||||
"maxCostOpt": "တစ်ရက်လျှင် အများဆုံးကုန်ကျစရိတ် (USD)",
|
||||
"allowedModelsOpt": "အသုံးပြုခွင့်ပြုထားသော မော်ဒယ်များ၏ ကော်မာခြားစာရင်း",
|
||||
"nothingToSet": "မူဝါဒအကွက်များ ထည့်သွင်းပေးထားခြင်း မရှိပါ။ --rate-limit၊ --max-cost သို့မဟုတ် --allowed-models ကို အသုံးပြုပါ။",
|
||||
"updated": "မူဝါဒကို အပ်ဒိတ်လုပ်ပြီးပါပြီ။"
|
||||
"updated": "မူဝါဒကို အပ်ဒိတ်လုပ်ပြီးပါပြီ။",
|
||||
"modelAccessModeOpt": "မော်ဒယ် အသုံးပြုခွင့်မုဒ် (all | restricted)",
|
||||
"unrestrictedOpt": "မော်ဒယ်အားလုံးကို ခွင့်ပြုပါ (--model-access-mode all)"
|
||||
},
|
||||
"expiration": {
|
||||
"title": "ကီးသက်တမ်းကုန်ဆုံးမှု",
|
||||
|
||||
@@ -123,7 +123,9 @@
|
||||
"maxCostOpt": "प्रति दिन अधिकतम लागत (USD)",
|
||||
"allowedModelsOpt": "अनुमति प्राप्त मोडेलहरूको अल्पविरामले छुट्याइएको सूची",
|
||||
"nothingToSet": "कुनै नीति फिल्ड प्रदान गरिएको छैन। --rate-limit, --max-cost, वा --allowed-models प्रयोग गर्नुहोस्।",
|
||||
"updated": "नीति अद्यावधिक गरियो।"
|
||||
"updated": "नीति अद्यावधिक गरियो।",
|
||||
"modelAccessModeOpt": "मोडेल पहुँच मोड (all | restricted)",
|
||||
"unrestrictedOpt": "सबै मोडेललाई अनुमति दिनुहोस् (--model-access-mode all)"
|
||||
},
|
||||
"expiration": {
|
||||
"title": "कुञ्जीको म्याद समाप्ति",
|
||||
|
||||
@@ -123,7 +123,9 @@
|
||||
"maxCostOpt": "Maximale kosten per dag (USD)",
|
||||
"allowedModelsOpt": "Door komma's gescheiden lijst met toegestane modellen",
|
||||
"nothingToSet": "Geen beleidsvelden opgegeven. Gebruik --rate-limit, --max-cost of --allowed-models.",
|
||||
"updated": "Beleid bijgewerkt."
|
||||
"updated": "Beleid bijgewerkt.",
|
||||
"modelAccessModeOpt": "Toegangsmodus voor modellen (all | restricted)",
|
||||
"unrestrictedOpt": "Alle modellen toestaan (--model-access-mode all)"
|
||||
},
|
||||
"expiration": {
|
||||
"title": "Vervaldatum van sleutel",
|
||||
|
||||
@@ -123,7 +123,9 @@
|
||||
"maxCostOpt": "Maksimal kostnad per dag (USD)",
|
||||
"allowedModelsOpt": "Kommaseparert liste over tillatte modeller",
|
||||
"nothingToSet": "Ingen policyfelter angitt. Bruk --rate-limit, --max-cost eller --allowed-models.",
|
||||
"updated": "Policy oppdatert."
|
||||
"updated": "Policy oppdatert.",
|
||||
"modelAccessModeOpt": "Tilgangsmodus for modeller (all | restricted)",
|
||||
"unrestrictedOpt": "Tillat alle modeller (--model-access-mode all)"
|
||||
},
|
||||
"expiration": {
|
||||
"title": "Nøkkelutløp",
|
||||
|
||||
@@ -123,7 +123,9 @@
|
||||
"maxCostOpt": "ପ୍ରତିଦିନ ସର୍ବାଧିକ ଖର୍ଚ୍ଚ (USD)",
|
||||
"allowedModelsOpt": "ଅନୁମୋଦିତ ମଡେଲ୍ଗୁଡ଼ିକର କମା-ପୃଥକ ତାଲିକା",
|
||||
"nothingToSet": "କୌଣସି ନୀତି ଫିଲ୍ଡ ପ୍ରଦାନ କରାଯାଇନାହିଁ। --rate-limit, --max-cost, କିମ୍ବା --allowed-models ବ୍ୟବହାର କରନ୍ତୁ।",
|
||||
"updated": "ନୀତି ଅପଡେଟ୍ କରାଗଲା।"
|
||||
"updated": "ନୀତି ଅପଡେଟ୍ କରାଗଲା।",
|
||||
"modelAccessModeOpt": "ମଡେଲ୍ ଆକ୍ସେସ୍ ମୋଡ୍ (all | restricted)",
|
||||
"unrestrictedOpt": "ସମସ୍ତ ମଡେଲ୍ ଅନୁମତି ଦିଅନ୍ତୁ (--model-access-mode all)"
|
||||
},
|
||||
"expiration": {
|
||||
"title": "କୀର ମିଆଦ ସମାପ୍ତି",
|
||||
|
||||
@@ -123,7 +123,9 @@
|
||||
"maxCostOpt": "ਪ੍ਰਤੀ ਦਿਨ ਵੱਧ ਤੋਂ ਵੱਧ ਲਾਗਤ (USD)",
|
||||
"allowedModelsOpt": "ਮਨਜ਼ੂਰਸ਼ੁਦਾ ਮਾਡਲਾਂ ਦੀ ਕਾਮਿਆਂ ਨਾਲ ਵੱਖ ਕੀਤੀ ਸੂਚੀ",
|
||||
"nothingToSet": "ਕੋਈ ਨੀਤੀ ਖੇਤਰ ਪ੍ਰਦਾਨ ਨਹੀਂ ਕੀਤਾ ਗਿਆ। --rate-limit, --max-cost, ਜਾਂ --allowed-models ਵਰਤੋ।",
|
||||
"updated": "ਨੀਤੀ ਅੱਪਡੇਟ ਕੀਤੀ ਗਈ।"
|
||||
"updated": "ਨੀਤੀ ਅੱਪਡੇਟ ਕੀਤੀ ਗਈ।",
|
||||
"modelAccessModeOpt": "ਮਾਡਲ ਪਹੁੰਚ ਮੋਡ (all | restricted)",
|
||||
"unrestrictedOpt": "ਸਾਰੇ ਮਾਡਲਾਂ ਨੂੰ ਇਜਾਜ਼ਤ ਦਿਓ (--model-access-mode all)"
|
||||
},
|
||||
"expiration": {
|
||||
"title": "ਕੁੰਜੀ ਦੀ ਮਿਆਦ ਸਮਾਪਤੀ",
|
||||
|
||||
@@ -123,7 +123,9 @@
|
||||
"maxCostOpt": "Pinakamataas na gastos kada araw (USD)",
|
||||
"allowedModelsOpt": "Listahan ng mga pinapayagang model na pinaghihiwalay ng kuwit",
|
||||
"nothingToSet": "Walang ibinigay na field ng patakaran. Gamitin ang --rate-limit, --max-cost, o --allowed-models.",
|
||||
"updated": "Na-update ang patakaran."
|
||||
"updated": "Na-update ang patakaran.",
|
||||
"modelAccessModeOpt": "Mode ng access sa modelo (all | restricted)",
|
||||
"unrestrictedOpt": "Payagan ang lahat ng modelo (--model-access-mode all)"
|
||||
},
|
||||
"expiration": {
|
||||
"title": "Pag-expire ng Key",
|
||||
|
||||
@@ -123,7 +123,9 @@
|
||||
"maxCostOpt": "Maksymalny koszt dzienny (USD)",
|
||||
"allowedModelsOpt": "Rozdzielona przecinkami lista dozwolonych modeli",
|
||||
"nothingToSet": "Nie podano żadnych pól zasad. Użyj --rate-limit, --max-cost lub --allowed-models.",
|
||||
"updated": "Zasady zostały zaktualizowane."
|
||||
"updated": "Zasady zostały zaktualizowane.",
|
||||
"modelAccessModeOpt": "Tryb dostępu do modeli (all | restricted)",
|
||||
"unrestrictedOpt": "Zezwól na wszystkie modele (--model-access-mode all)"
|
||||
},
|
||||
"expiration": {
|
||||
"title": "Wygaśnięcie klucza",
|
||||
|
||||
@@ -123,7 +123,9 @@
|
||||
"maxCostOpt": "Custo máximo por dia (USD)",
|
||||
"allowedModelsOpt": "Lista de modelos permitidos (separados por vírgula)",
|
||||
"nothingToSet": "Nenhum campo de política fornecido. Use --rate-limit, --max-cost ou --allowed-models.",
|
||||
"updated": "Política atualizada."
|
||||
"updated": "Política atualizada.",
|
||||
"modelAccessModeOpt": "Modo de acesso aos modelos (all | restricted)",
|
||||
"unrestrictedOpt": "Permitir todos os modelos (--model-access-mode all)"
|
||||
},
|
||||
"expiration": {
|
||||
"title": "Expiração de Chaves",
|
||||
|
||||
@@ -123,7 +123,9 @@
|
||||
"maxCostOpt": "Custo máximo por dia (USD)",
|
||||
"allowedModelsOpt": "Lista de modelos permitidos, separados por vírgulas",
|
||||
"nothingToSet": "Não foram fornecidos campos da política. Utilize --rate-limit, --max-cost ou --allowed-models.",
|
||||
"updated": "Política atualizada."
|
||||
"updated": "Política atualizada.",
|
||||
"modelAccessModeOpt": "Modo de acesso aos modelos (all | restricted)",
|
||||
"unrestrictedOpt": "Permitir todos os modelos (--model-access-mode all)"
|
||||
},
|
||||
"expiration": {
|
||||
"title": "Expiração da chave",
|
||||
|
||||
@@ -123,7 +123,9 @@
|
||||
"maxCostOpt": "Costul maxim pe zi (USD)",
|
||||
"allowedModelsOpt": "Listă de modele permise, separate prin virgulă",
|
||||
"nothingToSet": "Nu au fost furnizate câmpuri pentru politică. Utilizați --rate-limit, --max-cost sau --allowed-models.",
|
||||
"updated": "Politica a fost actualizată."
|
||||
"updated": "Politica a fost actualizată.",
|
||||
"modelAccessModeOpt": "Mod de acces la modele (all | restricted)",
|
||||
"unrestrictedOpt": "Permite toate modelele (--model-access-mode all)"
|
||||
},
|
||||
"expiration": {
|
||||
"title": "Expirarea cheii",
|
||||
|
||||
@@ -123,7 +123,9 @@
|
||||
"maxCostOpt": "Максимальная стоимость в день (USD)",
|
||||
"allowedModelsOpt": "Список разрешённых моделей через запятую",
|
||||
"nothingToSet": "Поля политики не указаны. Используйте --rate-limit, --max-cost или --allowed-models.",
|
||||
"updated": "Политика обновлена."
|
||||
"updated": "Политика обновлена.",
|
||||
"modelAccessModeOpt": "Режим доступа к моделям (all | restricted)",
|
||||
"unrestrictedOpt": "Разрешить все модели (--model-access-mode all)"
|
||||
},
|
||||
"expiration": {
|
||||
"title": "Срок действия ключа",
|
||||
|
||||
@@ -123,7 +123,9 @@
|
||||
"maxCostOpt": "දිනකට උපරිම පිරිවැය (USD)",
|
||||
"allowedModelsOpt": "කොමාවලින් වෙන් කළ, අවසර ලත් මොඩල ලැයිස්තුව",
|
||||
"nothingToSet": "ප්රතිපත්ති ක්ෂේත්ර කිසිවක් ලබා දී නැත. --rate-limit, --max-cost, හෝ --allowed-models භාවිත කරන්න.",
|
||||
"updated": "ප්රතිපත්තිය යාවත්කාලීන කරන ලදී."
|
||||
"updated": "ප්රතිපත්තිය යාවත්කාලීන කරන ලදී.",
|
||||
"modelAccessModeOpt": "මාදිලි ප්රවේශ ආකාරය (all | restricted)",
|
||||
"unrestrictedOpt": "සියලු මාදිලිවලට ඉඩ දෙන්න (--model-access-mode all)"
|
||||
},
|
||||
"expiration": {
|
||||
"title": "යතුරු කල් ඉකුත් වීම",
|
||||
|
||||
@@ -123,7 +123,9 @@
|
||||
"maxCostOpt": "Maximálne náklady za deň (USD)",
|
||||
"allowedModelsOpt": "Zoznam povolených modelov oddelených čiarkami",
|
||||
"nothingToSet": "Neboli zadané žiadne polia zásad. Použite --rate-limit, --max-cost alebo --allowed-models.",
|
||||
"updated": "Zásady boli aktualizované."
|
||||
"updated": "Zásady boli aktualizované.",
|
||||
"modelAccessModeOpt": "Režim prístupu k modelom (all | restricted)",
|
||||
"unrestrictedOpt": "Povoliť všetky modely (--model-access-mode all)"
|
||||
},
|
||||
"expiration": {
|
||||
"title": "Vypršanie platnosti kľúča",
|
||||
|
||||
@@ -123,7 +123,9 @@
|
||||
"maxCostOpt": "Največji strošek na dan (USD)",
|
||||
"allowedModelsOpt": "Seznam dovoljenih modelov, ločenih z vejicami",
|
||||
"nothingToSet": "Podano ni bilo nobeno polje pravilnika. Uporabite --rate-limit, --max-cost ali --allowed-models.",
|
||||
"updated": "Pravilnik je posodobljen."
|
||||
"updated": "Pravilnik je posodobljen.",
|
||||
"modelAccessModeOpt": "Način dostopa do modelov (all | restricted)",
|
||||
"unrestrictedOpt": "Dovoli vse modele (--model-access-mode all)"
|
||||
},
|
||||
"expiration": {
|
||||
"title": "Potek veljavnosti ključa",
|
||||
|
||||
@@ -123,7 +123,9 @@
|
||||
"maxCostOpt": "Maksimalan trošak po danu (USD)",
|
||||
"allowedModelsOpt": "Lista dozvoljenih modela, razdvojena zarezima",
|
||||
"nothingToSet": "Nisu prosleđena polja polise. Koristite --rate-limit, --max-cost, ili --allowed-models.",
|
||||
"updated": "Polisa je ažurirana."
|
||||
"updated": "Polisa je ažurirana.",
|
||||
"modelAccessModeOpt": "Режим приступа моделима (all | restricted)",
|
||||
"unrestrictedOpt": "Дозволи све моделе (--model-access-mode all)"
|
||||
},
|
||||
"expiration": {
|
||||
"title": "Isticanje ključa",
|
||||
|
||||
@@ -123,7 +123,9 @@
|
||||
"maxCostOpt": "Maximal kostnad per dag (USD)",
|
||||
"allowedModelsOpt": "Kommaseparerad lista över tillåtna modeller",
|
||||
"nothingToSet": "Inga policyfält har angetts. Använd --rate-limit, --max-cost eller --allowed-models.",
|
||||
"updated": "Policyn har uppdaterats."
|
||||
"updated": "Policyn har uppdaterats.",
|
||||
"modelAccessModeOpt": "Åtkomstläge för modeller (all | restricted)",
|
||||
"unrestrictedOpt": "Tillåt alla modeller (--model-access-mode all)"
|
||||
},
|
||||
"expiration": {
|
||||
"title": "Nyckelns utgångsdatum",
|
||||
|
||||
@@ -123,7 +123,9 @@
|
||||
"maxCostOpt": "Gharama ya juu kwa siku (USD)",
|
||||
"allowedModelsOpt": "Orodha ya miundo inayoruhusiwa iliyotenganishwa kwa koma",
|
||||
"nothingToSet": "Hakuna sehemu za sera zilizotolewa. Tumia --rate-limit, --max-cost, au --allowed-models.",
|
||||
"updated": "Sera imesasishwa."
|
||||
"updated": "Sera imesasishwa.",
|
||||
"modelAccessModeOpt": "Hali ya ufikiaji wa modeli (all | restricted)",
|
||||
"unrestrictedOpt": "Ruhusu modeli zote (--model-access-mode all)"
|
||||
},
|
||||
"expiration": {
|
||||
"title": "Kuisha kwa Muda wa Ufunguo",
|
||||
|
||||
@@ -123,7 +123,9 @@
|
||||
"maxCostOpt": "ஒரு நாளுக்கான அதிகபட்ச செலவு (USD)",
|
||||
"allowedModelsOpt": "அனுமதிக்கப்பட்ட மாதிரிகளின் காற்புள்ளியால் பிரிக்கப்பட்ட பட்டியல்",
|
||||
"nothingToSet": "கொள்கைப் புலங்கள் எதுவும் வழங்கப்படவில்லை. --rate-limit, --max-cost அல்லது --allowed-models ஐப் பயன்படுத்தவும்.",
|
||||
"updated": "கொள்கை புதுப்பிக்கப்பட்டது."
|
||||
"updated": "கொள்கை புதுப்பிக்கப்பட்டது.",
|
||||
"modelAccessModeOpt": "மாதிரி அணுகல் முறை (all | restricted)",
|
||||
"unrestrictedOpt": "அனைத்து மாதிரிகளையும் அனுமதி (--model-access-mode all)"
|
||||
},
|
||||
"expiration": {
|
||||
"title": "விசை காலாவதி",
|
||||
|
||||
@@ -123,7 +123,9 @@
|
||||
"maxCostOpt": "రోజుకు గరిష్ఠ ఖర్చు (USD)",
|
||||
"allowedModelsOpt": "అనుమతించబడిన మోడళ్ల కామాతో వేరు చేసిన జాబితా",
|
||||
"nothingToSet": "విధాన ఫీల్డ్లు ఏవీ అందించబడలేదు. --rate-limit, --max-cost, లేదా --allowed-models ఉపయోగించండి.",
|
||||
"updated": "విధానం నవీకరించబడింది."
|
||||
"updated": "విధానం నవీకరించబడింది.",
|
||||
"modelAccessModeOpt": "మోడల్ యాక్సెస్ మోడ్ (all | restricted)",
|
||||
"unrestrictedOpt": "అన్ని మోడళ్లను అనుమతించండి (--model-access-mode all)"
|
||||
},
|
||||
"expiration": {
|
||||
"title": "కీ గడువు ముగింపు",
|
||||
|
||||
@@ -123,7 +123,9 @@
|
||||
"maxCostOpt": "ค่าใช้จ่ายสูงสุดต่อวัน (USD)",
|
||||
"allowedModelsOpt": "รายการโมเดลที่อนุญาตโดยคั่นด้วยจุลภาค",
|
||||
"nothingToSet": "ไม่ได้ระบุฟิลด์นโยบาย โปรดใช้ --rate-limit, --max-cost หรือ --allowed-models",
|
||||
"updated": "อัปเดตนโยบายแล้ว"
|
||||
"updated": "อัปเดตนโยบายแล้ว",
|
||||
"modelAccessModeOpt": "โหมดการเข้าถึงโมเดล (all | restricted)",
|
||||
"unrestrictedOpt": "อนุญาตทุกโมเดล (--model-access-mode all)"
|
||||
},
|
||||
"expiration": {
|
||||
"title": "การหมดอายุของคีย์",
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user