Hermes Agent

Run Hermes Agent, Nous Research's open-source agent, on Tchavi: one block in config.yaml, one environment variable and credits topped up with mobile money.

Part of the coding agents guides.

Hermes Agent is Nous Research's open-source agent. It runs in your terminal, as a desktop app or as a messaging gateway, and works with the model you choose. It accepts any OpenAI-compatible endpoint: one block in its config.yaml and one environment variable are enough to run it on your Tchavi credits, with a single account and a single balance for every model.

1. Create the key

Create a key in the dashboard and top up your balance from the billing page before the first call. Mobile money payments lists the countries and operators. Then export the key in the shell you start Hermes from, or add it to ~/.hermes/.env:

Bash
export TCHAVI_API_KEY=sk-tch-your-key

2. Declare Tchavi in config.yaml

Open ~/.hermes/config.yaml and set the model block:

yaml
model:
  default: 'deepseek-v4.1-flash'
  provider: custom
  base_url: 'https://tchavi.com/api/v1'
  key_env: TCHAVI_API_KEY

provider: custom tells Hermes the server is not one of its built-in providers. key_env names the variable Hermes reads the key from: the key itself never goes in the file.

Do not use OPENAI_API_KEY

For a custom endpoint, Hermes ignores OPENAI_API_KEY and OPENAI_BASE_URL: it only sends them to OpenAI's own hosts. Use provider: custom, base_url and key_env.

Alternative: the hermes model wizard

