AnRouter
Verified against the current service routes · July 31, 2026

AnRouter integration guide

From your first request to Codex, Claude Code, OpenCode, OpenClaw, and Hermes Agent. Every example distinguishes a Base URL from a full endpoint to prevent duplicate paths.

5-minute quickstart

Create an API key in the AnRouter dashboard, then copy a model ID from the models page. The examples below use the currently listed glm-5.3.

Python requires the official openai package. The Node.js example requires the openai package and must be saved as an ES module, for example example.mjs. Set ANROUTER_API_KEY in the process environment before running either example.

1 · Key
Create an API key
2 · URL
Use the correct Base URL
3 · Model
Copy the exact model ID
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["ANROUTER_API_KEY"],
    base_url="https://api.anrouter.com/v1",
)

response = client.chat.completions.create(
    model="glm-5.3",
    messages=[{"role": "user", "content": "Introduce yourself in three sentences."}],
)
print(response.choices[0].message.content)
Success criteria: the response has HTTP status 200 and contains assistant output. Before production, separately test streaming, tool calling, and any required multimodal features. A successful text response does not prove every advanced feature is supported.