Migrating from Anthropic & OpenAI
Switch from direct Anthropic or OpenAI API integrations in under 5 minutes. Enjoy up to 70% cost reduction on Claude models with zero prompt changes and unified failovers.
Why Migrate?
Calling Anthropic directly requires managing a separate SDK (@anthropic-ai/sdk), handling different message payload formats, and paying full retail token pricing (\$3.00 / \$15.00 per million tokens for Claude 3.5 Sonnet).
With InfinityRouter, you use the standard OpenAI interface, gain automatic multi-upstream redundancy, and access wholesale rates that are up to 70% cheaper.
1. Model Identifier Mapping
Replace verbose dated model names with our clean canonical identifiers:
| Anthropic / OpenAI ID | InfinityRouter Canonical ID | Pricing Advantage |
|---|---|---|
| claude-3-5-sonnet-20241022 | claude-sonnet-5 | 70% Cheaper |
| claude-3-5-haiku-20241022 | claude-haiku-4 | 70% Cheaper |
| gpt-4o-2024-08-06 | gpt-4o | Wholesale Rates |
| deepseek-reasoner | deepseek-r1 | Lowest Published |
2. Code Comparison: Before vs After
Before: Direct Anthropic SDK (Python)
# Requires anthropic package and unique client methods
import anthropic
client = anthropic.Anthropic(api_key="sk-ant-...")
message = client.messages.create(
model="claude-3-5-sonnet-20241022",
max_tokens=1000,
system="You are a helpful analyst.",
messages=[{"role": "user", "content": "Analyze our quarterly churn rate."}]
)
print(message.content[0].text)After: InfinityRouter (OpenAI SDK with 70% Savings)
# Uses standard openai package and OpenAI-compatible messages format
from openai import OpenAI
client = OpenAI(
base_url="https://infinityrouter.qd.je/v1",
api_key="inf_live_...",
)
response = client.chat.completions.create(
model="claude-sonnet-5",
messages=[
{"role": "system", "content": "You are a helpful analyst."},
{"role": "user", "content": "Analyze our quarterly churn rate."}
],
)
print(response.choices[0].message.content)3. Automatic System Prompt Translation
In OpenAI specifications, system instructions are passed as a message object with role: "system". InfinityRouter automatically translates this into the native format required by downstream providers like Anthropic without requiring changes on your client.