hermes - 💡(How to fix) Fix claw migrate produces api_mode: chat_completions for byoky-anthropic (should be anthropic_messages) [4 comments, 3 participants]

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…
GitHub stats
NousResearch/hermes-agent#19861Fetched 2026-05-05 06:04:37
View on GitHub
Comments
4
Participants
3
Timeline
13
Reactions
0
Timeline (top)
commented ×4labeled ×4mentioned ×2subscribed ×2

hermes claw migrate writes a custom_providers entry for the byoky-anthropic provider with api_mode: chat_completions, but byoky's bridge only proxies the native Anthropic shape on /v1/messages. The OpenAI-compat path /chat/completions returns 404, so a freshly migrated user hits a 404 the first time they run hermes.

Root Cause

hermes claw migrate writes a custom_providers entry for the byoky-anthropic provider with api_mode: chat_completions, but byoky's bridge only proxies the native Anthropic shape on /v1/messages. The OpenAI-compat path /chat/completions returns 404, so a freshly migrated user hits a 404 the first time they run hermes.

Fix Action

Fix / Workaround

Workaround for affected users

Code Example

api_type = prov_cfg.get("apiType") or prov_cfg.get("type") or "openai"
api_mode_map = {
    "openai": "chat_completions",
    "anthropic": "anthropic_messages",
    "cohere": "chat_completions",
}
entry = {
    "name": prov_name,
    "base_url": prov_cfg["baseUrl"],
    "api_key": "",
    "api_mode": api_mode_map.get(api_type, "chat_completions"),
}

---

api_type = (
    prov_cfg.get(\"apiType\")
    or prov_cfg.get(\"type\")
    or prov_cfg.get(\"api\")
    or \"openai\"
)
api_mode_map = {
    \"openai\": \"chat_completions\",
    \"anthropic\": \"anthropic_messages\",
    \"anthropic-messages\": \"anthropic_messages\",
    \"cohere\": \"chat_completions\",
}
RAW_BUFFERClick to expand / collapse

Summary

hermes claw migrate writes a custom_providers entry for the byoky-anthropic provider with api_mode: chat_completions, but byoky's bridge only proxies the native Anthropic shape on /v1/messages. The OpenAI-compat path /chat/completions returns 404, so a freshly migrated user hits a 404 the first time they run hermes.

Where it's wrong

optional-skills/migration/openclaw-migration/scripts/openclaw_to_hermes.py:2098-2108

api_type = prov_cfg.get("apiType") or prov_cfg.get("type") or "openai"
api_mode_map = {
    "openai": "chat_completions",
    "anthropic": "anthropic_messages",
    "cohere": "chat_completions",
}
entry = {
    "name": prov_name,
    "base_url": prov_cfg["baseUrl"],
    "api_key": "",
    "api_mode": api_mode_map.get(api_type, "chat_completions"),
}

Two issues stack:

  1. Field name mismatch. OpenClaw provider configs declare the wire shape as api: \"anthropic-messages\" (see e.g. byoky's official OpenClaw plugin: https://github.com/MichaelLod/byoky/blob/main/packages/openclaw-plugin/src/index.ts#L215). The migrator only checks apiType or type, never api, so api_type falls back to the default \"openai\".
  2. Map key mismatch. Even if the migrator did read api, the value is \"anthropic-messages\" (hyphenated), but the lookup key is \"anthropic\". So it would still fall through to the default chat_completions.

Net result: any custom provider using the native Anthropic shape gets migrated as if it were OpenAI-compat, which 404s on the byoky bridge (and would silently use the wrong wire format anywhere else).

Reproduction

  1. Install OpenClaw + the byoky openclaw plugin (openclaw plugins install @byoky/openclaw-plugin --dangerously-force-unsafe-install); this creates a byoky-anthropic provider in ~/.openclaw/openclaw.json with \"api\": \"anthropic-messages\", \"baseUrl\": \"http://127.0.0.1:19280/anthropic\".
  2. Install Hermes, run hermes claw migrate.
  3. Inspect ~/.hermes/config.yaml — the migrated custom_providers entry has api_mode: chat_completions.
  4. Set model.provider: byoky-anthropic and run hermes chat -q ping. You get HTTP 404 from 127.0.0.1:19280/anthropic/chat/completions (the bridge only exposes /v1/messages).

Suggested fix

Read api as well, and add the hyphenated key:

api_type = (
    prov_cfg.get(\"apiType\")
    or prov_cfg.get(\"type\")
    or prov_cfg.get(\"api\")
    or \"openai\"
)
api_mode_map = {
    \"openai\": \"chat_completions\",
    \"anthropic\": \"anthropic_messages\",
    \"anthropic-messages\": \"anthropic_messages\",
    \"cohere\": \"chat_completions\",
}

Workaround for affected users

Edit ~/.hermes/config.yaml and flip api_mode for the migrated entry, or run byoky-bridge hermes-setup (shipped in @byoky/[email protected]) which does this idempotently.

Environment

  • Hermes Agent v0.6.0 (2026.3.30)
  • OpenClaw 2026.4.21
  • @byoky/openclaw-plugin 0.9.5

extent analysis

TL;DR

Update the api_mode_map and api_type logic in openclaw_to_hermes.py to correctly handle the "anthropic-messages" API type.

Guidance

  • Check the api field in the provider config in addition to apiType and type to determine the correct API mode.
  • Update the api_mode_map to include the hyphenated key "anthropic-messages" to correctly map to "anthropic_messages".
  • Verify the fix by running hermes claw migrate and checking the custom_providers entry in ~/.hermes/config.yaml for the correct api_mode.
  • As a temporary workaround, users can edit ~/.hermes/config.yaml to flip api_mode for the migrated entry or run byoky-bridge hermes-setup.

Example

api_type = (
    prov_cfg.get("api")
    or prov_cfg.get("apiType")
    or prov_cfg.get("type")
    or "openai"
)
api_mode_map = {
    "openai": "chat_completions",
    "anthropic": "anthropic_messages",
    "anthropic-messages": "anthropic_messages",
    "cohere": "chat_completions",
}

Notes

This fix assumes that the api field in the provider config is the authoritative source for determining the API mode. If this is not the case, additional logic may be needed to handle different scenarios.

Recommendation

Apply the suggested fix to update the api_mode_map and api_type logic to correctly handle the "anthropic-messages" API type, as this will ensure accurate migration of custom providers.

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 claw migrate produces api_mode: chat_completions for byoky-anthropic (should be anthropic_messages) [4 comments, 3 participants]