Adding Providers
إضافة مزوّد نموذج جديد
Start with meaning, then move to detail.
This lesson explains Adding Providers as part of Hermes internals and extension points. You will learn what it does, when it matters, and the smallest safe test that proves it works.
If you are new, do not memorize names. Focus on three questions: what problem does this solve, what access does it need, and how can you verify the result?
For practice, inspect the first example, identify its effects, run it on test data, and compare the result with the source claim.
For advanced readers, inspect The mental model, Tool-call wire format, Choose the implementation path first, then verify failure modes and version compatibility.
Know Python, Git, and basic project structure before changing code.
A clear outcome before you read.
- Understand Adding Providers without assumed prior knowledge.
- Separate the source description from what still needs testing in your environment.
- Read the first command and identify its inputs and outputs before copying it.
Short definitions before the details.
- Provider
- The service that runs or provides access and authentication to a model.
- Tool
- A structured action the agent can call to read or change something.
How to add a new inference provider to Hermes Agent — auth, runtime resolution, CLI flows, adapters, tests, and docs
What does the source say, and in what order?
- 01The mental model
Start here to understand the core idea or structure.
- 02Tool-call wire format
Read this after the foundation, then connect it to the previous step.
- 03Choose the implementation path first
Read this after the foundation, then connect it to the previous step.
- 04Path A — OpenAI-compatible provider
Read this after the foundation, then connect it to the previous step.
- 05Path B — Native provider
Read this after the foundation, then connect it to the previous step.
- 06File checklist
Read this after the foundation, then connect it to the previous step.
- 07Required for every built-in provider
Read this after the foundation, then connect it to the previous step.
- 08Additional for native / non-OpenAI providers
Read this after the foundation, then connect it to the previous step.
- 09Fast path: Simple API-key providers
Read this after the foundation, then connect it to the previous step.
- 10Full path: OAuth and complex providers
Finish here to verify the result and special cases.
Copy only after you understand the effect.
anthropic:claude-sonnet-4-6
kimi:model-nameIf the provider is OpenAI-compatible, `api_mode` should usually stay `chat_completions`.
Be careful with API-key precedence. Hermes already contains logic to avoid leaking an OpenRouter key to unrelated endpoints. A new provider should be equally explicit about which key goes to which base URL.
## Step 5: Wire the CLI in `hermes_cli/main.py`
A provider is not discoverable until it shows up in the interactive `hermes model` flow.
Update these in `hermes_cli/main.py`:
- `provider_labels` dict
- `providers` list in `select_provider_and_model()`
- provider dispatch (`if selected_provider == .For deeper changes, run the full suite before pushing:Read the first command and identify its inputs and outputs before copying it.
Match every command to your installed Hermes version, review the files and accounts it can reach, and use non-sensitive data for the first test. If this explanation differs from the source, the official source wins.