Skip to main content
Routeway is designed to be a drop-in replacement for the OpenAI API. Since the API layout, request bodies, and response structures are fully compatible, migrating your existing application requires minimal changes.

1. Update the Base URL & Authentication

To point your requests to Routeway, you only need to change two configurations: the endpoint URL and your API key.
ProviderAPI EndpointAuthentication Header
OpenAIhttps://api.openai.com/v1Authorization: Bearer OPENAI_API_KEY
Routewayhttps://api.routeway.ai/v1Authorization: Bearer ROUTEWAY_API_KEY
In the authentication header, ROUTEWAY_API_KEY represents your actual Routeway API key (e.g., sk-...).

2. SDK Integration Examples

If you are using official OpenAI client libraries, you don’t need to install any new dependencies. Simply update the configuration during client initialization.
Change your import/initialization to override the base_url and use your ROUTEWAY_API_KEY:
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.getenv("OPENAI_API_KEY")
)

# Calls OpenAI gpt-4o-mini
response = client.chat.completions.create(
    model="gpt-4o-mini",
    messages=[{"role": "user", "content": "Hello!"}]
)

3. Migrating from Anthropic (Claude)

If you are already using the Anthropic SDK, you don’t need to switch to the OpenAI SDK. Simply update the base_url to point to Routeway:
import os

from anthropic import Anthropic

client = Anthropic(
    api_key=os.getenv("ANTHROPIC_API_KEY"),
)

message = client.messages.create(
    model="claude-opus-4.8",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Hello, Claude!"}],
)

print(message.content)

4. Other OpenAI-Compatible Gateways (e.g., DeepInfra, OpenRouter, Together AI)

If you are currently using the OpenAI SDK configured for another proxy, gateway, or compatibility layer (like DeepInfra, OpenRouter, Together AI, Groq, or Open WebUI), migrating is extremely simple. You only need to update the client configuration references:
  • Base URL: Change the base URL of your client to https://api.routeway.ai/v1.
  • API Key: Replace your provider-specific API key with your ROUTEWAY_API_KEY.
  • Model Identifier: Update the model parameter to one of Routeway’s supported models (e.g. gpt-4o, claude-3-5-sonnet, deepseek-v3).

5. General HTTP / REST Migration

If you are not using an SDK and instead make direct HTTP requests (e.g., using fetch, axios, or Python requests), follow these general guidelines to migrate from any other provider:
  1. Endpoint: Point your POST requests to:
    https://api.routeway.ai/v1/chat/completions
    
  2. Headers: Provide your API key in the standard bearer token format:
    Authorization: Bearer YOUR_ROUTEWAY_API_KEY
    Content-Type: application/json
    
  3. Payload Structure: Ensure your JSON body uses the standard Chat Completions format:
    {
      "model": "model-id-here",
      "messages": [
        {
          "role": "user",
          "content": "Your prompt goes here"
        }
      ]
    }
    
See our Models page for the full list of model identifiers available on Routeway.