Skip to main content

Migrating from Cloudflare AI Gateway

This guide helps migrate from Cloudflare’s AI Gateway to Phaseo.

Overview

Both are AI API gateways. Migration involves:
  • Updating endpoints
  • Changing authentication
  • Adjusting model routing

Prerequisites

  • Phaseo account
  • Cloudflare AI Gateway setup

Migration Steps

1. Update Base URL

Replace Cloudflare’s gateway URL. For OpenAI-compatible requests:
# Before (Cloudflare AI Gateway)
curl https://gateway.ai.cloudflare.com/v1/your-account/your-gateway/openai/chat/completions \
  -H "Authorization: Bearer your-cloudflare-token" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-4",
    "messages": [{"role": "user", "content": "Hello!"}]
  }'

# After (Phaseo)

curl https://api.phaseo.ai/v1/chat/completions \
 -H "Authorization: Bearer your-phaseo-key" \
 -H "Content-Type: application/json" \
 -d '{
"model": "gpt-4",
"messages": [{"role": "user", "content": "Hello!"}]
}'

import openai

client = openai.OpenAI(
    api_key="your-phaseo-key",
    base_url="https://api.phaseo.ai/v1"
)

response = client.chat.completions.create(
    model="gpt-4",
    messages=[{"role": "user", "content": "Hello!"}]
)
import OpenAI from "openai";

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

const response = await client.chat.completions.create({
	model: "gpt-4",
	messages: [{ role: "user", content: "Hello!" }],
});

2. Authentication

Use Bearer token instead of Cloudflare’s auth.

3. Model Routing

Cloudflare routes based on headers. Phaseo uses model names. Check available models.

4. Test

Verify functionality.

Common Issues

  • Caching: Different caching behaviors.
  • Analytics: Cloudflare’s analytics vs Phaseo’.

Next Steps

  • Explore Phaseo’ advanced features.
Last modified on July 9, 2026