Migrate from Anthropic Console to Railwail
Migration Guides

Migrate from Anthropic Console to Railwail

Move from the Anthropic SDK to Railwail in 5 minutes. Keep using @anthropic-ai/sdk unchanged, or use the OpenAI SDK against Claude models. Same Claude, EUR billing, 275+ extra models.

Railwail Teamยท Developer Relations9 min readMay 16, 2026

TL;DR โ€” Switch in Under 5 Minutes

  • Railwail supports BOTH the Anthropic Messages API (/v1/messages) AND the OpenAI Chat Completions API (/v1/chat/completions) for Claude models
  • Keep @anthropic-ai/sdk: change base_url to https://api.railwail.com/anthropic and that is it
  • Or use the OpenAI SDK with model='claude-sonnet-4-6' โ€” one less dependency
  • All Claude 4 features supported: long context, tool use, computer use, prompt caching, vision
  • EU-hosted endpoint, EUR billing, plus access to 274 other models behind the same key

Why Move Off Anthropic Console Direct?

Anthropic's Claude is the gold standard for long-context reasoning, agentic workflows, and instruction following. But the Anthropic Console is USD-only, US-hosted, and requires a separate SDK from your OpenAI integration. If your stack already speaks OpenAI Chat Completions and you want EUR billing, Railwail lets you keep using Claude with zero code refactor โ€” or with even less code than before.

Teams typically migrate when they (a) need EUR invoices for VAT compliance, (b) want to unify Claude and GPT-4o calls under a single SDK, (c) require EU data residency, or (d) hit Anthropic's tier-based rate limits and want a higher default ceiling.

Step 1 โ€” Get a Railwail API Key

Sign up at railwail.com, navigate to Dashboard โ†’ API Keys, click Create New Key. Free credits are included so you can validate the migration without committing to a paid plan.

Sponsored

Access 100+ AI Models with One API Key

GPT-4o, Claude, Gemini, Llama, Flux, DALL-E and more โ€” all through a single, OpenAI-compatible endpoint. No more juggling multiple providers.

Step 2 โ€” Choose Your SDK Path

Railwail supports two equally-valid migration paths. Pick whichever requires less code change.

Path A โ€” Keep the Anthropic SDK

If your code uses @anthropic-ai/sdk and relies on Anthropic-specific request shapes (Messages API with system as a top-level field, multi-block content arrays, tool_use blocks), this is the lowest-friction path. Change one line.

Before (Anthropic direct, TypeScript):

import Anthropic from "@anthropic-ai/sdk";

const anthropic = new Anthropic({
  apiKey: process.env.ANTHROPIC_API_KEY,
});

const msg = await anthropic.messages.create({
  model: "claude-sonnet-4-5",
  max_tokens: 1024,
  messages: [{ role: "user", content: "Hello Claude" }],
});
After (Railwail, TypeScript):
import Anthropic from "@anthropic-ai/sdk";

const anthropic = new Anthropic({
  apiKey: process.env.RAILWAIL_API_KEY,
  baseURL: "https://api.railwail.com/anthropic",
});

const msg = await anthropic.messages.create({
  model: "claude-sonnet-4-6",
  max_tokens: 1024,
  messages: [{ role: "user", content: "Hello Claude" }],
});
The Railwail /anthropic prefix routes requests through our Anthropic-compatible adapter. Streaming, tool use, prompt caching, and vision all behave identically.

Path A โ€” Python equivalent

from anthropic import Anthropic

client = Anthropic(
    api_key=os.environ["RAILWAIL_API_KEY"],
    base_url="https://api.railwail.com/anthropic",
)

msg = client.messages.create(
    model="claude-sonnet-4-6",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Hello Claude"}],
)
print(msg.content[0].text)

Path B โ€” Use the OpenAI SDK

If you want one SDK across all models, replace @anthropic-ai/sdk with the OpenAI client. Railwail accepts Claude model IDs in standard chat.completions calls and handles the schema translation internally.

import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.RAILWAIL_API_KEY,
  baseURL: "https://api.railwail.com/v1",
});

const res = await client.chat.completions.create({
  model: "claude-sonnet-4-6",
  messages: [
    { role: "system", content: "You are concise." },
    { role: "user", content: "Hello Claude via OpenAI SDK" },
  ],
});
console.log(res.choices[0].message.content);
This path eliminates the Anthropic SDK dependency entirely. Most production teams prefer it because it works for GPT-4o, Claude, Gemini, and Llama with the same client object.

Path B โ€” cURL

curl https://api.railwail.com/v1/chat/completions \
  -H "Authorization: Bearer $RAILWAIL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-sonnet-4-6",
    "messages": [{"role": "user", "content": "Hello Claude"}],
    "max_tokens": 1024
  }'

Step 3 โ€” Verify Tool Use and Streaming

Tool use translates correctly across both paths. On Path A (Anthropic SDK), your tool definitions and tool_use response blocks work unchanged. On Path B (OpenAI SDK), Railwail converts between OpenAI's tools/tool_calls schema and Anthropic's tool_use blocks transparently. Streaming SSE events are passed through in the native format of whichever SDK you chose.

Step 4 โ€” Prompt Caching

