Skip to content

fix(provider): map NaN reasoning levels per model - #1637

Merged
Alan-TheGentleman merged 1 commit into
mainfrom
fix/nan-reasoning-levels
Oct 1, 2026
Merged

Alan-TheGentleman merged 1 commit into
mainfrom
fix/nan-reasoning-levels

Conversation

@Alan-TheGentleman

@Alan-TheGentleman Alan-TheGentleman commented Oct 1, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #1635

Summary

  • Map Pi thinking levels to the reasoning_effort values each NaN model actually accepts, per https://nan.builders/docs/models.
  • Advertise GLM 5.3 image input and raise output caps so reasoning that shares max_tokens does not starve the answer.
  • Deep-copy thinkingLevelMap so catalog snapshots stay isolated.

Changes

File Change
lib/nan-provider.ts Per-model thinkingLevelMap, glm5.3 image input, configured output caps, map cloning
tests/nan-provider.test.ts Coverage for level mapping, fixed-depth clamping, capabilities, caps, and mutation isolation
Model Pi levels maxTokens
glm5.3, glm5.3-flash minimal→low, xhigh→max, off unsupported 32,768
qwen3.6, gemma4 off→none (disables reasoning), xhigh→max 65,536
deepseek-v4-flash medium only (fixed depth) 16,384 (NaN floor)
qwen3.8-flash medium only 131,000 (published)
mimo-v2.6-flash medium only 32,768

Caps without a published maximum are configured values, not NaN limits.

Test Plan

  • Test-first: 7 of 23 focused tests failed before implementation, all 23 pass after (node --experimental-strip-types --test tests/nan-provider.test.ts).
  • node scripts/check-types.mjs: 187 recorded diagnostics, no regressions.
  • node scripts/run-test-suite.mjs: 4533 passed, 34 skipped, 0 failed.
  • git diff --check: clean.
  • Live NaN API run: not performed; behavior follows the published documentation.

Checklist

  • Linked issue approved (status:approved)
  • Exactly one type:* label
  • Conventional commit, no Co-Authored-By trailers
  • Tests alongside the behavior change

Summary by CodeRabbit

  • New Features
    • Image input is now available across all listed models.
    • Reasoning-level options are tailored to each model, with fixed-reasoning models limited to their supported default level.
    • Maximum output lengths have increased for several models, with limits set according to each model’s capabilities.

Align Pi thinking levels with the efforts each NaN model accepts:
GLM maps minimal/xhigh onto low/max and cannot be disabled; Qwen 3.6
and Gemma 4 map off to none so reasoning can actually be turned off;
fixed-depth models (DeepSeek V4 Flash, Qwen 3.8 Flash, MiMo) expose a
single medium level. Advertise GLM 5.3 image input and raise output
caps so reasoning that shares max_tokens does not starve the answer.
@Alan-TheGentleman Alan-TheGentleman added the type:bug Bug fix label Oct 1, 2026
@coderabbitai

coderabbitai Bot commented Oct 1, 2026

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 166727c8-02e7-4c8c-bac7-492ec84185a5

📥 Commits

Reviewing files that changed from the base of the PR and between 2549f17 and 0139e0d.

📒 Files selected for processing (2)
  • lib/nan-provider.ts
  • tests/nan-provider.test.ts
 _____________________________________________________________________________________________________________________________________
< Prototype to learn. Prototyping is a learning experience. Its value lies not in the code you produce, but in the lessons you learn. >
 -------------------------------------------------------------------------------------------------------------------------------------
  \
   \   \
        \ /\
        ( )
      .( o ).
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Alan-TheGentleman
Alan-TheGentleman merged commit 438c76c into main Oct 1, 2026
5 of 6 checks passed
@Alan-TheGentleman
Alan-TheGentleman deleted the fix/nan-reasoning-levels branch October 1, 2026 20:15
barbatdev added a commit that referenced this pull request Oct 2, 2026
)

NaN's gateway accepts reasoning_effort "none" for deepseek-v4-flash,
which deterministically disables its reasoning phase. Give the model its
own thinking level map exposing off (matching qwen3.6 and gemma4 from
#1637) instead of inheriting the shared fixed-depth map that nulls it,
and correct the shared map's comment. qwen3.8-flash and mimo-v2.6-flash
keep their existing behavior.

Closes #1645
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type:bug Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(provider): NaN reasoning levels do not match per-model support

1 participant