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-..."
openclawHermes
yaml
provider:
type: openai
base_url: https://iranrouter.com/v1
api_key: ir-...
model: anthropic/claude-sonnet-4.5Tools that speak Anthropic
bash
export ANTHROPIC_BASE_URL="https://iranrouter.com/v1"
export ANTHROPIC_API_KEY="ir-..."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:
- Give each agent its own key. You can then kill one without killing the rest, and usage reporting tells you which agent spent what.
- 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