clade-migration-deep-dive
Installation
SKILL.md
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 |