Skip to main content

Migrating from Anthropic SDK

This guide will help you migrate your existing Anthropic SDK integration to use the Phaseo Gateway instead.

Overview

Phaseo Gateway provides Anthropic-compatible endpoints, making migration straightforward. You’ll primarily need to:
  • Change the API base URL
  • Update your API key
  • Update authentication method

Prerequisites

  • A Phaseo account and API key (get one at Gateway Keys)
  • Existing Anthropic SDK code

Migration Steps

1. Update API Key and Base URL

Instead of using the Anthropic API key and default base URL, use your Phaseo credentials.
# Before (Anthropic)
curl https://api.anthropic.com/v1/messages \
  -H "x-api-key: sk-ant-your-anthropic-key" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-3-sonnet-20240229",
    "max_tokens": 100,
    "messages": [{"role": "user", "content": "Hello!"}]
  }'

# After (Phaseo)

curl https://api.phaseo.ai/v1/messages \
 -H "Authorization: Bearer your-phaseo-key" \
 -H "Content-Type: application/json" \
 -d '{
"model": "claude-3-sonnet-20240229",
"max_tokens": 100,
"messages": [{"role": "user", "content": "Hello!"}]
}'

import anthropic

# Before
client = anthropic.Anthropic(api_key="sk-ant-your-anthropic-key")

# After
client = anthropic.Anthropic(
    api_key="your-phaseo-key",
    base_url="https://api.phaseo.ai/v1"
)

response = client.messages.create(
    model="claude-3-sonnet-20240229",
    max_tokens=100,
    messages=[{"role": "user", "content": "Hello!"}]
)
import Anthropic from "@anthropic-ai/sdk";

// Before
const client = new Anthropic({
	apiKey: "sk-ant-your-anthropic-key",
});

// After
const client = new Anthropic({
	apiKey: "your-phaseo-key",
	baseURL: "https://api.phaseo.ai/v1",
});

const response = await client.messages.create({
	model: "claude-3-sonnet-20240229",
	max_tokens: 100,
	messages: [{ role: "user", content: "Hello!" }],
});

3. Test Your Integration

Run your existing code with the updated configuration to ensure it works.

4. Handle Model Names

Phaseo supports Anthropic models. Check the models endpoint for available models. Model names should be compatible with Anthropic’s naming.

Common Issues

  • Model not found: Ensure the model is available in Phaseo.
  • Rate limits: Phaseo may have different rate limits.
  • Features: Some Anthropic-specific features may work differently.

Next Steps

  • Explore Phaseo’ additional features.
  • Check out the API Reference for full documentation.
Last modified on July 9, 2026