Use Hermes Agent with a private API

Connect Hermes Agent to the private Morse API: set it up, pick a model, and check it works.

Give Hermes Agent the base URL https://inference.trymorse.ai/v1 and a Morse API key. It calls the OpenAI API.

Before you start

Make a key for Hermes Agent alone, with a spend limit, under API keys in the console. Then one tool can't spend all your credits. See Limit a key. Keep the key in your environment, where Hermes Agent reads it.

Terminal
export MORSE_API_KEY="sk_morse_..."

Set it up with a prompt

Paste this into a coding agent, such as Claude Code or Codex, and it sets up Hermes Agent for you. Or set it up by hand, below.

Setup prompt
Set up Hermes Agent to use Morse.

1. Use the OpenAI-compatible endpoint https://inference.trymorse.ai/v1
2. Read the key from the MORSE_API_KEY environment variable.
3. Default to the model qwen/qwen3-coder.
4. Follow https://trymorse.ai/inference/docs/tools/hermes-agent, then run its check.

Change only Hermes Agent's settings. Leave everything else as it is.

Set up Hermes Agent

  1. Add Morse as a custom endpoint

    Put this in ~/.hermes/config.yaml, in place of the file's model section. It names the base URL, the variable your key is in, the model Hermes starts on, and the model's context.

    config.yaml
    model:
      provider: custom
      base_url: https://inference.trymorse.ai/v1
      key_env: MORSE_API_KEY
      default: qwen/qwen3-coder
      context_length: 262144

    Or run hermes model in your terminal, choose Custom endpoint, and enter the base URL, your key, and the model id when it asks. It saves the same settings to the file.

  2. Start Hermes

    Start a session in your project's folder. To switch models inside it, type /model custom: and the model's id.

    Terminal
    hermes

Which model to pick

ModelContextInput / outputWhy
qwen/qwen3-coder262.1K$0.375 / $1.25Qwen's coding model. It doesn't reason, so it starts writing sooner.
moonshotai/kimi-k3.1-pro1M$2 / $10Reasons, and reads images.
z-ai/glm-5.31M$1.40 / $4.40Reasons, and takes tools at TEE too.
deepseek/deepseek-v4-pro-08131M$1.32 / $3.96Reasons, at a lower price.
z-ai/glm-5.3-flash1M$0.15 / $0.50Cheap and fast for small edits, and takes tools at TEE too.

Prices are in dollars per million tokens, on each model's default endpoint. Every model is on the models page.

Check it works

Ask Hermes to list the files in your folder. It calls a tool to read them, so an answer shows that Morse handled both the request and the tool call. One command asks and exits:

Terminal
hermes -z "List the files in this folder."

Keep it private

Set a privacy floor on Hermes Agent's key to hold it to a tier, such as TEE. Without a floor, a request runs on its model's default privacy tier. The floor only decides which endpoints serve the requests. See Privacy tiers and Provider routing.

On a plain API call, TLS ends inside Morse's door, an attested enclave, which seals the request before the relay receives it. A plain client checks the door's certificate, not its attestation. To check the attestation yourself, see Sealed API keys.

If something goes wrong

What you seeWhat to do
Hermes still answers from another providerRun hermes doctor. It reads config.yaml and says which provider and base URL it uses.
401 invalid_api_keyCheck that MORSE_API_KEY is set where Hermes Agent starts, and that the key isn't revoked.
402 insufficient_balance or key_spend_limit_reachedAdd credits, or raise the key's spend limit. A request holds credit for its output limit before it starts: see Holds.
404 model_not_foundUse a model's id exactly as the table above writes it, with the part before the slash.

Every code is in Error codes. For other tools, see Tools and coding agents.