KairosRoute
Docs/Migration Guide

Switch from OpenAI in 2 Minutes

KairosRoute is 100% OpenAI-compatible. You only need to change 2 lines of code.

✓ What Stays the Same

  • ✓ Same message format and parameters
  • ✓ Same response schema
  • ✓ Same streaming API
  • ✓ Same error handling
  • ✓ Drop-in replacement (no logic changes needed)

Code Changes Required

Python (2 lines changed)

Before

from openai import OpenAI client = OpenAI( api_key="sk-..." ) response = client.chat.completions.create( model="gpt-3.5-turbo", messages=[ { "role": "user", "content": "Hello!" } ] ) print(response.choices[0].message.content)

After

from kairosroute import KairosRoute client = KairosRoute( api_key="kr_live_..." ) response = client.chat.completions.create( model="kr-auto", messages=[ { "role": "user", "content": "Hello!" } ] ) print(response.choices[0].message.content)

Changes: Line 1: openaikairosroute | Line 3: api_key="sk-..."api_key="kr_live_..." | Line 7 (optional): Use kr-auto for intelligent routing or keep your specific model.

⚠️ What's Different

  • Base URL: api.openai.comkairosroute.com
  • API Key prefix: sk_kr_live_
  • Model names: Use kr-auto for intelligent routing, or use specific model names if you prefer
  • Response headers: Additional headers like X-KairosRoute-Savings show your cost savings

Migration FAQ

Can I keep using the same model names?

Yes! You can use specific model names like gpt-4 or gpt-3.5-turbo if your API keys have access. We recommend kr-auto for maximum cost savings.

What about environment variables?

Update your .env file to use KAIROSROUTE_API_KEY instead of OPENAI_API_KEY. Everything else stays the same.

Will my existing code work?

Yes, 100%. The request and response formats are identical to OpenAI's. Only the client initialization and base URL change. All your existing business logic continues to work.

Do I need to handle errors differently?

No. Error codes and handling are identical to OpenAI. Our SDKs throw the same exception types. Your existing error handling code works without changes.

Can I test before migrating fully?

Absolutely. Create a KairosRoute API key, test with a small subset of your requests, and gradually roll out to 100% of traffic. You can even run both in parallel.

What about billing?

KairosRoute charges per API request based on the model used. You'll see exact pricing in your dashboard with our cost savings clearly shown in response headers.

Migration Checklist

  1. 1

    Get a KairosRoute API key

    Create an account and get your key

  2. 2

    Update your imports

    Change from openai to kairosroute

  3. 3

    Update your API key

    Replace your OpenAI API key with your KairosRoute API key

  4. 4

    (Optional) Switch to kr-auto

    For maximum savings, change model parameter to kr-auto

  5. 5

    Test and deploy

    Run your test suite, validate output, then deploy to production

  6. 6

    Monitor savings

    Check your dashboard to see cost savings and routing stats

Ready to migrate?

Get your API key and start saving on LLM costs today.

Get Started Now →