코드베이스에서 이미 OpenAI SDK를 사용 중이라면 다른 모델에 접근하기 위해 새로운 클라이언트가 필요하지 않습니다. SDK의 base_url을 RouteAll로 지정하기만 하면 기존 코드로 DeepSeek, Qwen, Claude, Gemini 등 여러 모델을 호출할 수 있습니다. 메서드와 응답 구조도 그대로입니다.
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);
스트리밍도 지원합니다
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="")
모델 전환하기
model 문자열로 제공자를 선택합니다. 사용 가능한 정확한 모델 이름(및 가격)은 /v1/models 또는 모델 마켓플레이스에서 확인하세요. 과금은 토큰 단위로 측정되며 모든 응답에 표시됩니다. 프롬프트 캐시 히트는 할인되므로 더 저렴한 모델로 전환하는 것은 단어 하나만 바꾸면 됩니다.
이미 Anthropic 또는 Gemini 네이티브 형식을 사용 중이신가요?
RouteAll은 Anthropic /v1/messages 및 Gemini /v1beta 네이티브 형식도 지원하므로 원하신다면 해당 SDK를 그대로 사용할 수 있습니다. API 문서를 참고하세요.
키 생성하기 후 한 줄만 바꾸면 마이그레이션이 완료됩니다.