Skip to content

[Bug]: custom_providers model field not preserved, causing "Model Not Exist" errors #7828

@Wildfruit123

Description

@Wildfruit123

Bug Description

When using custom_providers configuration in Hermes Agent, model switching via the --model parameter fails with "Model Not Exist" error from the API. The same configuration works perfectly when set as the default model.

Environment

+- Hermes Agent Version: v0.8.0 (2026.4.8) · upstream af9caec
+- OS: Linux
+- Python: 3.12

Steps to Reproduce

+### 1. Configuration
+Add to ~/.hermes/config.yaml:
+```yaml
+custom_providers:
+- name: qwen3.6-plus

+### 2. Test with custom_providers (FAILS)
+bash +hermes chat --model qwen3.6-plus -q "Hello" --quiet +
+Result: Session created but no response. Log shows:
+ +ERROR root: Non-retryable client error: Error code: 400 - {'error': {'message': 'Model Not Exist', 'type': 'invalid_request_error', 'param': None, 'code': 'invalid_request_error'}} +
+
+### 3. Test as default model (WORKS)
+Change default config:
+```yaml
+model:

+### 4. Direct API test (WORKS)
+```bash
+curl -X POST https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions \

  • -H "Authorization: Bearer $ALI_API_KEY" \
  • -H "Content-Type: application/json" \
  • -d '{"model": "qwen3.6-plus", "messages": [{"role": "user", "content": "Hello"}], "max_tokens": 50}'
    +```
    +Result: API responds correctly.

Expected Behavior

+When using --model qwen3.6-plus, Hermes should:
+1. Recognize qwen3.6-plus as a custom_provider
+2. Use the configured base_url, api_key, and model field
+3. Successfully call the API with model name qwen3.6-plus

Actual Behavior

  1. Hermes recognizes qwen3.6-plus as a custom_provider
    +2. But sends an incorrect request causing "Model Not Exist" error
    +3. Same configuration works when set as default model

Affected Component

Configuration (config.yaml, .env, hermes setup)

Messaging Platform (if gateway-related)

No response

Operating System

Ubuntu24.04

Python Version

3.12

Hermes Version

0.8.0

Relevant Logs / Traceback

Root Cause Analysis (optional)

+After inspecting the code:
+
+### Problem 1: ProviderDef missing model field
+In hermes_cli/providers.py:
+```python
+class ProviderDef:

  • id: str
  • name: str
  • transport: str
  • api_key_env_vars: Tuple[str, ...]

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/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