OpenAI-compatibleNous Research

Hermes + MegaBrain Gateway

Hermes (by Nous Research) is a fine-tuned model family purpose-built for tool use, function calling, and agentic tasks. Access the full Hermes lineup — and 500+ other models — through MegaBrain with a single API key.

Why use MegaBrain?

Best Hermes pricing

MegaBrain aggregates providers so you always get the lowest cost per token for every Hermes variant.

Automatic failover

If one provider is down or rate-limited, requests automatically retry on another — zero config needed.

Mix with other models

Switch between Hermes, Claude, GPT-4o, Gemini, and more without changing any client code.

Prerequisites

  • A MegaBrain API key — get one from your profile
  • Any OpenAI-compatible client (curl, the OpenAI SDK, Cline, Cursor, etc.)

Hermes model variants

ModelModel IDBest for
Hermes 3 70Bnousresearch/hermes-3-llama-3.1-70bFast agentic loops, function calling, daily coding tasks
Hermes 3 405Bnousresearch/hermes-3-llama-3.1-405bComplex reasoning, large-context tool use, highest accuracy

Quick start

Call Hermes 3 70B directly with curl — just swap in your MegaBrain API key:

curl https://getmegabrain.com/api/gateway/v1/chat/completions \
  -H "Authorization: Bearer $MEGABRAIN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "nousresearch/hermes-3-llama-3.1-70b",
    "messages": [
      {
        "role": "user",
        "content": "List all files in the current directory and summarize what each one does."
      }
    ],
    "tools": [
      {
        "type": "function",
        "function": {
          "name": "run_shell",
          "description": "Execute a shell command and return stdout",
          "parameters": {
            "type": "object",
            "properties": {
              "command": { "type": "string" }
            },
            "required": ["command"]
          }
        }
      }
    ],
    "tool_choice": "auto"
  }'

Or use the OpenAI Node SDK — the base URL is the only change:

import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env.MEGABRAIN_API_KEY,
  baseURL: 'https://getmegabrain.com/api/gateway/v1',
});

const response = await client.chat.completions.create({
  model: 'nousresearch/hermes-3-llama-3.1-70b',
  messages: [{ role: 'user', content: 'Refactor this function to use async/await.' }],
});

console.log(response.choices[0].message.content);

Use Hermes with coding agents

1

Get your MegaBrain API key

Copy your key from your profile page. You will use this as the API key in every client below.

2

Configure Cline (VS Code)

Open Cline settings, choose OpenAI Compatible as the provider, then fill in:

Base URL:  https://getmegabrain.com/api/gateway/v1
API Key:   your-megabrain-api-key
Model ID:  nousresearch/hermes-3-llama-3.1-70b
3

Configure Cursor

In Cursor → Settings → Models → Add Model, enter:

OpenAI Base URL: https://getmegabrain.com/api/gateway/v1
API Key:         your-megabrain-api-key
Model name:      nousresearch/hermes-3-llama-3.1-405b
4

Any other OpenAI-compatible tool

Set these two environment variables — most tools pick them up automatically:

export OPENAI_API_KEY="your-megabrain-api-key"
export OPENAI_BASE_URL="https://getmegabrain.com/api/gateway/v1"
export OPENAI_MODEL="nousresearch/hermes-3-llama-3.1-70b"

What Hermes excels at

Function calling

Hermes was fine-tuned specifically on tool-use datasets. It reliably selects the right tool and formats arguments correctly, even with large schemas.

Structured output

Request JSON, XML, or any schema and Hermes produces valid, parseable output without extra prompting or post-processing.

Agentic loops

Hermes maintains state across multi-step tool calls without losing context, making it ideal for long-running coding agent sessions.

Reasoning

Built on Llama 3.1, Hermes 3 inherits strong base reasoning while the Nous fine-tune sharpens instruction following and chain-of-thought.

Recommended Hermes model IDs on MegaBrain

nousresearch/hermes-3-llama-3.1-70bFast · best price/performance
nousresearch/hermes-3-llama-3.1-405bMost capable · highest accuracy

Pass these strings as the model field. MegaBrain routes to the best available provider automatically.

Tip: Use auto-frontier as the model ID to let MegaBrain automatically pick the best available model for each request — great for benchmarking Hermes against other options.

Troubleshooting

I get a 401 Unauthorized error.

Double-check that your API key is copied correctly and that you are using it as the Bearer token (not an OpenRouter or OpenAI key).

Tool calls come back malformed or empty.

Ensure you are passing a well-formed tools array in your request body. Hermes expects the standard OpenAI function-calling schema. Check that tool_choice is set to "auto" or the function name.

Responses are slower than expected on 405B.

The 405B model is significantly larger — if latency is critical, switch to the 70B variant which is 3-5× faster with minimal quality loss for most coding tasks.

My coding agent says the model is not found.

Verify the base URL is set to https://getmegabrain.com/api/gateway/v1 (not /api/openrouter) and the model ID matches exactly: nousresearch/hermes-3-llama-3.1-70b.