Skip to main content

Prerequisites

Before you can configure the Anthropic SDK to use the Connect AI LLM Gateway, you must register a provider, create a routing rule, create a project, and issue a virtual key. See LLM Gateway for details.
A Connect AI Personal Access Token (PAT) is not accepted by the LLM Gateway. Only a virtual key authenticates requests.

Install the SDK

Send a Request

Set base_url (Python) or baseURL (JavaScript) to the Connect AI LLM Gateway endpoint and pass your virtual key as api_key or apiKey. The gateway selects the provider and model based on your project’s routing rule.

Configure with Environment Variables

As an alternative to passing connection details in code, you can set environment variables. The Anthropic SDK reads these automatically.
With environment variables set, you can instantiate the client without explicit arguments:
Last modified on October 2, 2026