Model-Agnostic by Design: Nous Portal, OpenRouter, and Direct APIs

10 min read Module 2 of 9 Topic 4 of 25

What you'll learn

  • Configure Hermes to use Nous Portal, OpenRouter, and at least one direct provider API
  • Explain the tradeoff between OAuth subscription access and pay-per-token API keys
  • Set provider routing preferences (price, throughput, latency) on OpenRouter
  • Store credentials correctly across ~/.hermes/.env and config.yaml
Building this at your company? For enterprise and company teams taking this to production: book a 30-minute session with our AI engineers for architecture guidance, code review, and a rollout plan for your use case.
Book a Team Session

The Point of Being Model-Agnostic

Hermes does not ship tied to one model vendor. hermes model is a single command that walks you through connecting any of over a dozen backends, and you can hold several configured at once, switching mid-session with /model. This lesson covers the three most common entry points: Nous Portal (aggregated OAuth), OpenRouter (aggregated API), and direct provider APIs.

Option 1: Nous Portal

The fastest path from zero to a working agent. One OAuth login covers 300+ frontier agentic models across providers, Claude, GPT, Gemini, DeepSeek, Qwen, Kimi, GLM, MiniMax, Grok, and more, without juggling separate API keys and bills.

hermes setup --portal     # OAuth + provider + gateway, in one command
hermes model              # or, pick "Nous Portal" from the interactive list

This is the mode you used in Lesson 2’s Quick Setup. It’s the right default while you’re still deciding which model fits your workload.

Option 2: OpenRouter

OpenRouter is a pay-per-token aggregator with its own routing intelligence across the providers that host a given model.

# ~/.hermes/.env
OPENROUTER_API_KEY=sk-or-...
# ~/.hermes/config.yaml
model:
  provider: "openrouter"
  default: "anthropic/claude-sonnet-5"

provider_routing:
  sort: "price"              # or "throughput", "latency"
  ignore: ["deepinfra"]      # exclude specific backend providers

provider_routing is OpenRouter-specific and worth understanding: many open-weight models are hosted by several competing inference providers behind OpenRouter’s single API. sort tells OpenRouter which dimension to optimize when picking among them per request. If a project cares more about not timing out than about shaving fractions of a cent, switch to sort: "latency".

Option 3: Direct Provider APIs

For production workloads, or when you need provider-specific guarantees, connect directly.

Anthropic:

# ~/.hermes/.env
ANTHROPIC_API_KEY=sk-ant-...
model:
  provider: "anthropic"
  default: "claude-sonnet-5"

Claude subscribers can also use OAuth instead of a pay-per-token key, run hermes model and select the OAuth flow for extra usage credits on eligible plans.

OpenAI:

export OPENAI_API_KEY=sk-...
hermes chat --provider openai-api --model gpt-5.4

Google (direct or Vertex AI):

export GOOGLE_API_KEY=...
# Vertex AI variant, for GCP-native deployments
model:
  provider: "vertex"
  default: "google/gemini-3-flash-preview"
vertex:
  project_id: "my-gcp-project"
  region: "global"

AWS Bedrock, if your organization already routes model traffic through AWS, needs no API key at all, it uses the standard boto3 credential chain:

export AWS_PROFILE=my-profile
export AWS_REGION=us-east-1
hermes chat --provider bedrock --model us.anthropic.claude-sonnet-5

Switching Providers Mid-Session

You don’t need to restart Hermes to change models. Inside an active chat:

/model

opens the same picker hermes model shows outside a session, letting you swap providers or models on the fly, useful when you start a task on a fast, cheap model and want to escalate to a stronger one partway through.

Checking What You’ve Got Configured

hermes doctor

validates every configured provider’s credentials and reports which are reachable, catching a typo’d API key or an expired OAuth token before it surfaces as a confusing mid-task failure.

Exercise: connect two providers, Nous Portal (or OpenRouter) plus one direct API key, set your default to the aggregator, and confirm you can switch to the direct connection with /model mid-session. You’ll use both again in Lesson 6 when you build a fallback chain between them.

Knowledge Check

3 questions to test your understanding

1 What is the main practical advantage of connecting Hermes through Nous Portal instead of five separate provider API keys?

2 In an OpenRouter provider_routing config, what does `sort: 'price'` actually control?

3 You configure both an OpenRouter key and a native ANTHROPIC_API_KEY. When would you deliberately choose the native Anthropic connection over routing the same model through OpenRouter?

Go further with expert guidance

Ready to build production AI?
Talk to our R&D team.

These courses give you the foundation. Our embedded AI teams take you from prototype to production in 30–90 days, with your team, your codebase, your goals. Book a free strategy call to see how we can accelerate your AI initiative.

30 minutes · No obligation · Expert AI engineers, not sales reps

AI Architecture Review

Audit your current stack and identify high-impact improvements

Project Review

Get expert feedback on your AI implementation and codebase

Team Mentoring

Upskill your engineers with hands-on AI coaching sessions

AI Strategy

Define your AI roadmap, prioritization, and implementation plan