Skip to content

fix: preserve dots in model names for OpenCode Zen and ZAI providers - #8794

Merged
teknium1 merged 1 commit into
mainfrom
hermes/hermes-d7d7ed89
Apr 13, 2026
Merged

fix: preserve dots in model names for OpenCode Zen and ZAI providers#8794
teknium1 merged 1 commit into
mainfrom
hermes/hermes-d7d7ed89

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Summary

Fixes the HTTP 400 when using OpenCode Zen with dotted model names like minimax-m2.5-free, gpt-5.4, glm-5.1. The dot-to-hyphen conversion was applied to ALL models on Zen, but only Claude models need it.

Also fixes the same issue for ZAI provider (glm-5.1 was being mangled to glm-5-1).

Two-layer fix

Layer 1 (model_normalize.py): Remove opencode-zen from blanket _DOT_TO_HYPHEN_PROVIDERS. Add explicit mixed-mode block: Claude stays hyphenated (Zen's Claude endpoint uses anthropic_messages which expects claude-sonnet-4-6), all other models preserve dots.

Layer 2 (run_agent.py _anthropic_preserve_dots): Add opencode-zen and zai to provider allowlist. Broaden URL check from opencode.ai/zen/go to opencode.ai/zen/ to cover both Go and Zen endpoints. Add bigmodel.cn for ZAI URL detection.

Also adds glm-5.1 to ZAI model lists in models.py and setup.py.

Closes #7710

Test plan

  • 136 tests pass across test_model_normalize.py, test_minimax_provider.py, test_model_validation.py
  • New tests: Claude on Zen → hyphens, GLM/GPT/MiniMax/Kimi on Zen → dots preserved, ZAI → dots preserved, bigmodel.cn URL detection

Salvaged from 7 contributor PRs

Best aspects of each were combined:

PR Author What was used
#8708 @DomGrieco Layer 1 mixed-mode approach (Claude hyphens, others dots)
#7739 @konsisumer Layer 2 opencode-zen allowlist + URL broadening
#7719 @konsisumer ZAI provider + bigmodel.cn URL + glm-5.1 model lists
#7296 @Esashiero Identified the _DOT_TO_HYPHEN_PROVIDERS removal needed
#7497 @sharziki Identified _MATCHING_PREFIX_STRIP as alternative category
#8750 @XiaoYingGee Broader custom-proxy analysis (noted for future refactor)
#8752 @APTX4869-maker Inverted logic analysis (noted for future refactor)
#7157 @kagura-agent Custom base URL dot preservation analysis

OpenCode Zen was in _DOT_TO_HYPHEN_PROVIDERS, causing all dotted model
names (minimax-m2.5-free, gpt-5.4, glm-5.1) to be mangled. The fix:

Layer 1 (model_normalize.py): Remove opencode-zen from the blanket
dot-to-hyphen set. Add an explicit block that preserves dots for
non-Claude models while keeping Claude hyphenated (Zen's Claude
endpoint uses anthropic_messages mode which expects hyphens).

Layer 2 (run_agent.py _anthropic_preserve_dots): Add opencode-zen and
zai to the provider allowlist. Broaden URL check from opencode.ai/zen/go
to opencode.ai/zen/ to cover both Go and Zen endpoints. Add bigmodel.cn
for ZAI URL detection.

Also adds glm-5.1 to ZAI model lists in models.py and setup.py.

Closes #7710

Salvaged from contributions by:
- konsisumer (PR #7739, #7719)
- DomGrieco (PR #8708)
- Esashiero (PR #7296)
- sharziki (PR #7497)
- XiaoYingGee (PR #8750)
- APTX4869-maker (PR #8752)
- kagura-agent (PR #7157)
@teknium1
teknium1 merged commit 83ca084 into main Apr 13, 2026
4 of 6 checks passed
@teknium1
teknium1 deleted the hermes/hermes-d7d7ed89 branch April 13, 2026 04:23
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Supply Chain Risk Detected

This PR contains patterns commonly associated with supply chain attacks. This does not mean the PR is malicious — but these patterns require careful human review before merging.

⚠️ WARNING: Install hook files modified

These files can execute code during package installation or interpreter startup.

Files:

hermes_cli/setup.py

Automated scan triggered by supply-chain-audit. If this is a false positive, a maintainer can approve after manual review.

lawyerwenhan pushed a commit to lawyerwenhan/hermes-agent that referenced this pull request Apr 13, 2026
…ousResearch#8794)

OpenCode Zen was in _DOT_TO_HYPHEN_PROVIDERS, causing all dotted model
names (minimax-m2.5-free, gpt-5.4, glm-5.1) to be mangled. The fix:

Layer 1 (model_normalize.py): Remove opencode-zen from the blanket
dot-to-hyphen set. Add an explicit block that preserves dots for
non-Claude models while keeping Claude hyphenated (Zen's Claude
endpoint uses anthropic_messages mode which expects hyphens).

Layer 2 (run_agent.py _anthropic_preserve_dots): Add opencode-zen and
zai to the provider allowlist. Broaden URL check from opencode.ai/zen/go
to opencode.ai/zen/ to cover both Go and Zen endpoints. Add bigmodel.cn
for ZAI URL detection.

Also adds glm-5.1 to ZAI model lists in models.py and setup.py.

Closes NousResearch#7710

Salvaged from contributions by:
- konsisumer (PR NousResearch#7739, NousResearch#7719)
- DomGrieco (PR NousResearch#8708)
- Esashiero (PR NousResearch#7296)
- sharziki (PR NousResearch#7497)
- XiaoYingGee (PR NousResearch#8750)
- APTX4869-maker (PR NousResearch#8752)
- kagura-agent (PR NousResearch#7157)
aj-nt pushed a commit to aj-nt/hermes-agent that referenced this pull request May 1, 2026
…ousResearch#8794)

OpenCode Zen was in _DOT_TO_HYPHEN_PROVIDERS, causing all dotted model
names (minimax-m2.5-free, gpt-5.4, glm-5.1) to be mangled. The fix:

Layer 1 (model_normalize.py): Remove opencode-zen from the blanket
dot-to-hyphen set. Add an explicit block that preserves dots for
non-Claude models while keeping Claude hyphenated (Zen's Claude
endpoint uses anthropic_messages mode which expects hyphens).

Layer 2 (run_agent.py _anthropic_preserve_dots): Add opencode-zen and
zai to the provider allowlist. Broaden URL check from opencode.ai/zen/go
to opencode.ai/zen/ to cover both Go and Zen endpoints. Add bigmodel.cn
for ZAI URL detection.

Also adds glm-5.1 to ZAI model lists in models.py and setup.py.

Closes NousResearch#7710

Salvaged from contributions by:
- konsisumer (PR NousResearch#7739, NousResearch#7719)
- DomGrieco (PR NousResearch#8708)
- Esashiero (PR NousResearch#7296)
- sharziki (PR NousResearch#7497)
- XiaoYingGee (PR NousResearch#8750)
- APTX4869-maker (PR NousResearch#8752)
- kagura-agent (PR NousResearch#7157)
02356abc pushed a commit to 02356abc/hermes-agent that referenced this pull request May 14, 2026
…ousResearch#8794)

OpenCode Zen was in _DOT_TO_HYPHEN_PROVIDERS, causing all dotted model
names (minimax-m2.5-free, gpt-5.4, glm-5.1) to be mangled. The fix:

Layer 1 (model_normalize.py): Remove opencode-zen from the blanket
dot-to-hyphen set. Add an explicit block that preserves dots for
non-Claude models while keeping Claude hyphenated (Zen's Claude
endpoint uses anthropic_messages mode which expects hyphens).

Layer 2 (run_agent.py _anthropic_preserve_dots): Add opencode-zen and
zai to the provider allowlist. Broaden URL check from opencode.ai/zen/go
to opencode.ai/zen/ to cover both Go and Zen endpoints. Add bigmodel.cn
for ZAI URL detection.

Also adds glm-5.1 to ZAI model lists in models.py and setup.py.

Closes NousResearch#7710

Salvaged from contributions by:
- konsisumer (PR NousResearch#7739, NousResearch#7719)
- DomGrieco (PR NousResearch#8708)
- Esashiero (PR NousResearch#7296)
- sharziki (PR NousResearch#7497)
- XiaoYingGee (PR NousResearch#8750)
- APTX4869-maker (PR NousResearch#8752)
- kagura-agent (PR NousResearch#7157)
waefrebeorn pushed a commit to waefrebeorn/slermes that referenced this pull request Jul 2, 2026
…ousResearch#8794)

OpenCode Zen was in _DOT_TO_HYPHEN_PROVIDERS, causing all dotted model
names (minimax-m2.5-free, gpt-5.4, glm-5.1) to be mangled. The fix:

Layer 1 (model_normalize.py): Remove opencode-zen from the blanket
dot-to-hyphen set. Add an explicit block that preserves dots for
non-Claude models while keeping Claude hyphenated (Zen's Claude
endpoint uses anthropic_messages mode which expects hyphens).

Layer 2 (run_agent.py _anthropic_preserve_dots): Add opencode-zen and
zai to the provider allowlist. Broaden URL check from opencode.ai/zen/go
to opencode.ai/zen/ to cover both Go and Zen endpoints. Add bigmodel.cn
for ZAI URL detection.

Also adds glm-5.1 to ZAI model lists in models.py and setup.py.

Closes NousResearch#7710

Salvaged from contributions by:
- konsisumer (PR NousResearch#7739, NousResearch#7719)
- DomGrieco (PR NousResearch#8708)
- Esashiero (PR NousResearch#7296)
- sharziki (PR NousResearch#7497)
- XiaoYingGee (PR NousResearch#8750)
- APTX4869-maker (PR NousResearch#8752)
- kagura-agent (PR NousResearch#7157)
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.

[Bug]: OpenCode Zen API model minimax-m2.5-free returns HTTP 400 Bad Request

1 participant