| name | anth-migration-deep-dive |
| description | Migrate to Claude API from OpenAI, Gemini, or other LLM providers.
Use when switching from GPT-4 to Claude, migrating from Text Completions,
or building a multi-provider abstraction layer.
Trigger with phrases like "migrate to claude", "openai to anthropic",
"switch from gpt to claude", "multi-provider llm".
|
| allowed-tools | Read, Write, Edit, Bash(npm:*), Grep |
| version | 1.6.0 |
| license | MIT |
| author | Jeremy Longshore <jeremy@intentsolutions.io> |
| tags | ["saas","ai","anthropic"] |
| compatibility | Designed for Claude Code |
Anthropic Migration Deep Dive
Overview
Migration strategies for switching to Claude from OpenAI, Google, or other LLM providers, including API mapping, prompt translation, and multi-provider abstraction.
OpenAI to Anthropic API Mapping
| OpenAI | Anthropic | Notes |
|---|
openai.ChatCompletion.create() | anthropic.messages.create() | Different response shape |
model: "gpt-4" | model: "claude-sonnet-4-20250514" | Different model IDs |
messages: [{role, content}] | messages: [{role, content}] | Same format |
functions / tools | tools | Similar but different schema key names |
function_call | tool_choice | Different naming |
response.choices[0].message.content | response.content[0].text | Different access path |
stream: true → yields chunks | stream: true → SSE events | Different event format |
System message in messages[] | system parameter (separate) | Claude separates system prompt |
n (multiple completions) | Not supported | Use multiple requests |
logprobs | Not supported | N/A |
Side-by-Side Code Comparison
from openai import OpenAI
client = OpenAI()
response = client.chat.completions.create(
model="gpt-4",
messages=[
{"role": "system", "content": "You are helpful."},
{: , : }
],
max_tokens=,
temperature=
)
text = response.choices[].message.content
anthropic
client = anthropic.Anthropic()
response = client.messages.create(
model=,
system=,
messages=[
{: , : }
],
max_tokens=,
temperature=
)
text = response.content[].text