fix: support DeepSeek V4+ model names in normalization - #15586
Closed
zons-zhaozhy wants to merge 2 commits into
Closed
zons-zhaozhy wants to merge 2 commits into
zons-zhaozhy wants to merge 2 commits into
Conversation
…n waste Ephemeral per-API-call optimization that compresses old tool results to one-line summaries before each LLM call. Complements the existing ContextCompressor (persistent, threshold-triggered). - _progressive_tool_result_compress: regex-based summary, zero cost - Config: compression.progressive.* (enabled, recent_tool_keep, min_messages, max_compressed_len) - Respects compression.enabled and protect_last_n as defaults - 32 unit tests + benchmark script - Lint clean (ruff)
DeepSeek V4 models (deepseek-v4-pro, deepseek-v4-flash) were unusable because _normalize_for_deepseek() forced all non-chat/reasoner names to 'deepseek-chat'. The model validator then rejected the mangled name as not found in the provider's model listing. Root cause: the normalize function assumed DeepSeek only has two model IDs (chat and reasoner). V4 introduced new IDs that need passthrough. Changes: - Refactor _normalize_for_deepseek: prefix-based passthrough for any 'deepseek-*' name, alias resolution for short forms (v3, r1), keyword fallback for reasoner keywords, backward-compatible default. - Add 'insufficient balance' to billing error patterns (DeepSeek returns this with HTTP 400 instead of the documented 402). - Update static model catalog with V4 entries. - Add 14 parametrized tests covering passthrough, aliases, keywords, fallback, and vendor-prefix stripping. Future DeepSeek model releases (V5, V6...) will work without code changes thanks to the passthrough design.
Contributor
Collaborator
|
Thanks for the contribution! This is an automated hermes-sweeper review. The core fix described in this PR — DeepSeek V-series passthrough normalization and catalog entries — was already landed on
Two items worth noting for follow-up:
|
teknium1
pushed a commit
that referenced
this pull request
Apr 28, 2026
DeepSeek API returns HTTP 400 with 'Insufficient Balance' message when account funds are depleted. This pattern was not in _BILLING_PATTERNS, causing the error to be misclassified instead of triggering billing exhaustion handling (e.g., fallback to alternate provider). Suggested by teknium1 in PR review of #15586.
cluricaun28
referenced
this pull request
in cluricaun28/Logos
Apr 28, 2026
DeepSeek API returns HTTP 400 with 'Insufficient Balance' message when account funds are depleted. This pattern was not in _BILLING_PATTERNS, causing the error to be misclassified instead of triggering billing exhaustion handling (e.g., fallback to alternate provider). Suggested by teknium1 in PR review of #15586.
donald131
pushed a commit
to donald131/hermes-agent
that referenced
this pull request
May 2, 2026
DeepSeek API returns HTTP 400 with 'Insufficient Balance' message when account funds are depleted. This pattern was not in _BILLING_PATTERNS, causing the error to be misclassified instead of triggering billing exhaustion handling (e.g., fallback to alternate provider). Suggested by teknium1 in PR review of NousResearch#15586.
02356abc
pushed a commit
to 02356abc/hermes-agent
that referenced
this pull request
May 14, 2026
DeepSeek API returns HTTP 400 with 'Insufficient Balance' message when account funds are depleted. This pattern was not in _BILLING_PATTERNS, causing the error to be misclassified instead of triggering billing exhaustion handling (e.g., fallback to alternate provider). Suggested by teknium1 in PR review of NousResearch#15586.
dannyJ848
pushed a commit
to dannyJ848/hermes-agent
that referenced
this pull request
May 17, 2026
DeepSeek API returns HTTP 400 with 'Insufficient Balance' message when account funds are depleted. This pattern was not in _BILLING_PATTERNS, causing the error to be misclassified instead of triggering billing exhaustion handling (e.g., fallback to alternate provider). Suggested by teknium1 in PR review of NousResearch#15586.
gweeteve
pushed a commit
to gweeteve/hermes-agent
that referenced
this pull request
Jun 2, 2026
DeepSeek API returns HTTP 400 with 'Insufficient Balance' message when account funds are depleted. This pattern was not in _BILLING_PATTERNS, causing the error to be misclassified instead of triggering billing exhaustion handling (e.g., fallback to alternate provider). Suggested by teknium1 in PR review of NousResearch#15586.
Seven74AI
pushed a commit
to Seven74AI/hermes-agent
that referenced
this pull request
Jun 13, 2026
DeepSeek API returns HTTP 400 with 'Insufficient Balance' message when account funds are depleted. This pattern was not in _BILLING_PATTERNS, causing the error to be misclassified instead of triggering billing exhaustion handling (e.g., fallback to alternate provider). Suggested by teknium1 in PR review of NousResearch#15586.
waefrebeorn
pushed a commit
to waefrebeorn/slermes
that referenced
this pull request
Jul 2, 2026
DeepSeek API returns HTTP 400 with 'Insufficient Balance' message when account funds are depleted. This pattern was not in _BILLING_PATTERNS, causing the error to be misclassified instead of triggering billing exhaustion handling (e.g., fallback to alternate provider). Suggested by teknium1 in PR review of NousResearch#15586.
Gravezzz
pushed a commit
to Gravezzz/hermes-agent
that referenced
this pull request
Jul 21, 2026
DeepSeek API returns HTTP 400 with 'Insufficient Balance' message when account funds are depleted. This pattern was not in _BILLING_PATTERNS, causing the error to be misclassified instead of triggering billing exhaustion handling (e.g., fallback to alternate provider). Suggested by teknium1 in PR review of NousResearch#15586.
prmartinow
pushed a commit
to prmartinow/hermes-agent
that referenced
this pull request
Aug 26, 2026
DeepSeek API returns HTTP 400 with 'Insufficient Balance' message when account funds are depleted. This pattern was not in _BILLING_PATTERNS, causing the error to be misclassified instead of triggering billing exhaustion handling (e.g., fallback to alternate provider). Suggested by teknium1 in PR review of NousResearch#15586.
melon-xf
added a commit
to melon-xf/hermes-agent
that referenced
this pull request
Sep 3, 2026
DeepSeek API returns HTTP 400 with 'Insufficient Balance' message when account funds are depleted. This pattern was not in _BILLING_PATTERNS, causing the error to be misclassified instead of triggering billing exhaustion handling (e.g., fallback to alternate provider). Suggested by teknium1 in PR review of NousResearch#15586.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
DeepSeek V4 models (
deepseek-v4-pro,deepseek-v4-flash) are unusable. The/modelcommand reports:Root Cause
_normalize_for_deepseek()assumed DeepSeek only has two model IDs (deepseek-chatanddeepseek-reasoner). All other names were forced todeepseek-chat. When a user requestsdeepseek-v4-pro, it gets mangled todeepseek-chat, which is then rejected by the live API model validator since the API only returnsdeepseek-v4-proanddeepseek-v4-flash.Additionally, DeepSeek returns
"Insufficient Balance"with HTTP 400 (not the documented 402) when credits are exhausted. This was misclassified as a model-not-found error rather than a billing error, masking the real problem.Changes
hermes_cli/model_normalize.py— Refactor DeepSeek normalizationdeepseek-chatordeepseek-reasoneronly)deepseek-*name passes through unchangedv3→deepseek-chat,r1→deepseek-reasoneragent/error_classifier.py— Add billing pattern"insufficient balance"to_BILLING_PATTERNShermes_cli/models.py— Update static catalogdeepseek-v4-proanddeepseek-v4-flashto the DeepSeek provider model listtests/hermes_cli/test_model_normalize.py— 14 new test casesdeepseek-v5-ultrav3,r1thinker,cot-model,reasoning-v2deepseek-chatdeepseek/deepseek-v4-pro→deepseek-v4-proAll 69 tests pass (55 existing + 14 new).
Testing