hermes - 💡(How to fix) Fix custom provider的model id被normalize_model_name错误修改

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
RAW_BUFFERClick to expand / collapse

问题描述

当使用 custom provider 配置第三方 Anthropic-compatible 端点时,用户指定的 model id 会被 强制将 . 替换为 -,导致请求 404。

复现步骤

  1. 在 中配置 custom provider:

  2. 发送任意消息触发 API 调用

  3. 观察到 fallback 到备用模型

错误日志

根因分析

中的 默认将 model name 中的 . 替换为 -。

例如 → 。

的白名单只包含固定的内置 provider(alibaba, minimax, opencode-go, opencode-zen, zai, bedrock)以及特定的 base_url 子串,不包含任意 custom provider

因此用户通过 custom provider 配置的模型名(如 zenmux 上的 )会被错误修改,而 zenmux 只认原始的带点的 model id。

验证

直接 curl 测试:

  • 200 OK
  • 404 invalid_model

期望行为

用户自定义的 model id 应该原样传递到 API,不应该被静默修改。

或者至少:对于 custom provider,应该提供配置项让用户控制是否保留点号,或者自动检测 custom provider 并保留原始 model id。

可能的修复方案

  1. 最彻底:取消对 custom provider 的 model name 做 ,完全信任用户输入。
  2. 配置化:在 custom provider 配置中增加 选项。
  3. 白名单扩展:在 中检测 是否为 custom provider(即用户自定义的名字),对其统一返回 。

环境

  • Hermes version: latest main (commit b7e71fb7)
  • OS: macOS

extent analysis

TL;DR

The most likely fix is to add a configuration option to the custom provider to control whether the model ID should be modified or passed as-is to the API.

Guidance

  • Identify the custom provider configuration and verify that the model ID is being modified as expected.
  • Consider adding a configuration option to the custom provider to allow users to control whether the model ID should be modified or passed as-is to the API.
  • Test the API calls using curl to verify the behavior and ensure that the expected model ID is being passed.
  • Review the white-listing logic to determine if it can be extended to include custom providers or if an alternative solution is needed.

Example

No code snippet is provided as the issue does not contain sufficient information to create a concrete example.

Notes

The solution may require modifications to the custom provider configuration or the underlying API logic. The white-listing logic may need to be revised to accommodate custom providers.

Recommendation

Apply a workaround by adding a configuration option to the custom provider to control whether the model ID should be modified or passed as-is to the API. This will allow users to specify the desired behavior and avoid the modification of the model ID.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

hermes - 💡(How to fix) Fix custom provider的model id被normalize_model_name错误修改