OpenAI, Anthropic and Gemini SDKs

A base URL and your key. The rest of your code stays.

Checked 2026-10-11

·All guides·Models

Environment variables

Both SDKs read these, so no code changes.

shell
# OpenAI SDK (Python and TypeScript read these)
export OPENAI_BASE_URL="https://api.uplinkswitch.com/v1"
export OPENAI_API_KEY="sk-uplink-live-..."

# Anthropic SDK (Python and TypeScript read these)
export ANTHROPIC_BASE_URL="https://api.uplinkswitch.com/v1"
export ANTHROPIC_API_KEY="sk-uplink-live-..."

Gemini SDK

The base URL goes in http_options.

gemini.py
from google import genai

client = genai.Client(
    api_key="sk-uplink-live-...",
    http_options={"base_url": "https://api.uplinkswitch.com/v1"},
)

Streaming

Streams pass through unchanged.

stream.py
from openai import OpenAI

client = OpenAI()  # reads OPENAI_BASE_URL and OPENAI_API_KEY
with client.chat.completions.stream(
    model="gpt-6.1-sol",
    messages=[{"role": "user", "content": "Count to five."}],
) as s:
    for event in s:
        if event.type == "content.delta":
            print(event.delta, end="")

Which format for which model

Claude: Anthropic or OpenAI format. Gemini: Gemini format. Most others: OpenAI format. Each model on the Models page lists its own.