Repository navigation
v2.0.15 - Date: 2026-09-05
Full Changelog: v2.0.14...v2.0.15
Fixed
- DeepSeek-V4-Pro CoT leakage in streaming - Disabled the forced thinking flag for
deepseek-v4-pro. With server-default thinking, DeepSeek-V4 on NIM returns Chain-of-Thought inline inmessage.contentwith a trailing (orphan) response instead of the separatereasoning_contentfield. - Inline thinking → thinking blocks (buffered mode) - Split inline CoT via
split_think_contentand emit proper Anthropic thinking blocks;optimization_response_to_ssenow emits thinking blocks too instead of dropping them. - Degraded DeepSeek-V4 DSML tool-call parsing & stop_reason guard - Rewrote the DSML parser to fix degraded tool-call extraction and guard
stop_reasoncorrectly. - Dangling DSML tag stripping - Added
_strip_residual_tagstoproviders/dsml_parser.py. When NVIDIA's server-side tool-call parser consumes the head of a DSML block, only the closing tags survive inmessage.content. These residuals are never legitimate text, so all DSML tags outside parsed tool-call blocks are now stripped, ensuring Claude Code never sees raw markup. - Missing tool_use blocks in buffered→SSE conversion - Emitted
tool_useblocks when converting buffered responses to SSE. - SERVER_TYPE config - Fixed
SERVER_TYPEhandling and added DeepSeek-V4-Pro DSML tool-call parsing for stream mode. - NotFoundError & overloads retryability -
NotFoundErrorand overload errors are now treated as retryable. - Bot protection bypass for localhost - Localhost requests are ignored by bot protection.
- Mid-stream truncation retry - Streams that end without a
finish_reason(NVIDIA backend cut off mid-response) now trigger a retry instead of silently returning a partial response. Previously only completely empty streams were detected. - Mid-stream connection drop retry (stream mode) - Connection errors (
APIConnectionError,APITimeoutError,httpx.ReadError,httpx.TimeoutException) raised during chunk iteration are now retried in streaming mode. Previously they were treated as non-retryable and emitted an incomplete SSE sequence (error event withoutmessage_stop), causing Claude Code to fail with "empty or malformed response (HTTP 200)". - Stream retry duplicate message_start - Fixed a bug where a retried stream emitted a second
message_startinto the buffered SSE (one per attempt), leaving Claude Code with two message sequences and failing with "empty or malformed response (HTTP 200)".stream_responsenow keeps only the final attempt's events (from its lastmessage_startonward), dropping partial earlier attempts. - stop_reason mismatch with streamed tool_use blocks - When DeepSeek emits tool calls as DSML markup, OpenAI's
finish_reasonis"stop"even though the proxy streamstool_usecontent blocks. Claude Code requiresstop_reason="tool_use"when tool_use blocks are present and rejected the deliveredend_turn+ tool_use message as "empty or malformed response (HTTP 200)". The stop_reason guards in both streaming and buffered paths now also upgradeend_turn/other →tool_usewhen tool_use blocks were actually streamed (tracked via a newtool_blocks_startedcounter inSSEBuilder). - Reasoning budget sets max_tokens - The reasoning budget (from effort config,
<nimeffort:level:budget>tag, or session store) now directly setsmax_tokensinstead of being silently capped. This allows models likedeepseek-v4-flash-0731to use their full reasoning capability (e.g.<nimeffort:ultracode:100>→max_tokens=100). DeepSeek usesreasoning_effortinchat_template_kwargsto control thinking intensity; Nemotron usesreasoning_budgetinextra_body. - Nimeffort combined format - The
<nimeffort>tag now supports<nimeffort:level:budget>format (e.g.<nimeffort:ultracode:100>sets effort to ultracode with a 100-token budget). The budget directly controlsmax_tokens. Budget is stored in the session store by_handle_nimeffortinroutes.pyand retrieved per-request. - DeepSeek reasoning_budget exclusion -
reasoning_budgetparameter is no longer sent to DeepSeek models (which reject it with 400 errors). Only Nemotron/default styles send it. DeepSeek usesreasoning_effortinchat_template_kwargs+max_tokensinstead. - Partial response delivery on truncated SSE - Truncated NVIDIA streams with partial content (text, reasoning, or tool calls) now close their blocks and deliver the partial response instead of failing. Only empty (or empty-but-truncated) streams raise
StreamTruncatedErrorfor retry. - Partial-response proxy notice - Truncated/partial responses delivered to the client are appended with a visible notice (
[PROXY NOTICE] ... partial reply ... split the work into smaller chunks) so the model knows the reply was cut short and can adapt instead of assuming the task finished. - Partial tool-use stop reason - The provider no longer emits
end_turnfor streamed tool-use blocks; it setsstop_reason="tool_use"when tool blocks were started, matching the normal completion path. - Reasoning-only partial stream retry - When a stream cuts mid-response with only reasoning content and no assistant text or tool calls, it is now treated as truncation and retried instead of delivering an untouchable thinking block to Claude Code.
httpx.RemoteProtocolErrorretry - NVIDIA's "incomplete chunked read" mid-body disconnects (httpx.RemoteProtocolError) are now retryable.- Unique
tool_useIDs (Kimi-k3 deadlock fix) -_fresh_tool_id()always mints a globally-unique Claude-styletool_useid instead of forwarding NIM's rawtool_callid. Kimi-k3 returns ids inName:indexformat (Bash:0,Read:1) that repeat per same-named call across turns; Claude Code de-duplicates assistant tool_use blocks onid, strips the repeated block, and replaces the turn with[Tool use interrupted]— an empty re-prompt loop. Always-fresh ids (like the real Anthropic API) fix the deadlock. - Bot protection
localhostexemption &/api/hello- Localhost requests no longer accumulate failed-attempt strikes toward a ban inrecord_failed_attempt, and a keylessGET /api/helloroute was added (returns{}) so clients that probe it don't trigger bot protection.@api/app.pyandapi/bot_protection.py. - Optimization SSE defaults -
optimization_response_to_ssenow falls back to a freshmsg_*id and"unknown"model when a mocked optimization response omits them, instead of emitting a malformedmessage_start. - Reasoning config module-cache fix -
_load_reasoning_confignow assigns the parsed JSON back to the_REASONING_CONFIG_RAWmodule cache, so runtime edits toreasoning_config.jsonare honored instead of the stale initial value. sse_content_block_stopstandalone helper - SSE builder exposes a standalonecontent_block_stopevent emitter (no fullSSEBuilderstate needed) for stream-retry de-dup to close already-opened blocks;_keepalivetyping tightened toAsyncGenerator.- Duplicate
RequestQueue.get_statsremoved - Removed the duplicate method definition (the@propertyget_statswas the remaining one). - kimi-k3 400/
top_pfix & reasoning style - Force immutabletop_p=0.95formoonshotai/kimi-k3(the server rejects any other value) and add akimithinking style that sends top-levelreasoning_effort(low/high/max) viaextra_body. - Real-time streaming delivery - Provider SSE events now stream to the client as they arrive instead of fully buffering, so the first token reaches Claude Code quickly and idle timeouts are avoided. This superseded the earlier SSE keepalive workaround (
_keepalive/_buffered_streamremoved). - Unlimited truncation retry -
provider_retry_on_truncationdefault changed from3to0, where0now means unlimited retries on truncated/mid-stream responses so the client always receives a complete message sequence. - Error diagnostics & transport logging - Enriched retry/error logs with request/model context, timeout subtype,
__context__/__cause__chains, total elapsed summaries, and periodic "still retrying" info; header capture now emits a timed failure line on transport timeout/connection errors.
Changed
SERVER_TYPEnow defaults tobuffer-config/settings.pydefault changed fromstreamtobuffer(unsetSERVER_TYPEnow uses buffered mode with unlimited truncation retry).streamremains explicitly selectable viaSERVER_TYPE=streamor<nimserver:stream>. This brings the code default in line with the reliability-first retry model.reasoning_config.jsonkimi-k3 budgets -moonshotai/kimi-k3efforts now use explicit token budgets (low:1000→ultracode:32000) instead of-1, so the kimi reasoning style benefits from the budget→max_tokensbehavior.- Discord bot & rate-limiter hardening - Tightened Discord channel/guild type-safety and checks (
isinstanceguards,getattrfallbacks), a minor rate-limiter typing fix, updated Playwright stealth usage, and asetup_wizard.pypyright ignore. Tests updated to async generators and aligned timeout-error construction.
Removed
- UV references - Removed
uv.lockandUV_*references frompyproject.toml,server.py, andstart_server.py. minimaxai/minimax-m3from reasoning config - Dropped the Minimax entry fromreasoning_config.jsonbecause the model was removed from the NVIDIA endpoint.
Files Touched
providers/provider.py- Inline thinking split logic; DeepSeek-V4 DSML parsing; retryable error handling.providers/think_parser.py-split_think_contentfor separating CoT from content.providers/dsml_parser.py- Rewritten DSML tool-call parsing for stream/buffered modes;_strip_residual_tagsfor dangling DSML tags.api/optimization_handlers.py- Thinking andtool_useblock emission in buffered→SSE conversion.api/routes.py- SERVER_TYPE config fix.providers/request.py- Forceinclude_stop_str_in_outputfordeepseek-v4; budget setsmax_tokensdirectly from session store; deepseek sendsreasoning_effortinchat_template_kwargs;reasoning_budgetsent only for nemotron/default styles; nimeffort combined format parsing.api/swapper/parser.py- Nimeffort tag regex supports<nimeffort:level:budget>combined format; returns(level, budget)tuple.api/routes.py- Nimeffort handler stores both effort level and budget from combined format; SERVER_TYPE config fix.api/bot_protection.py- Localhost bypass.api/routes.py-/v1/messagesstreaming (buffered → real-time SSE);_buffered_sse_generatorand in-stream error handling; nimeffort combined-format handler.providers/header_capture.py- Transport timeout/connection error capture and failure logging.reasoning_config.json- Renamed model key todeepseek-v4-pro-0813with explicit token budgets; disabled forced thinking flag; addedmoonshotai/kimi-k3withkimithinking style; removedminimaxai/minimax-m3(dropped from endpoint).tests/test_stream_retry_dedup.py- Tests for stream retry, truncation,_format_error_detail/_timeout_subtype/_req_ctx.pyproject.toml,server.py,start_server.py,uv.lock- UV reference removal.tests/test_think_split.py,tests/test_optimization_sse.py,tests/test_dsml_parser.py- New/updated tests.nimbus_linux.spec- Hidden imports update.BUILD_LINUX_BINARY.md- Build documentation.config/settings.py-SERVER_TYPEdefaultstream→buffer; reasoning-config module-cache assignment fix.providers/provider.py-_fresh_tool_id()unique tool_use id minting (Kimi-k3 deadlock fix);_keepaliveAsyncGeneratortyping.api/routes.py,api/bot_protection.py- KeylessGET /api/helloendpoint; localhost failed-attempt exemption.api/optimization_handlers.py- Default response id (msg_*) / model (unknown) for mocked SSE.providers/sse_builder.py- Standalonesse_content_block_stophelper.providers/request_queue.py- Removed duplicateget_statsmethod.reasoning_config.json- kimi-k3 explicit effort→budget mapping.discord_bot/bot.py,discord_bot/cog.py,discord_bot/views.py,discord_bot/rate_limit.py- Type-safety/channel hardening.websearch/duckduckgo_html.py- Updated Playwright stealth usage.setup_wizard.py- pyright ignore.tests/test_stream_retry_dedup.py- Async-generator tests, timeout-error alignment.