> ## 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.

# Frameworks & Integrations

> Use ARouter with popular AI frameworks and SDKs — zero code changes required beyond base_url and api_key.

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:

<CardGroup cols={2}>
  <Card title="Python SDK" icon="python" href="/en/sdks/python">
    pip install arouter
  </Card>

  <Card title="Node.js / TypeScript SDK" icon="js" href="/en/sdks/node">
    npm install arouter
  </Card>

  <Card title="Go SDK" icon="golang" href="/en/sdks/go">
    go get github.com/arouter-ai/arouter-go
  </Card>

  <Card title="cURL" icon="terminal" href="/en/sdks/curl">
    Direct HTTP examples
  </Card>
</CardGroup>

## 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`:

<Tabs>
  <Tab title="Python">
    ```python theme={null}
    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!"}]
    )
    ```
  </Tab>

  <Tab title="Node.js">
    ```typescript theme={null}
    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!" }],
    });
    ```
  </Tab>
</Tabs>

## LangChain

ARouter works with LangChain's `ChatOpenAI` class:

<Tabs>
  <Tab title="Python">
    ```python theme={null}
    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)
    ```
  </Tab>

  <Tab title="Node.js">
    ```typescript theme={null}
    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);
    ```
  </Tab>
</Tabs>

## Vercel AI SDK

Use ARouter as the backend for Vercel AI SDK applications:

```typescript theme={null}
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

```python theme={null}
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:

```python theme={null}
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](/en/api-reference/anthropic/create-message) for the full reference.

## Google Gemini SDK (Native)

ARouter provides a Gemini-compatible endpoint for the official Google Generative AI SDK:

```python theme={null}
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](/en/api-reference/gemini/generate-content) 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 URL                 |
| **Haystack**        | `OpenAIChatGenerator` with ARouter API key and base URL |
| **Semantic 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.
