hermes - ✅(Solved) Fix [Bug]: OpenCode Zen routes kimi-k2.5-free to /messages instead of /chat/completions [1 pull requests]

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…

Error Message

[Bug]: OpenCode Zen routes kimi-k2.5-free to /messages instead of /chat/completions

Bug Description

When using OpenCode Zen as a provider with kimi-k2.5-free, Hermes routes the request to https://opencode.ai/zen/v1/messages (the Anthropic/Claude endpoint) instead of https://opencode.ai/zen/v1/chat/completions (the correct endpoint for Kimi models).

This results in a 404 Not Found error every time, regardless of config changes.

According to OpenCode Zen documentation, different model families require different endpoints:

Model familyExpected endpoint
Claude (Sonnet, Haiku, Opus)/messages
GPT (5, 5.1, 5.2)/responses
Gemini/models/<model-id>
Kimi, GLM, Qwen, MiniMax, Big Pickle/chat/completions

The opencode-zen provider appears to default all models to the /messages endpoint rather than routing based on model family.

Steps to Reproduce

  1. Configure OpenCode Zen in ~/.hermes/.env:

    OPENCODE_ZEN_API_KEY=sk-...

  2. Set model in config.yaml:

    model: default: kimi-k2.5-free provider: opencode-zen

    No base_url or api_mode override — clean config, provider-only.

  3. Run hermes and type any message (e.g., hello).

  4. Observe the error:

    ⚠️ API call failed (attempt 1/3): NotFoundError [HTTP 404] 🔌 Provider: opencode-zen Model: kimi-k2.5-free 🌐 Endpoint: https://opencode.ai/zen/v1/messages 📝 Error: HTTP 404 — Not Found | opencode

Expected Behavior

The opencode-zen provider should detect that kimi-k2.5-free is a Kimi model and route the request to https://opencode.ai/zen/v1/chat/completions instead of https://opencode.ai/zen/v1/messages.

Workaround

Manually forcing the endpoint in config.yaml:

model: default: kimi-k2.5-free provider: opencode-zen base_url: https://opencode.ai/zen/v1/chat/completions api_mode: chat_completions

This works but defeats the purpose of automatic provider routing.

Environment

  • OS: Windows 11 / WSL2 (Ubuntu)
  • Hermes version: v0.10.0 (also reproduced after hermes update to upstream ac4e8cb4)
  • Python version: 3.11
  • Model: kimi-k2.5-free
  • Provider: opencode-zen

Related Issues

  • #7710 — Similar routing issue with minimax-m2.5-free via OpenCode Zen

Additional Context

This likely affects all non-Claude, non-Anthropic models served through OpenCode Zen (Kimi, GLM, Qwen, MiniMax, Big Pickle, Gemini, GPT). The provider seems to unconditionally use the Anthropic /messages endpoint format rather than selecting the correct API format based on the model ID.

Root Cause

Root Cause Analysis (optional)

Fix Action

Workaround

Manually forcing the endpoint in config.yaml:

model: default: kimi-k2.5-free provider: opencode-zen base_url: https://opencode.ai/zen/v1/chat/completions api_mode: chat_completions

This works but defeats the purpose of automatic provider routing.

PR fix notes

PR #13334: fix(opencode): route kimi through chat completions

Description (problem / solution / changelog)

Fixes #13194.

Root cause: OpenCode provider runtime resolution trusted a persisted api_mode value before deriving the transport from the current OpenCode model family. After switching to kimi-k2.5-free, a stale Anthropic api_mode could keep routing the request to /messages instead of /chat/completions.

Fix summary:

  • Derive runtime api_mode for opencode-zen and opencode-go from the configured default model family.
  • Add explicit coverage for opencode-zen kimi-k2.5-free resolving to chat_completions with the /v1 base URL.
  • Keep existing OpenCode Anthropic-message routing for Claude/Go MiniMax families.

Tests:

  • uv run --frozen --python 3.11 --extra dev pytest -o addopts= tests/hermes_cli/test_runtime_provider_resolution.py tests/hermes_cli/test_model_validation.py -q -> 133 passed
  • git diff --check -- hermes_cli/runtime_provider.py tests/hermes_cli/test_runtime_provider_resolution.py tests/hermes_cli/test_model_validation.py

Changed files

  • hermes_cli/runtime_provider.py (modified, +18/-8)
  • tests/hermes_cli/test_model_validation.py (modified, +1/-0)
  • tests/hermes_cli/test_runtime_provider_resolution.py (modified, +23/-2)

Code Example

# [Bug]: OpenCode Zen routes `kimi-k2.5-free` to `/messages` instead of `/chat/completions`

## Bug Description

When using OpenCode Zen as a provider with `kimi-k2.5-free`, Hermes routes the request to `https://opencode.ai/zen/v1/messages` (the Anthropic/Claude endpoint) instead of `https://opencode.ai/zen/v1/chat/completions` (the correct endpoint for Kimi models).

This results in a **404 Not Found** error every time, regardless of config changes.

