Contents

Chapter 1

Overview — OpenAI to Anthropic Migration Kit

A concept map + a thin adapter for moving code between the OpenAI and

Anthropic APIs (or supporting both behind one interface). This is a task

agents get constantly ("switch us from GPT to Claude", "add a fallback provider")

and the two SDKs differ in enough places — message shape, system prompts, token

params, tool calling, streaming, stop reasons — to break a naive swap.

What actually differs (the map)

ConceptOpenAIAnthropic
System prompta role:"system" messagetop-level system param
Messagesmessages[] incl. systemmessages[] (user/assistant only)
Max tokensmax_tokens (optional)max_tokens (required)
Multi-turnroles in one arraystrict user/assistant alternation
Tool callingtools + tool_callstools + tool_use/tool_result blocks
Response textchoices[0].message.contentcontent[0].text (content blocks)
Stop reasonfinish_reasonstop_reason
StreamingSSE deltasSSE content_block_delta events

Full detail with examples in CONCEPT-MAP.md.

What's inside

  • CONCEPT-MAP.md — every difference, with request/response examples side by side.
  • src/types.ts — a neutral ChatRequest/ChatResponse interface.
  • src/openai_adapter.ts — map neutral ⇄ OpenAI shape.
  • src/anthropic_adapter.ts — map neutral ⇄ Anthropic shape (system extraction,

required max_tokens, content-block flattening, stop-reason normalization).

  • src/provider.ts — one chat(req) that routes to either provider + fallback.
  • test/adapters.test.ts — proves the mappings both ways (Vitest).

Use it two ways

1. One-time migration: translate your call sites to the neutral interface, then

flip the provider.

2. Multi-provider: keep the neutral interface permanently and switch providers

by config, with automatic fallback when one is down or rate-limited.

Requirements

Node 18+, TypeScript 5+. (Adapters are transport-shaping only; wire your own HTTP

or the official SDKs behind them.)

Chapter 2
🔒 Available in full product

Migration Walkthrough — OpenAI ↔ Anthropic

You’ve reached the end of the free preview

Get the full OpenAI to Anthropic Migration Kit and unlock everything.

All Chapters

Get the complete guide with every chapter unlocked, including code samples, diagrams, and best practices.

Full Tool Suite

Access all interactive tools with complete data, all workload profiles, and the full scenario library.

Source Files

Downloadable source code, configuration files, and working examples from every chapter.

Lifetime Updates

Free updates for life. Every new chapter, tool, and improvement included.

Buy Now — $29 →
📦 Free sample included — download another copy or visit the store for the full product.
OpenAI to Anthropic Migration Kit v1.0.0 — Free Preview