Install SDKs
Set up Anthropic SDK, Claude Code, OpenAI SDK, and Codex CLI
Runars is compatible with the official Anthropic and OpenAI SDKs, as well as Claude Code and Codex CLI. No special versions or modifications are needed—just point them at Runars and use your API key.
Anthropic SDK
Installation
npm install @anthropic-ai/sdkSetup
import Anthropic from "@anthropic-ai/sdk"
const anthropic = new Anthropic({
baseURL: "https://api.runars.ca",
apiKey: process.env.ANTHROPIC_API_KEY,
})
const message = await anthropic.messages.create({
model: "glm-5.2",
max_tokens: 1024,
messages: [
{
role: "user",
content: "What is 2+2?",
},
],
})
console.log(message.content[0].type === "text" && message.content[0].text)Environment variables
export ANTHROPIC_API_KEY="sk-runars-..."
export ANTHROPIC_BASE_URL="https://api.runars.ca"The SDK reads these automatically if you don't explicitly pass baseURL and apiKey.
Claude Code
Claude Code (available in Claude IDE, VS Code extension, and JetBrains IDEs) uses the Anthropic SDK under the hood.
Setup
Set these environment variables:
export ANTHROPIC_API_KEY="sk-runars-..."
export ANTHROPIC_BASE_URL="https://api.runars.ca"Claude Code will automatically use Runars when configured this way. You can also specify a custom organization/project ID if using Runars's org-based billing.
OpenAI SDK
Installation
npm install openaiSetup
import OpenAI from "openai"
const openai = new OpenAI({
baseURL: "https://api.runars.ca/v1",
apiKey: process.env.OPENAI_API_KEY,
})
const completion = await openai.chat.completions.create({
model: "glm-5.2",
max_tokens: 1024,
messages: [
{
role: "user",
content: "What is 2+2?",
},
],
})
console.log(completion.choices[0].message.content)Environment variables
export OPENAI_API_KEY="sk-runars-..."
export OPENAI_BASE_URL="https://api.runars.ca/v1"Important: The base URL must end with /v1 for OpenAI SDK compatibility.
Codex CLI
Codex is a command-line tool for LLM-based code generation. It also uses the OpenAI API format.
Setup
Set these environment variables:
export OPENAI_API_KEY="sk-runars-..."
export OPENAI_BASE_URL="https://api.runars.ca/v1"Critical: Codex specifically requires the base URL to end in /v1. Without this, it will fail to authenticate.
Example usage
codex "Write a function to calculate Fibonacci numbers"Codex will use Runars's GLM-5.2 model for code generation.
Verifying your setup
Test the Anthropic SDK
export ANTHROPIC_API_KEY="sk-runars-..."
export ANTHROPIC_BASE_URL="https://api.runars.ca"
node -e "
const Anthropic = require('@anthropic-ai/sdk').default;
const client = new Anthropic();
client.messages.create({
model: 'glm-5.2',
max_tokens: 100,
messages: [{role: 'user', content: 'Hello'}]
}).then(m => console.log(m.content[0].text));
"Test the OpenAI SDK
export OPENAI_API_KEY="sk-runars-..."
export OPENAI_BASE_URL="https://api.runars.ca/v1"
node -e "
const OpenAI = require('openai').default;
const client = new OpenAI();
client.chat.completions.create({
model: 'glm-5.2',
max_tokens: 100,
messages: [{role: 'user', content: 'Hello'}]
}).then(c => console.log(c.choices[0].message.content));
"Troubleshooting
"401 Unauthorized": Check that your API key is correct and hasn't been revoked. Verify it matches the one in your dashboard (Dashboard → API Keys).
"403 Forbidden": Your API key is valid but your organization has no credit balance. Top up in Dashboard → Payments.
"429 Too Many Requests": You've exceeded your rate limit for this organization. Check Dashboard → Rate Limits to see your tier and usage.
Claude Code can't find Runars: Ensure both ANTHROPIC_API_KEY and ANTHROPIC_BASE_URL are exported in your shell session. Reload your IDE after changing environment variables.
Codex isn't working: Verify that OPENAI_BASE_URL ends with /v1 (e.g., https://api.runars.ca/v1, not https://api.runars.ca).
What's next
- Ready to dive into the endpoints? See the API Endpoints reference.
- Questions about billing? Check Pricing.