Skip to content

支持配置思考等级和支持qoder官方quota查询 - #3

Open
Jerry-Luo wants to merge 6 commits into
EchoPing07:mainfrom
Jerry-Luo:main
Open

Jerry-Luo wants to merge 6 commits into
EchoPing07:mainfrom
Jerry-Luo:main

Conversation

@Jerry-Luo

@Jerry-Luo Jerry-Luo commented Sep 15, 2026

Copy link
Copy Markdown

如题, 具体参见readme.
image

…ontract

   The gateway reads completion caps, thinking control and tool selection
   from the request body's "parameters" object. The bridge wrote
   reasoning_effort and tool_choice at the top level, where the gateway
   never looks, so every thinking tier silently fell back to the model
   default and "none" could never disable reasoning.

   Reverse-engineering the official qodercli client confirmed the contract:
   it builds a parameters map first, always attaches it, and disables
   thinking by setting is_reasoning=false together with an explicit
   max_thinking_tokens=0.

   - add chatParameters carrying max_tokens, max_thinking_tokens,
     reasoning_effort and tool_choice
   - route reasoning_effort and tool_choice into parameters
   - on the "none" tier, send max_thinking_tokens=0 and flip both
     is_reasoning copies to false (pointer field so 0 survives omitempty)
   - resolve is_reasoning and the max_tokens fallback from the model
     catalog instead of hardcoding them; a caller-supplied max_tokens wins
     over the catalog cap, matching the official precedence so models with
     a small advertised cap are not silently truncated
   - log the resolved is_reasoning and max_tokens alongside the tier, so a
     dropped value is visible without another probe

   Verified against the live gateway: "none" now emits zero
   reasoning_content frames and no completion_tokens_details key, while the
   spread of reasoning_tokens across the six tiers widens from 13 (a flat
   noise band, proving the value was discarded) to 181.
   The admin panel showed lifetime cumulative credits, which stops meaning
   anything once the monthly allowance refreshes. Query the gateway's
   /algo/api/v3/user/status for the authoritative nextResetAt boundary and
   track credits per cycle instead.

   - auth: add FetchUserStatus/ParseAccountStatus for the subscription state
   - stats: track CycleCredits/CycleStartMs/NextResetMs with idempotent
     rollover on both the write and read paths; count credits only for
     billable usage frames
   - bridge: cache /user/status for 1h and resolve the real userType before
     building the signed session (jobToken omits it, so team accounts were
     defaulting to personal_standard)
   - main: refresh account state out of band every 10m, keeping the panel's
     15s poll free of upstream calls
   - admin: render cycle credits with reset date and countdown; no progress
     bar, since team plans report quota=0
@Jerry-Luo Jerry-Luo changed the title 支持配置思考等级 支持配置思考等级和支持qoder官方quota查询 Sep 15, 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.

1 participant