Skip to content

[Bug]: custom anthropic proxy rewrites z-ai/glm-5.1 to z-ai/glm-5-1 #11464

@YnSen

Description

@YnSen

Bug Description

When Hermes is configured to use a custom Anthropic-compatible endpoint with api_mode: anthropic_messages, dotted GLM model ids can be rewritten incorrectly.

Example:

  • configured model: z-ai/glm-5.1
  • actual model sent upstream: z-ai/glm-5-1

This breaks providers/proxies that require the original dotted model id.

Steps to Reproduce

  1. Configure Hermes with a custom Anthropic-compatible proxy:
model:
  provider: custom
  default: z-ai/glm-5.1
  base_url: https://<custom-proxy>/anthropic
  api_mode: anthropic_messages
  1. Start Hermes gateway or CLI.
  2. Send a normal message.
  3. Inspect the upstream request / request dump.

Expected Behavior

Hermes should preserve the configured model id exactly as z-ai/glm-5.1 for this custom Anthropic-compatible proxy.

Actual Behavior

Hermes rewrites the model to z-ai/glm-5-1.

The upstream proxy then rejects the request. Example provider error:

No available channel for model z-ai/glm-5-1 under group Other (distributor)

A nearby model without a dotted version suffix works fine:

  • z-ai/glm-5-turbo works
  • z-ai/glm-5.1 fails because it is rewritten

Affected Component

  • Agent Core (conversation loop, model routing)
  • Configuration (config.yaml, custom providers)
  • Gateway (reproduced through gateway)

Debug Report

Report https://paste.rs/zsEZJ
agent.log https://paste.rs/3WZ9B
gateway.log https://paste.rs/boVOE

Operating System

Ubuntu 24.04

Python Version

3.11.15

Hermes Version

Hermes Agent v0.10.0 (2026.4.16)

Additional Logs / Traceback

Relevant request-dump symptom from local reproduction:

No available channel for model z-ai/glm-5-1 under group Other (distributor)

Root Cause Analysis

The current dot-preservation guard only preserves dotted model ids when Hermes can infer the upstream provider from:

  • provider being a known built-in provider such as zai, or
  • base_url containing provider-specific markers such as bigmodel.cn, dashscope, minimax, etc.

For opaque custom proxy domains, neither condition is true. As a result, the Anthropic model normalization path still converts dots to hyphens.

This is especially visible for GLM model ids like:

  • glm-4.7
  • glm-5.1
  • z-ai/glm-5.1

The bug is reproducible even after updating the local install to the latest origin/main on April 17, 2026.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium — degraded but workaround existsarea/configConfig system, migrations, profilescomp/agentCore agent loop, run_agent.py, prompt buildertype/bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions