| name | clade-migration-deep-dive |
| description | Migrate from OpenAI/GPT to Anthropic/Claude — API differences,
Use when working with migration-deep-dive patterns.
prompt adaptation, SDK swap, and feature mapping.
Trigger with "migrate to claude", "openai to anthropic",
"switch from gpt to claude", "replace openai with anthropic".
|
| allowed-tools | Read, Write, Edit, Grep |
| version | 1.0.0 |
| license | MIT |
| author | Jeremy Longshore <jeremy@intentsolutions.io> |
| tags | ["saas","anthropic","claude","migration","openai"] |
| compatibility | Designed for Claude Code |
Migrate from OpenAI to Anthropic
Overview
Migrate from OpenAI/GPT to Anthropic/Claude. Covers the complete API mapping (endpoints, models, response shapes), SDK swap with before/after code, five key differences (max_tokens required, system as top-level param, alternating messages, response path, streaming events), and tool use migration.
API Mapping
| OpenAI | Anthropic | Notes |
|---|
openai.chat.completions.create() | anthropic.messages.create() | Different request/response shape |
model: 'gpt-4o' | model: 'claude-sonnet-4-20250514' | Different model IDs |
response.choices[0].message.content | response.content[0].text | Different response path |
system in messages array | system as separate parameter | Claude uses top-level system |
response_format: { type: 'json_object' } | System prompt: "Respond in JSON only" | No native JSON mode |
tools / function_calling | tools (similar but different schema) | Input schema differences |
openai.embeddings.create() | N/A — use Voyage or Cohere | No embeddings API |
SDK Swap
Instructions
Step 1: Before (OpenAI)
import OpenAI from 'openai';
const openai = new OpenAI();
const response = await openai.chat.completions.create({
model: 'gpt-4o',
messages: [
{ : , : },
{ : , : },
],
});
.(response.[]..);