SDKs & agents
Install the SDK for your selected protocol, choose an enabled model from the catalog, and keep your AtmoRouter key in ATMOROUTER_API_KEY. Do not put a real secret in source control.
python -m pip install openai anthropic\n# JavaScript projects:\nnpm install openai @anthropic-ai/sdkOpenAI Python
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["ATMOROUTER_API_KEY"],
base_url="https://atmorouter.dev/v1",
)
response = client.chat.completions.create(
model="cbcn/glm-5.3",
max_tokens=128,
messages=[{"role": "user", "content": "Hello!"}],
)
print(response)OpenAI JavaScript
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.ATMOROUTER_API_KEY,
baseURL: "https://atmorouter.dev/v1",
});
const response = await client.chat.completions.create({
"model": "cbcn/glm-5.3",
"messages": [
{
"role": "user",
"content": "Hello!"
}
],
"max_tokens": 128
});
console.log(response);Anthropic Python
import os
from anthropic import Anthropic
client = Anthropic(
api_key=os.environ["ATMOROUTER_API_KEY"],
base_url="https://atmorouter.dev",
)
response = client.messages.create(
model="cbcn/glm-5.3",
max_tokens=128,
messages=[{"role": "user", "content": "Hello!"}],
)
print(response)Claude Code
Set the bare host as the Anthropic base URL and select a model suited to the agent’s tool-use requirements. Restart the agent after changing its environment.
export ANTHROPIC_BASE_URL="https://atmorouter.dev"
export ANTHROPIC_AUTH_TOKEN="$ATMOROUTER_API_KEY"
export ANTHROPIC_MODEL="YOUR_MODEL_ID"
claudeOpenCode
Use the Chat Completions adapter and an environment reference for the secret:
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"atmorouter": {
"npm": "@ai-sdk/openai-compatible",
"name": "AtmoRouter",
"options": {
"baseURL": "https://atmorouter.dev/v1",
"apiKey": "{env:ATMOROUTER_API_KEY}"
},
"models": {
"YOUR_MODEL_ID": {
"name": "YOUR_MODEL_ID"
}
}
}
},
"model": "atmorouter/YOUR_MODEL_ID"
}The setup helper generates these settings with backups. See Compatibility before configuring a Responses-based client. Agent versions and model capabilities can change independently of the gateway.