Anthropic's prompt caching feature (cache_control: ephemeral) is fully supported on Railwail Path A. Cache hits get the same 90% discount you would see on Anthropic Console direct. On Path B, prompt caching is automatically enabled when you set the cache_marker field on system or user messages โ€” see railwail.com/docs/caching.

Sponsored

Test Any AI Model Instantly

Our built-in playground lets you compare models side by side. Find the perfect model for your use case in minutes, not days.

API Endpoint Mapping

Anthropic Console endpoint โ†’ Railwail equivalent

Anthropic directRailwail equivalentNotes
POST /v1/messagesPOST /anthropic/v1/messagesIdentical Messages API schema
POST /v1/messages (streaming)POST /anthropic/v1/messages (stream=true)Native SSE event format
POST /v1/messages/batchesPOST /anthropic/v1/messages/batches50% discount on batched workloads
POST /v1/messages (with tool_use)POST /anthropic/v1/messagesTool use unchanged
N/A โ€” direct onlyPOST /v1/chat/completions (model=claude-*)OpenAI-compatible alternative path
GET /v1/modelsGET /v1/modelsReturns all 275+ Railwail models

Claude Model Mapping

Anthropic Console model โ†’ Railwail model ID

Anthropic ConsoleRailwailNotes
claude-opus-4-5claude-opus-4-6Latest Opus, 200k context, computer use
claude-sonnet-4-5claude-sonnet-4-61M-context Sonnet, primary workhorse
claude-haiku-4-5claude-haiku-4-6Fast, cheap, 200k context
claude-3-5-sonnet-20241022claude-3-5-sonnetLegacy ID still routable
claude-3-5-haiku-20241022claude-3-5-haikuLegacy ID still routable
claude-3-opus-20240229claude-3-opusLegacy Opus 3

Pricing Comparison (per 1M tokens, May 2026)

Same Claude model, Railwail in EUR

ModelAnthropic direct (USD)Railwail (EUR)Notes
claude-opus-4-6 input$15.00EUR 13.80Identical model, no markup
claude-opus-4-6 output$75.00EUR 69.00Identical
claude-sonnet-4-6 input$3.00EUR 2.76Identical
claude-sonnet-4-6 output$15.00EUR 13.80Identical
claude-haiku-4-6 input$0.80EUR 0.74Identical
claude-haiku-4-6 output$4.00EUR 3.68Identical
Cache write (Sonnet)$3.75EUR 3.4525% markup on cache writes, same on Railwail
Cache hit (Sonnet)$0.30EUR 0.2890% discount preserved

Sponsored

Pay Only for What You Use

Transparent per-token pricing with no monthly minimums. Start with free credits and scale as you grow.

Why Railwail Over Anthropic Console

  • EU billing in EUR with VAT receipts โ€” clean accounting for European entities
  • Higher default rate limits than Anthropic's tier-based system
  • Two API surfaces โ€” keep Anthropic SDK, or unify on OpenAI SDK
  • Access to GPT-4o, Gemini, Mistral, Llama through the same key
  • Built-in playground to A/B Claude vs other models on real prompts
  • Prompt caching, tool use, computer use, vision โ€” all preserved
  • Spend caps and per-key isolation for multi-tenant apps

FAQ

Does prompt caching still get the 90% discount?

Yes. Anthropic's cache_control: ephemeral mechanism is forwarded directly. Cache writes cost 25% more than base input, cache hits cost 90% less. Pricing parity is preserved end-to-end.

What about computer use and the screenshot tool?

Computer use is fully supported on Path A (Anthropic SDK). The tool_use blocks for computer-screenshot and computer-action work unchanged. See the dedicated computer-use cookbook at railwail.com/docs/anthropic/computer-use.

Can I use the Messages API with vision (images)?

Yes. Image content blocks with base64 or URL sources work identically. There is no size limit beyond Anthropic's native 5MB-per-image cap.

What about Anthropic's Workbench and the saved prompts?

Workbench is a separate UI feature of Anthropic Console. Railwail's playground at railwail.com/models offers equivalent functionality โ€” saved prompts, side-by-side model comparison, and one-click export to TypeScript/Python/cURL.

Do tool_choice and disable_parallel_tool_use parameters work?

Yes. The full Anthropic Messages parameter set โ€” tool_choice (auto, any, tool), disable_parallel_tool_use, system blocks with cache_control, metadata.user_id, stop_sequences โ€” is forwarded verbatim.

What happens if Anthropic upstream has an outage?

Railwail does not auto-fallback to a different model by default (that could silently change output quality). You can opt in to fallback rules in the dashboard, e.g. 'route Claude Sonnet โ†’ GPT-4o on 5xx'. Most teams prefer explicit error handling.

Next Steps

  • Create your Railwail account at railwail.com
  • Generate an API key in Dashboard โ†’ API Keys
  • Pick Path A (Anthropic SDK) or Path B (OpenAI SDK) โ€” both work
  • Update one line: base_url
  • Read the full Anthropic-compatible reference at railwail.com/docs/anthropic
  • Browse the Claude models at railwail.com/models?provider=anthropic
  • Compare per-token pricing at railwail.com/pricing

Railwail Team

Developer Relations

The Railwail team writes integration guides for developers migrating from single-provider AI APIs to a unified multi-model platform.

Tags:
Anthropic
Claude
Migration
API
SDK
Messages API