clade-migration-deep-dive
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".
Best use case
clade-migration-deep-dive is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
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".
Teams using clade-migration-deep-dive should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/clade-migration-deep-dive/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How clade-migration-deep-dive Compares
| Feature / Agent | clade-migration-deep-dive | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
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".
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
Related Guides
Best AI Skills for Claude
Explore the best AI skills for Claude and Claude Code across coding, research, workflow automation, documentation, and agent operations.
ChatGPT vs Claude for Agent Skills
Compare ChatGPT and Claude for AI agent skills across coding, writing, research, and reusable workflow execution.
SKILL.md Source
# 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)
```typescript
import OpenAI from 'openai';
const openai = new OpenAI();
const response = await openai.chat.completions.create({
model: 'gpt-4o',
messages: [
{ role: 'system', content: 'You are helpful.' },
{ role: 'user', content: 'Hello' },
],
});
console.log(response.choices[0].message.content);
```
### Step 2: After (Anthropic)
```typescript
import Anthropic from '@claude-ai/sdk';
const anthropic = new Anthropic();
const response = await anthropic.messages.create({
model: 'claude-sonnet-4-20250514',
max_tokens: 1024, // Required (not optional like OpenAI)
system: 'You are helpful.', // Separate from messages
messages: [
{ role: 'user', content: 'Hello' },
],
});
console.log(response.content[0].text);
```
## Key Differences
1. **`max_tokens` is required** — OpenAI defaults it, Anthropic requires it
2. **`system` is a top-level param** — not a message in the array
3. **First message must be `user`** — can't start with assistant
4. **Messages must alternate** — no two user or two assistant messages in a row
5. **Response shape** — `content[0].text` not `choices[0].message.content`
6. **Streaming events** — different event types and structure
## Tool Use Migration
```typescript
// OpenAI tool definition
{ type: 'function', function: { name: 'get_weather', parameters: { ... } } }
// Anthropic tool definition
{ name: 'get_weather', input_schema: { ... } } // Flatter structure
```
## Grep & Replace
```bash
# Find all OpenAI imports
grep -rn "from 'openai'" --include="*.ts" .
grep -rn "import OpenAI" --include="*.ts" .
# Find response access patterns to update
grep -rn "choices\[0\]" --include="*.ts" .
grep -rn "message.content" --include="*.ts" . # May need updating
```
## Output
- All `openai` imports replaced with `@claude-ai/sdk`
- Response access patterns updated (`choices[0].message.content` → `content[0].text`)
- System prompts moved from messages array to top-level `system` parameter
- `max_tokens` added to all API calls (required, not optional)
- Tool definitions restructured to Anthropic format
## Error Handling
| Error | Cause | Solution |
|-------|-------|----------|
| API Error | Check error type and status code | See `clade-common-errors` |
## Examples
See API Mapping table, Before/After SDK code, Key Differences list, Tool Use Migration, and Grep & Replace commands above.
## Resources
- [Anthropic Messages API](https://docs.anthropic.com/en/api/messages)
- [Migration Guide](https://docs.anthropic.com/en/docs/about-claude/models)
## Next Steps
See `clade-sdk-patterns` for production Anthropic SDK patterns.
## Prerequisites
- Existing OpenAI integration to migrate
- Access to codebase with search capability
- Test suite for comparing outputs between providersRelated Skills
workhuman-upgrade-migration
Workhuman upgrade migration for employee recognition and rewards API. Use when integrating Workhuman Social Recognition, or building recognition workflows with HRIS systems. Trigger: "workhuman upgrade migration".
wispr-upgrade-migration
Wispr Flow upgrade migration for voice-to-text API integration. Use when integrating Wispr Flow dictation, WebSocket streaming, or building voice-powered applications. Trigger: "wispr upgrade migration".
windsurf-upgrade-migration
Upgrade Windsurf IDE, migrate settings from VS Code or Cursor, and handle breaking changes. Use when upgrading Windsurf versions, migrating from another editor, or handling configuration changes after updates. Trigger with phrases like "upgrade windsurf", "windsurf update", "migrate to windsurf", "windsurf from cursor", "windsurf from vscode".
windsurf-migration-deep-dive
Migrate to Windsurf from VS Code, Cursor, or other AI IDEs with full configuration transfer. Use when migrating a team to Windsurf, transferring Cursor rules, or evaluating Windsurf against other AI editors. Trigger with phrases like "migrate to windsurf", "switch to windsurf", "windsurf from cursor", "windsurf from copilot", "windsurf evaluation".
webflow-upgrade-migration
Analyze, plan, and execute Webflow SDK upgrades (webflow-api v1 to v3) with breaking change detection, API v1-to-v2 migration, and deprecation handling. Trigger with phrases like "upgrade webflow", "webflow migration", "webflow breaking changes", "update webflow SDK", "webflow v1 to v2".
webflow-migration-deep-dive
Execute major Webflow migrations — from other CMS platforms to Webflow CMS, between Webflow sites, or large-scale content re-architecture using the Data API v2 bulk endpoints, strangler fig pattern, and data validation. Trigger with phrases like "migrate to webflow", "webflow migration", "import into webflow", "webflow replatform", "move content to webflow", "webflow bulk import", "wordpress to webflow".
vercel-upgrade-migration
Upgrade Vercel CLI, Node.js runtime, and Next.js framework versions with breaking change detection. Use when upgrading Vercel CLI versions, migrating Node.js runtimes, or updating Next.js between major versions on Vercel. Trigger with phrases like "upgrade vercel", "vercel migration", "vercel breaking changes", "update vercel CLI", "next.js upgrade on vercel".
vercel-migration-deep-dive
Migrate to Vercel from other platforms or re-architecture existing Vercel deployments. Use when migrating from Netlify, AWS, or Cloudflare to Vercel, or when re-platforming an existing Vercel application. Trigger with phrases like "migrate to vercel", "vercel migration", "switch to vercel", "netlify to vercel", "aws to vercel", "vercel replatform".
veeva-upgrade-migration
Veeva Vault upgrade migration for REST API and clinical operations. Use when working with Veeva Vault document management and CRM. Trigger: "veeva upgrade migration".
veeva-migration-deep-dive
Veeva Vault migration deep dive for enterprise operations. Use when implementing advanced Veeva Vault patterns. Trigger: "veeva migration deep dive".
vastai-upgrade-migration
Upgrade Vast.ai CLI, migrate API versions, and handle breaking changes. Use when upgrading vastai CLI, detecting deprecations, or migrating between API versions. Trigger with phrases like "upgrade vastai", "vastai migration", "vastai breaking changes", "update vastai CLI".
vastai-migration-deep-dive
Migrate GPU workloads to or from Vast.ai, or between GPU providers. Use when switching from AWS/GCP/Azure GPU instances to Vast.ai, migrating between GPU types, or re-platforming ML infrastructure. Trigger with phrases like "migrate to vastai", "vastai migration", "switch to vastai", "vastai from aws", "vastai from lambda".