If you would rather not edit the file, run hermes model and pick Custom endpoint. The wizard asks for the base URL (https://tchavi.com/api/v1), the key, the model name, the context size (leave it blank to auto-detect) and the API mode, then writes config.yaml for you. The wizard stores a pasted key in ~/.hermes/.env as HERMES_MODEL_API_KEY.

Alternative: hermes config set

hermes config set writes one value: an UPPER_CASE name goes to ~/.hermes/.env, a dotted key goes to config.yaml.

Bash
hermes config set model.provider custom
hermes config set model.base_url https://tchavi.com/api/v1
hermes config set model.default deepseek-v4.1-flash
hermes config set model.key_env TCHAVI_API_KEY
hermes config set TCHAVI_API_KEY sk-tch-your-key

Check it on your machine

Hermes documents the "upper case to .env, dots to config.yaml" routing, but the exact hermes config set model.key_env … call was not run while writing this guide. Look at config.yaml afterwards (hermes config show) to confirm the result.

3. Verify

Bash
hermes doctor
hermes chat -q "Answer with one word: OK"

hermes doctor checks the install and the configuration. hermes chat -q sends a single question and returns: it is the cheapest test, especially with a small model.

At startup Hermes prints a Context limit: … tokens line with the window size it detected. Hermes requires at least 64,000 tokens of context and refuses a model below that. If the value is missing or wrong, set it yourself under model:

yaml
model:
  context_length: 1048576

A smaller window costs less

Hermes compresses long conversations itself. Setting context_length lower than the model's window (200,000, for example) triggers that compression earlier, so fewer tokens are sent back on every turn. It is a tuning choice, not a rule.

Point the auxiliary models at Tchavi too

Hermes makes small calls beside the conversation: summarising a history that has grown too long (compression), titling the session (title_generation), describing an image (vision), classifying a command that needs approval (approval). Each has its own block under auxiliary, and the default is provider: auto, which means "the same model as the main model".

If your main model is a big one, those housekeeping calls are therefore billed at its price. Send them to a small model, and give the key explicitly: an auxiliary block's key does not fall back to TCHAVI_API_KEY.

yaml
auxiliary:
  compression:
    provider: custom
    base_url: 'https://tchavi.com/api/v1'
    api_key: ${TCHAVI_API_KEY}
    model: qwen3.7-flash
  title_generation:
    provider: custom
    base_url: 'https://tchavi.com/api/v1'
    api_key: ${TCHAVI_API_KEY}
    model: qwen3.7-flash
  vision:
    provider: custom
    base_url: 'https://tchavi.com/api/v1'
    api_key: ${TCHAVI_API_KEY}
    model: qwen3.7-flash

${TCHAVI_API_KEY} is replaced by the value of the environment variable. If it is not set, Hermes keeps the text as it is and logs a warning.

provider: custom next to base_url

base_url wins over provider. Keeping provider: custom beside it is our reading of Hermes's code, not an example from its documentation: if an auxiliary block does not go to Tchavi, remove that line and look at Usage in the dashboard.

The approval block is written the same way, with a small model, if you use automatic command approval.

4. Plan a fallback

If a model returns an error or does not answer, Hermes can switch to another. Add an entry with hermes fallback add (same picker as hermes model), or write it:

yaml
fallback_providers:
  - provider: custom
    model: deepseek-v4-pro
    base_url: 'https://tchavi.com/api/v1'
    key_env: TCHAVI_API_KEY

Hermes switches on 429, 500, 502 and 503 after its retries, and straight away on 401, 403 and 404. It does so at most once per turn and goes back to the main model on the next message. hermes fallback check verifies that each entry's credentials are ready.

A fallback that stays on Tchavi protects you from a single model going down, not from the gateway itself going down.

Models

An agent sends the same system prompt, the same tools and the history already exchanged on every turn. What weighs on the bill is therefore mostly the cached input price, far more than the fresh input price. Prices below are in F CFA per million tokens: input, output, cached input.

RoleModelInputOutputCachedNotes
Everyday choicedeepseek-v4.1-flash1104394.71,048,576 tokens of context, reads images. It reasons by default: keep effort low.
Hard coding tasksclaude-sonnet-5-51,4667,33373See the cache warning below.
Alternative for hard tasksgpt-6-sol1,4667,333147Same input and output price, cache reads twice as dear.
Hard, cheaperdeepseek-v4-pro9672,90032No image input.
Auxiliary: summaries, titles, visionqwen3.7-flash22975.31,000,000 tokens of context, reads images.

deepseek-v4.1-flash reasons before it answers, and those thinking tokens are billed as output. For routine work, keep the reasoning effort low. For qwen3.7-flash, the reasoning behaviour has not been measured: watch your first bills in Usage. Any chat model that calls tools and has at least 64,000 tokens of context works; GET /v1/models returns the full list, and prices are in the catalogue.

Eco mode, for background tasks

Adding :eco to the id (deepseek-v4.1-flash:eco) bills the request at half the list price. Hermes sends the id as it is (per its code, not tested end to end), so default: 'deepseek-v4.1-flash:eco' should work. The answer is 2 to 4 times slower, and at busy times Tchavi can reply 429 with eco_mode_saturated: the request is then not charged. Keep it for background or scheduled tasks, and add a fallback entry pointing at the id without :eco. Details in Eco mode.

No service_tier at provider level

Do not put service_tier: flex in a provider's extra_body: it would apply to every model, and any model without Eco mode would answer with a 400. Use the :eco suffix, model by model.

A complete example

yaml
model:
  default: 'deepseek-v4.1-flash'
  provider: custom
  base_url: 'https://tchavi.com/api/v1'
  key_env: TCHAVI_API_KEY
  context_length: 1048576

auxiliary:
  compression:
    provider: custom
    base_url: 'https://tchavi.com/api/v1'
    api_key: ${TCHAVI_API_KEY}
    model: qwen3.7-flash
  title_generation:
    provider: custom
    base_url: 'https://tchavi.com/api/v1'
    api_key: ${TCHAVI_API_KEY}
    model: qwen3.7-flash
  vision:
    provider: custom
    base_url: 'https://tchavi.com/api/v1'
    api_key: ${TCHAVI_API_KEY}
    model: qwen3.7-flash

fallback_providers:
  - provider: custom
    model: deepseek-v4-pro
    base_url: 'https://tchavi.com/api/v1'
    key_env: TCHAVI_API_KEY

What Hermes loses behind a gateway

Worth knowing before you choose, rather than finding out in the middle of a task:

  • No cache markers for Claude. On a custom endpoint, Hermes does not add Claude's cache_control markers by default. Prefer models that cache the start of the prompt on the server without any marker (DeepSeek, GPT, Qwen, Kimi). With claude-sonnet-5-5, the cache-read rate may therefore not apply: look at the credits charged in Usage before leaving it running for long.
  • OPENAI_API_KEY and OPENAI_BASE_URL are ignored for a custom endpoint. Only key_env or api_key count.
  • Reasoning parameters only travel through extra_body. For a custom host, Hermes only sends them in that field, and only when it judges the model supports them. We did not verify what it sends to Tchavi on this point: if the effort setting seems to do nothing, look at the output tokens in Usage.
  • At least 64,000 tokens of context. A smaller model is refused at startup.
  • Auxiliary blocks do not reuse the main key. Each one has its own api_key.

When something fails

What you seeWhat it meansFix
401 / invalid_api_keyThe key is wrong, missing or not a Tchavi keyExport TCHAVI_API_KEY in the shell Hermes runs from; it starts with sk-tch-
402 / insufficient_creditsYour balance is too low for this requestTop up from the billing page; see payments
404 / model_not_foundNo model has that idCheck the spelling against GET /v1/models
403 / model_not_allowedThat model exists but is not availablePick another id from GET /v1/models
404 on every requestThe base URL is wrongUse https://tchavi.com/api/v1, with the /v1
400 / unsupported_parameterA parameter does not exist for that modelRemove it, and do not add service_tier: flex to any provider
429 / eco_mode_saturatedEco mode is saturated, nothing was chargedRetry, or use the id without :eco; add a fallback
429Rate limit: per key, per user and per IPWait for the Retry-After seconds; Hermes retries by itself

Every request Hermes sends appears under Usage in the dashboard, with its model, token counts and credits charged. Keep a separate key for Hermes: the log then shows what it spends, apart from your other tools.


Back to coding agents

On this page