Skip to main content
If you are already using the Anthropic API directly, migrating to Inworld Router is a two-line change. Inworld Router supports the Anthropic Messages API natively, so your existing code, message format, and streaming logic all work as-is.

Key Differences

Migration Steps

1. Update Base URL and API Key

Python:
TypeScript:
cURL:

2. Update Model Names

Add the anthropic/ prefix to model names:
  • claude-opus-4-6anthropic/claude-opus-4-6
  • claude-opus-4-20250514anthropic/claude-opus-4-20250514
  • claude-3-5-haiku-20241022anthropic/claude-3-5-haiku-20241022

3. Enable Intelligent Routing (Optional)

Instead of hardcoding a model, use Inworld Router’s intelligent routing:

What Stays the Same

  • Message format: messages array with role and content — identical.
  • Streaming: stream=True works the same way with Anthropic SSE events (message_start, content_block_delta, etc.).
  • System messages: Top-level system parameter works identically.
  • Tool use: Tool definitions, tool_use content blocks, and tool_result messages work identically.
  • max_tokens: Required parameter, same behavior.
  • temperature, top_p: Same behavior.
  • Multi-turn conversations: Same format, context is preserved correctly.

What You Gain

  1. Multi-Provider Failover: If Anthropic is down or rate-limited, Inworld Router automatically retries on OpenAI, Google, or other providers — and still returns the response in the Anthropic format.
  2. Cost Optimization: Route simple queries to cheaper models, reserve Claude for complex tasks.
  3. Cross-Provider Access: Use openai/gpt-5 or google-ai-studio/gemini-2.5-flash through the same Anthropic SDK — Inworld Router translates the request and returns an Anthropic-format response.
  4. Unified Observability: See all your LLM requests — across Anthropic, OpenAI, Google — in one dashboard.
  5. Custom Routing: Build routers with conditional logic, A/B testing, and weighted variants.

Environment Variables

If you use environment variables, update them:

Support

Need help with a complex migration? Contact our engineering team.