DEV Community

shashank ms
shashank ms

Posted on

Migrating from OpenAI to Oxlo.ai: A Step-by-Step Guide

If you are currently running workloads on OpenAI's API, switching to an open-source alternative can cut costs and remove vendor lock-in without rewriting your stack. Oxlo.ai offers a fully OpenAI-compatible inference platform with request-based pricing, so you pay one flat rate per API call regardless of prompt length. That makes it a strong fit for long-context applications, agentic loops, and high-volume chat workloads that would otherwise accumulate heavy token charges.

Step 1: Create an Oxlo.ai account and API key

Sign up at Oxlo.ai and navigate to the dashboard to generate an API key. The platform offers a Free plan with 60 requests per day across 16+ models and a 7-day full-access trial, so you can test the migration before committing to a paid tier.

Step 2: Update your client configuration

Oxlo.ai is a drop-in replacement for the OpenAI SDK. You only need to change the base_url to https://api.oxlo.ai/v1 and supply your Oxlo.ai API key.

Python example:

from openai import OpenAI

client = OpenAI(
    base_url="https://api.oxlo.ai/v1",
    api_key="YOUR_API_KEY"
)

response = client.chat.completions.create(
    model="llama-3.3-70b",
    messages=[{"role": "user", "content": "Explain request-based pricing."}]
)
print(response.choices[0].message.content)

cURL example:

curl https://api.oxlo.ai/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $API_KEY" \
  -d '{
    "model": "llama-3.3-70b",
    "messages": [{"role": "user", "content": "Hello, world."}]
  }'

Step 3: Map OpenAI models to Oxlo.ai equivalents

Oxlo.ai hosts 45+ models across seven categories. Below is a practical mapping for common OpenAI use cases.

  • General-purpose chat: Replace GPT-4o or GPT-4 with Llama 3.3 70B, the general-purpose flagship, or Qwen 3 32B for multilingual reasoning and agent workflows.
  • Deep reasoning and complex coding: Replace o1 or o3 with DeepSeek R1 671B MoE, Kimi K2.6 (advanced reasoning, agentic coding, vision, 131K context), or Kimi K2 Thinking for chain-of-thought reasoning.
  • Efficient long-context: Replace long-context GPT-4 Turbo with DeepSeek V4 Flash (efficient MoE, 1M context) or GLM 5 (744B MoE, long-horizon agentic tasks).
  • Vision inputs: Replace GPT-4o Vision with Kimi K2.6 or Gemma 3 27B.
  • Code generation: Replace GPT-4o for coding with Qwen 3 Coder 30B, DeepSeek Coder, or Oxlo.ai Coder Fast.
  • Embeddings: Replace text-embedding-3 with BGE-Large or E5-Large.
  • Image generation: Replace DALL-E with Oxlo.ai Image Pro, Oxlo.ai Image Ultra, Flux.1, or Stable Diffusion 3.5.
  • Audio transcription and speech: Replace Whisper with Whisper Large v3, Whisper Turbo, or Whisper Medium; replace TTS with Kokoro 82M.

<h2 id="step4-feature

Top comments (0)