Documentation Index Fetch the complete documentation index at: https://docs.arouter.ai/llms.txt
Use this file to discover all available pages before exploring further.
ARouter is compatible with any library or framework that supports the OpenAI Chat Completions API. This page covers the most popular integrations.
Official SDKs
ARouter provides first-class SDKs for common languages:
Python SDK pip install arouter
Node.js / TypeScript SDK npm install arouter
Go SDK go get github.com/arouter-ai/arouter-go
OpenAI SDK (Any Language)
Because ARouter is OpenAI-compatible, the official OpenAI SDK works out of the box. Just change base_url and api_key:
from openai import OpenAI
client = OpenAI(
api_key = "your-arouter-key" ,
base_url = "https://api.arouter.ai/v1"
)
response = client.chat.completions.create(
model = "openai/gpt-5.4" ,
messages = [{ "role" : "user" , "content" : "Hello!" }]
)
import OpenAI from "openai" ;
const client = new OpenAI ({
apiKey: "your-arouter-key" ,
baseURL: "https://api.arouter.ai/v1" ,
});
const response = await client . chat . completions . create ({
model: "openai/gpt-5.4" ,
messages: [{ role: "user" , content: "Hello!" }],
});
LangChain
ARouter works with LangChain’s ChatOpenAI class:
from langchain_openai import ChatOpenAI
llm = ChatOpenAI(
model = "anthropic/claude-sonnet-4-6" ,
openai_api_key = "your-arouter-key" ,
openai_api_base = "https://api.arouter.ai/v1" ,
)
response = llm.invoke( "Explain quantum computing in one paragraph." )
print (response.content)
import { ChatOpenAI } from "@langchain/openai" ;
const llm = new ChatOpenAI ({
modelName: "google/gemini-2.5-pro" ,
openAIApiKey: "your-arouter-key" ,
configuration: {
baseURL: "https://api.arouter.ai/v1" ,
},
});
const response = await llm . invoke ( "Explain quantum computing in one paragraph." );
console . log ( response . content );
Vercel AI SDK
Use ARouter as the backend for Vercel AI SDK applications:
import { createOpenAI } from "@ai-sdk/openai" ;
import { generateText } from "ai" ;
const arouter = createOpenAI ({
apiKey: "your-arouter-key" ,
baseURL: "https://api.arouter.ai/v1" ,
});
const { text } = await generateText ({
model: arouter ( "anthropic/claude-sonnet-4-6" ),
prompt: "Write a short poem about the ocean." ,
});
console . log ( text );
PydanticAI
from pydantic_ai import Agent
from pydantic_ai.models.openai import OpenAIModel
from openai import AsyncOpenAI
client = AsyncOpenAI(
api_key = "your-arouter-key" ,
base_url = "https://api.arouter.ai/v1" ,
)
model = OpenAIModel( "openai/gpt-5.4" , openai_client = client)
agent = Agent(model)
result = await agent.run( "Summarize the key ideas in the Feynman Lectures." )
print (result.data)
Anthropic SDK (Native)
ARouter also provides a native Anthropic-compatible endpoint. Use the official Anthropic SDK without any OpenAI wrapper:
import anthropic
client = anthropic.Anthropic(
api_key = "your-arouter-key" ,
base_url = "https://api.arouter.ai/anthropic" ,
)
message = client.messages.create(
model = "claude-sonnet-4-6" ,
max_tokens = 1024 ,
messages = [{ "role" : "user" , "content" : "Hello, Claude!" }],
)
print (message.content[ 0 ].text)
See Anthropic Native API for the full reference.
Google Gemini SDK (Native)
ARouter provides a Gemini-compatible endpoint for the official Google Generative AI SDK:
import google.generativeai as genai
genai.configure(
api_key = "your-arouter-key" ,
client_options = { "api_endpoint" : "https://api.arouter.ai/gemini" }
)
model = genai.GenerativeModel( "gemini-2.5-pro" )
response = model.generate_content( "Explain the theory of relativity simply." )
print (response.text)
See Gemini Native API for the full reference.
Other Frameworks
Any framework with an OpenAI-compatible adapter will work with ARouter. Common examples:
Framework Integration Path AutoGen Set model_client base URL CrewAI Use OpenAICompatibleModel with ARouter base URL LlamaIndex OpenAI LLM class with custom base URLHaystack OpenAIChatGenerator with ARouter API key and base URLSemantic Kernel OpenAIChatCompletion with custom endpoint
For any framework not listed here, check if it supports a base_url / api_base configuration — if it does, ARouter will work.