title: Migration Guide description: Switch from OpenAI SDK, GitHub Copilot, or any OpenAI-compatible API to AIOrouter — one line change.

Migration Guide

Switching to AIOrouter from any OpenAI-compatible API is a one-line change. No new SDKs, no refactoring, no breaking changes.

From OpenAI

# Before (OpenAI)
from openai import OpenAI
client = OpenAI(api_key="sk-...")

# After (AIOrouter)
from openai import OpenAI
client = OpenAI(
    base_url="https://api.aiorouter.ca/v1",
    api_key="ak-..."
)
// Before (OpenAI)
import OpenAI from 'openai';
const client = new OpenAI({ apiKey: 'sk-...' });

// After (AIOrouter)
import OpenAI from 'openai';
const client = new OpenAI({
  baseURL: 'https://api.aiorouter.ca/v1',
  apiKey: 'ak-...'
});

From GitHub Copilot (via API)

If you're using Copilot's API features, switching to AIOrouter gives you:

# Instead of Copilot's limited API
# Use the full OpenAI-compatible API:
client = OpenAI(
    base_url="https://api.aiorouter.ca/v1",
    api_key="ak-..."
)

From OpenRouter

# Before (OpenRouter)
client = OpenAI(
    base_url="https://openrouter.ai/api/v1",
    api_key="sk-or-..."
)

# After (AIOrouter)
client = OpenAI(
    base_url="https://api.aiorouter.ca/v1",
    api_key="ak-..."
)

Key differences:

From Any OpenAI-Compatible API

If your current provider uses the OpenAI API format:

  1. Change the base_url to https://api.aiorouter.ca/v1
  2. Change the api_key to your AIOrouter key
  3. Update the model name to one of our models

That's it. All existing code, prompts, and parameters continue to work.

Environment Variables

Recommended approach for CI/CD and production:

# .env
OPENAI_BASE_URL=https://api.aiorouter.ca/v1
OPENAI_API_KEY=ak-your_key_here
import os
from openai import OpenAI

client = OpenAI(
    base_url=os.getenv("OPENAI_BASE_URL", "https://api.aiorouter.ca/v1"),
    api_key=os.getenv("OPENAI_API_KEY")
)

Framework Compatibility

LangChain

from langchain_openai import ChatOpenAI

llm = ChatOpenAI(
    model="deepseek-v4-pro",
    openai_api_key="ak-...",
    openai_api_base="https://api.aiorouter.ca/v1"
)

LlamaIndex

from llama_index.llms.openai import OpenAI

llm = OpenAI(
    model="deepseek-v4-pro",
    api_key="ak-...",
    api_base="https://api.aiorouter.ca/v1"
)

BYOK Tools (Bring Your Own Key)

Your AIOrouter API key is OpenAI-compatible (and Anthropic /v1/messages-compatible for Claude-family clients), so it works with most BYOK tools — not just one:

Because the key is tool-agnostic, your paid access keeps working even if a third-party tool changes its BYOK policy — connect the same key to any other tool above.

Need Help?