← Blog

Use the OpenAI SDK with DeepSeek, Qwen, and Claude — Just Change the Base URL

June 29, 2026

If your codebase already uses the OpenAI SDK, you do not need a new client to reach other models. Point the SDK's base_url at RouteAll and your existing code calls DeepSeek, Qwen, Claude, Gemini and more — same methods, same response shapes.

Python

from openai import OpenAI

client = OpenAI(
    api_key="sk-ra-...",                     # your RouteAll key
    base_url="https://api.routeall.ai/v1",   # the only change
)

# switch providers by model name — same call
resp = client.chat.completions.create(
    model="deepseek-v4-flash",
    messages=[{"role": "user", "content": "Write a haiku about routing."}],
)
print(resp.choices[0].message.content)

Node / TypeScript

import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.ROUTEALL_KEY,
  baseURL: "https://api.routeall.ai/v1",
});

const resp = await client.chat.completions.create({
  model: "claude-haiku-4-5",
  messages: [{ role: "user", content: "One line on prompt caching." }],
});
console.log(resp.choices[0].message.content);

Streaming works too

stream = client.chat.completions.create(
    model="claude-sonnet-4-6",
    messages=[{"role": "user", "content": "Stream a short poem."}],
    stream=True,
)
for chunk in stream:
    print(chunk.choices[0].delta.content or "", end="")

Switching models

The model string selects the provider. Get the exact names available to your account (and your price) from /v1/models or the model marketplace. Billing is metered per token, shown on every response, and prompt-cache hits are discounted — so trying a cheaper model is a one-word change.

Already on Anthropic or Gemini native formats?

RouteAll also speaks the Anthropic /v1/messages and Gemini /v1beta native formats, so you can keep those SDKs if you prefer. See the API docs.

Create a key and change one line — that's the migration.

Use the OpenAI SDK with DeepSeek, Qwen & Claude (change base_url) — RouteAll