Hermes Model Configuration
Diagnose and fix model configuration issues in Hermes: context length display errors, provider setup, custom_providers overrides, and model ID verification.
When to use
- Model picker shows wrong context length (e.g., 128K instead of 1M)
- Adding new model providers to Hermes
- Troubleshooting provider endpoint failures
- Need to override default context lengths for specific models
Context-length resolution chain
Hermes resolves context length via get_model_context_length() in agent/model_metadata.py:
model.context_length in config.yaml (global override — affects ALL models, use carefully)
custom_providers[].models.<id>.context_length (per-model override — preferred)
- Persistent cache (
~/.hermes/context_length_cache.yaml)
- Endpoint
/v1/models probe (queries provider's live metadata)
- Provider-aware lookups (Anthropic, Nous, Copilot, models.dev)
- OpenRouter live API
DEFAULT_CONTEXT_LENGTHS table (hardcoded fallback, line ~211 in model_metadata.py)
- Default fallback: 256K
Diagnosis steps
Check DEFAULT_CONTEXT_LENGTHS — is the model ID present? Generic catch-alls (e.g., "qwen": 131072) fire via longest-substring match and often give wrong values for newer models.
Check endpoint's /v1/models — does it return context_length metadata? Some providers (Alibaba DashScope, some local servers) don't include it.
Verify actual context length from official provider docs — never guess.
Fix: custom_providers per-model override
# In config.yaml (profile-level)
custom_providers:
- name: alibaba
base_url: https://<workspace>.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1
models:
qwen3.8-max-preview:
context_length: 983616
Critical rule: verify before adding
Always verify exact model IDs and context lengths from official provider documentation before adding config entries.
Fabricated IDs or guessed values create silent misbehavior:
- Wrong compression thresholds
- Premature context cuts
- Provider endpoint failures
Check:
- Official provider API docs
- Model catalog/marketplace pages
- Provider's
/v1/models endpoint (if available)
Verified specs (Alibaba DashScope / Qwen Cloud, July 2026)
| Model ID |
Context |
Max Output |
Notes |
qwen3.8-max-preview |
983,616 |
131,072 |
Token Plan only; always-on reasoning |
qwen3.7-max |
262,144 |
— |
General availability |
qwen3.7-plus |
1,000,000 |
— |
General availability |
qwen3.6-plus |
1,000,000 |
— |
General availability |
Source: Qwen Cloud Codex integration metadata + help.aliyun.com/zh/model-studio/ docs.
Common pitfalls
Generic catch-alls — "qwen" in DEFAULT_CONTEXT_LENGTHS = 131,072. Newer Qwen models not explicitly listed will hit this.
Global overrides — model.context_length in config.yaml applies to every model, not just the default. Use custom_providers for per-model control.
Missing endpoint metadata — Some providers' /v1/models doesn't include context_length field, so probes return no data.
Guessing values — Never fabricate model IDs or context lengths. Verify against official docs first.
Workflow
- User reports wrong context length display
- Check if model ID exists in
DEFAULT_CONTEXT_LENGTHS
- If missing or wrong, verify correct specs from official provider docs
- Add
custom_providers entry with verified values
- Restart Hermes for changes to take effect
Support files
See references/verified-model-specs.md for current provider model specs.
1---2name: hermes-model-config3description: Diagnose and fix Hermes model configuration issues — context length display errors, provider setup, custom_providers overrides, and model ID verification. Use when model picker shows wrong context length, provider endpoints fail, or you need to add new models to Hermes configuration.4---5
6# Hermes Model Configuration
7
8Diagnose and fix model configuration issues in Hermes: context length display errors, provider setup, custom_providers overrides, and model ID verification.
9
10## When to use
11- Model picker shows wrong context length (e.g., 128K instead of 1M)
12- Adding new model providers to Hermes
13- Troubleshooting provider endpoint failures
14- Need to override default context lengths for specific models
15
16## Context-length resolution chain
17
18Hermes resolves context length via `get_model_context_length()` in `agent/model_metadata.py`:
19
201. **`model.context_length`** in config.yaml (global override — affects ALL models, use carefully)
212. **`custom_providers[].models.<id>.context_length`** (per-model override — preferred)
223. Persistent cache (`~/.hermes/context_length_cache.yaml`)
234. Endpoint `/v1/models` probe (queries provider's live metadata)
245. Provider-aware lookups (Anthropic, Nous, Copilot, models.dev)
256. OpenRouter live API
267. **`DEFAULT_CONTEXT_LENGTHS`** table (hardcoded fallback, line ~211 in `model_metadata.py`)
278. Default fallback: 256K
28
29## Diagnosis steps
30
311. **Check `DEFAULT_CONTEXT_LENGTHS`** — is the model ID present? Generic catch-alls (e.g., `"qwen": 131072`) fire via longest-substring match and often give wrong values for newer models.
32
332. **Check endpoint's `/v1/models`** — does it return `context_length` metadata? Some providers (Alibaba DashScope, some local servers) don't include it.
34
353. **Verify actual context length from official provider docs** — never guess.
36
37## Fix: custom_providers per-model override
38
39```yaml
40# In config.yaml (profile-level)
41custom_providers:
42 - name: alibaba
43 base_url: https://<workspace>.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1
44 models:
45 qwen3.8-max-preview:
46 context_length: 983616
47```
48
49## Critical rule: verify before adding
50
51**Always verify exact model IDs and context lengths from official provider documentation before adding config entries.**
52
53Fabricated IDs or guessed values create silent misbehavior:
54- Wrong compression thresholds
55- Premature context cuts
56- Provider endpoint failures
57
58Check:
59- Official provider API docs
60- Model catalog/marketplace pages
61- Provider's `/v1/models` endpoint (if available)
62
63## Verified specs (Alibaba DashScope / Qwen Cloud, July 2026)
64
65| Model ID | Context | Max Output | Notes |
66|---|---|---|---|
67| `qwen3.8-max-preview` | 983,616 | 131,072 | Token Plan only; always-on reasoning |
68| `qwen3.7-max` | 262,144 | — | General availability |
69| `qwen3.7-plus` | 1,000,000 | — | General availability |
70| `qwen3.6-plus` | 1,000,000 | — | General availability |
71
72Source: Qwen Cloud Codex integration metadata + `help.aliyun.com/zh/model-studio/` docs.
73
74## Common pitfalls
75
76- **Generic catch-alls** — `"qwen"` in `DEFAULT_CONTEXT_LENGTHS` = 131,072. Newer Qwen models not explicitly listed will hit this.
77
78- **Global overrides** — `model.context_length` in config.yaml applies to every model, not just the default. Use `custom_providers` for per-model control.
79
80- **Missing endpoint metadata** — Some providers' `/v1/models` doesn't include `context_length` field, so probes return no data.
81
82- **Guessing values** — Never fabricate model IDs or context lengths. Verify against official docs first.
83
84## Workflow
85
861. User reports wrong context length display
872. Check if model ID exists in `DEFAULT_CONTEXT_LENGTHS`
883. If missing or wrong, verify correct specs from official provider docs
894. Add `custom_providers` entry with verified values
905. Restart Hermes for changes to take effect
91
92## Support files
93
94See `references/verified-model-specs.md` for current provider model specs.