According to [OpenCode Zen documentation](https://opencode.ai/docs/zen/), different model families require different endpoints:

| Model family | Expected endpoint |
|---|---|
| Claude (Sonnet, Haiku, Opus) | `/messages` |
| GPT (5, 5.1, 5.2) | `/responses` |
| Gemini | `/models/<model-id>` |
| Kimi, GLM, Qwen, MiniMax, Big Pickle | `/chat/completions` |

The `opencode-zen` provider appears to default all models to the `/messages` endpoint rather than routing based on model family.

## Steps to Reproduce

1. Configure OpenCode Zen in `~/.hermes/.env`:
   
   OPENCODE_ZEN_API_KEY=sk-...
   

2. Set model in `config.yaml`:
   
   model:
     default: kimi-k2.5-free
     provider: opencode-zen
   
   No `base_url` or `api_mode` override — clean config, provider-only.

3. Run `hermes` and type any message (e.g., `hello`).

4. Observe the error:
   
   ⚠️  API call failed (attempt 1/3): NotFoundError [HTTP 404]
      🔌 Provider: opencode-zen  Model: kimi-k2.5-free
      🌐 Endpoint: https://opencode.ai/zen/v1/messages
      📝 Error: HTTP 404Not Found | opencode
   

## Expected Behavior

The `opencode-zen` provider should detect that `kimi-k2.5-free` is a Kimi model and route the request to `https://opencode.ai/zen/v1/chat/completions` instead of `https://opencode.ai/zen/v1/messages`.

## Workaround

Manually forcing the endpoint in `config.yaml`:


model:
  default: kimi-k2.5-free
  provider: opencode-zen
  base_url: https://opencode.ai/zen/v1/chat/completions
  api_mode: chat_completions


This works but defeats the purpose of automatic provider routing.

## Environment

- **OS:** Windows 11 / WSL2 (Ubuntu)
- **Hermes version:** v0.10.0 (also reproduced after `hermes update` to upstream ac4e8cb4)
- **Python version:** 3.11
- **Model:** kimi-k2.5-free
- **Provider:** opencode-zen

## Related Issues

- #7710Similar routing issue with `minimax-m2.5-free` via OpenCode Zen

## Additional Context

This likely affects all non-Claude, non-Anthropic models served through OpenCode Zen (Kimi, GLM, Qwen, MiniMax, Big Pickle, Gemini, GPT). The provider seems to unconditionally use the Anthropic `/messages` endpoint format rather than selecting the correct API format based on the model ID.

---
RAW_BUFFERClick to expand / collapse

Bug Description

<html> <body> <!--StartFragment--><p class="font-claude-response-body break-words whitespace-normal leading-[1.7]">When using OpenCode Zen as a provider with <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">kimi-k2.5-free</code>, Hermes routes the request to <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">https://opencode.ai/zen/v1/messages</code> (the Anthropic/Claude endpoint) instead of <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">https://opencode.ai/zen/v1/chat/completions</code> (the correct endpoint for Kimi models).</p> <p class="font-claude-response-body break-words whitespace-normal leading-[1.7]">This results in a <strong>404 Not Found</strong> error every time, regardless of config changes.</p> <p class="font-claude-response-body break-words whitespace-normal leading-[1.7]">According to <a class="underline underline underline-offset-2 decoration-1 decoration-current/40 hover:decoration-current focus:decoration-current" href="https://opencode.ai/docs/zen/">OpenCode Zen documentation</a>, different model families require different endpoints:</p> <div class="overflow-x-auto w-full px-2 mb-6"> Model family | Expected endpoint -- | -- Claude (Sonnet, Haiku, Opus) | /messages GPT (5, 5.1, 5.2) | /responses Gemini | /models/<model-id> Kimi, GLM, Qwen, MiniMax, Big Pickle | /chat/completions </div> <p class="font-claude-response-body break-words whitespace-normal leading-[1.7]">The <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">opencode-zen</code> provider appears to default all models to the <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">/messages</code> endpoint rather than routing based on model family.</p><!--EndFragment--> </body> </html>When using OpenCode Zen as a provider with kimi-k2.5-free, Hermes routes the request to https://opencode.ai/zen/v1/messages (the Anthropic/Claude endpoint) instead of https://opencode.ai/zen/v1/chat/completions (the correct endpoint for Kimi models). This results in a 404 Not Found error every time, regardless of config changes. According to [OpenCode Zen documentation](https://opencode.ai/docs/zen/), different model families require different endpoints: Model familyExpected endpointClaude (Sonnet, Haiku, Opus)/messagesGPT (5, 5.1, 5.2)/responsesGemini/models/<model-id>Kimi, GLM, Qwen, MiniMax, Big Pickle/chat/completions The opencode-zen provider appears to default all models to the /messages endpoint rather than routing based on model family.

Steps to Reproduce

Configure OpenCode Zen in ~/.hermes/.env:

OPENCODE_ZEN_API_KEY=sk-...

Set model in config.yaml:

yaml model: default: kimi-k2.5-free provider: opencode-zen No base_url or api_mode override — clean config, provider-only.

Run hermes and type any message (e.g., hello). Observe the error:

⚠️ API call failed (attempt 1/3): NotFoundError [HTTP 404] 🔌 Provider: opencode-zen Model: kimi-k2.5-free 🌐 Endpoint: https://opencode.ai/zen/v1/messages 📝 Error: HTTP 404 — Not Found | opencode

Expected Behavior

The opencode-zen provider should detect that kimi-k2.5-free is a Kimi model and route the request to https://opencode.ai/zen/v1/chat/completions instead of https://opencode.ai/zen/v1/messages.

Actual Behavior

Didn't work

Affected Component

Agent Core (conversation loop, context compression, memory)

Messaging Platform (if gateway-related)

No response

Debug Report

# [Bug]: OpenCode Zen routes `kimi-k2.5-free` to `/messages` instead of `/chat/completions`

## Bug Description

When using OpenCode Zen as a provider with `kimi-k2.5-free`, Hermes routes the request to `https://opencode.ai/zen/v1/messages` (the Anthropic/Claude endpoint) instead of `https://opencode.ai/zen/v1/chat/completions` (the correct endpoint for Kimi models).

This results in a **404 Not Found** error every time, regardless of config changes.

According to [OpenCode Zen documentation](https://opencode.ai/docs/zen/), different model families require different endpoints:

| Model family | Expected endpoint |
|---|---|
| Claude (Sonnet, Haiku, Opus) | `/messages` |
| GPT (5, 5.1, 5.2) | `/responses` |
| Gemini | `/models/<model-id>` |
| Kimi, GLM, Qwen, MiniMax, Big Pickle | `/chat/completions` |

The `opencode-zen` provider appears to default all models to the `/messages` endpoint rather than routing based on model family.

## Steps to Reproduce

1. Configure OpenCode Zen in `~/.hermes/.env`:
   
   OPENCODE_ZEN_API_KEY=sk-...
   

2. Set model in `config.yaml`:
   
   model:
     default: kimi-k2.5-free
     provider: opencode-zen
   
   No `base_url` or `api_mode` override — clean config, provider-only.

3. Run `hermes` and type any message (e.g., `hello`).

4. Observe the error:
   
   ⚠️  API call failed (attempt 1/3): NotFoundError [HTTP 404]
      🔌 Provider: opencode-zen  Model: kimi-k2.5-free
      🌐 Endpoint: https://opencode.ai/zen/v1/messages
      📝 Error: HTTP 404 — Not Found | opencode
   

## Expected Behavior

The `opencode-zen` provider should detect that `kimi-k2.5-free` is a Kimi model and route the request to `https://opencode.ai/zen/v1/chat/completions` instead of `https://opencode.ai/zen/v1/messages`.

## Workaround

Manually forcing the endpoint in `config.yaml`:


model:
  default: kimi-k2.5-free
  provider: opencode-zen
  base_url: https://opencode.ai/zen/v1/chat/completions
  api_mode: chat_completions


This works but defeats the purpose of automatic provider routing.

## Environment

- **OS:** Windows 11 / WSL2 (Ubuntu)
- **Hermes version:** v0.10.0 (also reproduced after `hermes update` to upstream ac4e8cb4)
- **Python version:** 3.11
- **Model:** kimi-k2.5-free
- **Provider:** opencode-zen

## Related Issues

- #7710 — Similar routing issue with `minimax-m2.5-free` via OpenCode Zen

## Additional Context

This likely affects all non-Claude, non-Anthropic models served through OpenCode Zen (Kimi, GLM, Qwen, MiniMax, Big Pickle, Gemini, GPT). The provider seems to unconditionally use the Anthropic `/messages` endpoint format rather than selecting the correct API format based on the model ID.

Operating System

Windows 11 WSL ubuntu

Python Version

No response

Hermes Version

0.10.0 2026.4.16

Additional Logs / Traceback (optional)

Root Cause Analysis (optional)

No response

Proposed Fix (optional)

No response

Are you willing to submit a PR for this?

  • I'd like to fix this myself and submit a PR

extent analysis

TL;DR

The opencode-zen provider defaults to the /messages endpoint instead of routing based on the model family, causing a 404 error when using Kimi models.

Guidance

  • Verify that the model family is correctly identified as Kimi for the kimi-k2.5-free model.
  • Check the opencode-zen provider configuration to ensure it is not hardcoded to use the /messages endpoint.
  • Consider adding a workaround by manually forcing the endpoint in config.yaml as shown in the issue description.
  • Review the OpenCode Zen documentation to ensure that the correct endpoint is being used for Kimi models.

Example

model:
  default: kimi-k2.5-free
  provider: opencode-zen
  base_url: https://opencode.ai/zen/v1/chat/completions
  api_mode: chat_completions

Notes

The issue seems to affect all non-Claude, non-Anthropic models served through OpenCode Zen. The provider's default behavior may need to be updated to correctly route requests based on the model family.

Recommendation

Apply the workaround by manually forcing the endpoint in config.yaml until a permanent fix is available, as it allows the model to function correctly despite the provider's default behavior.

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 - ✅(Solved) Fix [Bug]: OpenCode Zen routes kimi-k2.5-free to /messages instead of /chat/completions [1 pull requests]