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_lengthin 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/modelsprobe (queries provider's live metadata) - Provider-aware lookups (Anthropic, Nous, Copilot, models.dev)
- OpenRouter live API
DEFAULT_CONTEXT_LENGTHStable (hardcoded fallback, line ~211 inmodel_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 returncontext_lengthmetadata? 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/modelsendpoint (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"inDEFAULT_CONTEXT_LENGTHS= 131,072. Newer Qwen models not explicitly listed will hit this.Global overrides —
model.context_lengthin config.yaml applies to every model, not just the default. Usecustom_providersfor per-model control.Missing endpoint metadata — Some providers'
/v1/modelsdoesn't includecontext_lengthfield, 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_providersentry with verified values - Restart Hermes for changes to take effect
Support files
See references/verified-model-specs.md for current provider model specs.