Skip to main content

OpenAI SDK

The OpenAI Python SDK works out of the box with ARouter.

Installation

Basic Usage

Multi-Provider Routing

Switch providers by changing the model string:

Streaming

Async

Embeddings


Anthropic SDK

The Anthropic Python SDK works natively.

Installation

Basic Usage

For the Anthropic SDK, set base_url to https://api.arouter.ai (without /v1). The SDK adds /v1/messages automatically.

Streaming


Gemini SDK

The Google Generative AI Python SDK works by configuring the API endpoint.

Installation

Basic Usage

The transport="rest" parameter is required. The Gemini SDK defaults to gRPC, which is not supported by ARouter.