Skip to content

feat(providers): map upstream reasoning-level metadata in openai-compatible discovery (#8347) - #8363

Merged
diegosouzapw merged 1 commit into
release/v3.8.49from
feat/8347-cliproxy-reasoning-levels
Jul 25, 2026
Merged

diegosouzapw merged 1 commit into
release/v3.8.49from
feat/8347-cliproxy-reasoning-levels

Conversation

@diegosouzapw

Copy link
Copy Markdown
Collaborator

What

Generic OpenAI-compatible / custom-node discovery had no metadata-mapping layer for
CLIProxyAPI-style reasoning-level metadata (nothing was ever captured — not "lost").

Owner-scoped this to two layers (not the report's original five):

  1. Normalization (src/lib/providerModels/modelDiscovery.ts): detectSupportedThinkingEfforts
    now also parses supported_reasoning_levels (entries as {effort} objects or plain
    strings) and thinking.levels, alongside the existing reasoning.supported_efforts
    handling (feat(providers): capture upstream reasoning.supported_efforts at sync so synced openai-compatible models become selectable with effort levels #7694). A shared parseEffortList helper normalizes/dedupes/canonicalizes
    (max→xhigh, unknown native tiers like ultra pass through), and drops malformed
    entries per-record via Zod safeParse — never throws, never fails a whole sync
    (Hard Rule chore(env): sync .env.example with current .env structure #7). Precedence is preserved and tested: flat supportedThinkingEfforts
    (verbatim) > reasoning.supported_efforts > supported_reasoning_levels >
    thinking.levels.
  2. Catalog negotiation (src/app/api/providers/[id]/models/discoveryClientVersion.ts,
    wired into route.ts): a default-OFF, per-connection opt-in
    (providerSpecificData.discoveryClientVersionEnabled +
    discoveryClientVersion) appends client_version to the model-list URL only.
    Unrelated generic OpenAI-compatible upstreams see byte-identical requests unless they
    explicitly opt in; the param never touches any inference URL.

Out of scope per the owner's narrowing (documented follow-ups, not this PR):
persistence-schema, catalog-exposure, combo work (appendSyncedEffortVariants /
mergeComboCapabilities already consume supportedThinkingEfforts generically), and the
token-budget range fields (thinking.min/max/zero_allowed/dynamic_allowed).

How tested

TDD (Hard Rule #18): tests/unit/model-discovery-reasoning-levels.test.ts written first,
confirmed failing (missing discoveryClientVersion module), then made to pass — 13/13
green:

Also re-ran the pre-existing #7694/#8072 suites
(sync-reasoning-supported-efforts-7694.test.ts,
combo-builder-effort-variants-8072.test.ts) — 24/24 still green, confirming no
precedence regression.

Gates run in-branch:

  • node --import tsx/esm --test tests/unit/model-discovery-reasoning-levels.test.ts — green
  • npm run typecheck:core — clean
  • npm run typecheck:noimplicit:core — pre-existing errors only, none in touched files
  • npx eslint on touched files — clean
  • npm run check:cycles — clean
  • node scripts/check/check-test-discovery.mjs / check-file-size.mjs — OK
  • check:complexity-ratchets — unchanged base-red (2167/956, matches documented baseline drift, not introduced by this PR)
  • Grep-confirmed client_version only reaches the model-list uniqueEndpoints array, never any inference/executor path

Closes #8347

@diegosouzapw
diegosouzapw merged commit 5d9ace6 into release/v3.8.49 Jul 25, 2026
10 checks passed
@diegosouzapw
diegosouzapw deleted the feat/8347-cliproxy-reasoning-levels branch July 25, 2026 11:14
HouMinXi pushed a commit to HouMinXi/OmniRoute that referenced this pull request Aug 2, 2026
muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(providers): map upstream reasoning-level metadata (CLIProxyAPI supported_reasoning_levels) in openai-compatible discovery

1 participant