IranRouter
Docs contents

Docs

Agents & tooling

OpenClaw, Hermes, Cursor, Continue, LangChain — anything that takes a base_url.

Anything that takes a base_url and a key works with IranRouter — no plugin, no adapter. This page gives the configuration for the common ones.

Environment variables (most tools)

bash
export OPENAI_BASE_URL="https://iranrouter.com/v1"
export OPENAI_API_KEY="ir-..."

To make it permanent, put both lines in ~/.zshrc or ~/.bashrc. Some older libraries look for OPENAI_API_BASE instead of OPENAI_BASE_URL; if it will not connect, set both.

OpenClaw

bash
export OPENAI_BASE_URL="https://iranrouter.com/v1"
export OPENAI_API_KEY="ir-..."
openclaw

Hermes

yaml
provider:
  type: openai
  base_url: https://iranrouter.com/v1
  api_key: ir-...
  model: anthropic/claude-sonnet-4.5

Tools that speak Anthropic

bash
export ANTHROPIC_BASE_URL="https://iranrouter.com/v1"
export ANTHROPIC_API_KEY="ir-..."

Details of /v1/messages →

LangChain

python
from langchain_openai import ChatOpenAI

llm = ChatOpenAI(
    model="openai/gpt-4o-mini",
    api_key="ir-...",
    base_url="https://iranrouter.com/v1",
)

Before you leave an agent running

An autonomous agent can fire hundreds of requests in minutes. Two things before an overnight run:

  1. Give each agent its own key. You can then kill one without killing the rest, and usage reporting tells you which agent spent what.
  2. Put a daily budget on that key. A ceiling means a coding mistake cannot spend past your number.

An agent can also check its own headroom first: GET /v1/key