DEV Community

TildAlice
TildAlice

Posted on • Originally published at tildalice.io

OpenAI to Claude API Migration: 7 Breaking Changes

The response_format Trap

Most OpenAI-to-Claude migrations break at the same spot: response_format={"type": "json_object"}. That parameter doesn't exist in Claude's API.

I tested this with a production RAG system that was making 2000+ API calls per day to GPT-4. The code looked clean — standard OpenAI client initialization, function calling for tool use, structured JSON output via response_format. Swapping the API key and base URL should've been a 5-minute fix.

It took four hours. Here's what actually changed.

Close-up of wooden Scrabble tiles spelling OpenAI and DeepSeek on wooden table.

Photo by Markus Winkler on Pexels

Authentication Headers Are Different

OpenAI uses Authorization: Bearer sk-... for auth. Claude uses x-api-key and anthropic-version headers.

# OpenAI style (doesn't work with Claude)
import openai
client = openai.OpenAI(api_key="sk-...")

# Claude API requires explicit headers
import anthropic
client = anthropic.Anthropic(api_key="sk-ant-...")
Enter fullscreen mode Exit fullscreen mode

Continue reading the full article on TildAlice

Top comments (0)