Migrate from OpenAI
SovereignEG's API is fully OpenAI-compatible. Migration is a one-line change.
Step 1: Change the base URL
Python
# Before (OpenAI)
from openai import OpenAI
client = OpenAI(api_key="sk-openai-...")
# After (SovereignEG) — one line changed
from openai import OpenAI
client = OpenAI(
api_key="sk-...",
base_url="https://sovereigneg.com/v1"
)Node.js
// Before (OpenAI)
const client = new OpenAI({ apiKey: 'sk-openai-...' });
// After (SovereignEG) — one line added
const client = new OpenAI({
apiKey: 'sk-...',
baseURL: 'https://sovereigneg.com/v1',
});curl
# Before
curl https://api.openai.com/v1/chat/completions ...
# After — just change the URL
curl https://sovereigneg.com/v1/chat/completions ...Step 2: Map your models
OpenAI model names don't transfer one-to-one. Use the Model Library to find live equivalents:
| Your OpenAI habit | What to do on SovereignEG |
|---|---|
| Fast/cheap (GPT-3.5 class) | Sort catalog by input price; pick the cheapest live chat model |
| High quality (GPT-4 class) | Try a larger live chat model; benchmark on your prompts |
| Long context (GPT-4 Turbo class) | Sort by context window; pick a live model that fits your docs |
| Arabic workloads | Filter live multilingual chat models |
| Embeddings | Use a live embed model — separate endpoint from chat |
Step 3: That's it
Everything else works identically:
- ✓ Chat completions
- ✓ Streaming (SSE format)
- ✓ Function calling / tools
- ✓ System messages
- ✓ Multi-turn conversations
- ✓ Temperature, top_p, max_tokens
- ✓ Stop sequences
- ✓ Error format
Environment variable approach
The cleanest migration uses environment variables:
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["LLM_API_KEY"],
base_url=os.environ.get("LLM_BASE_URL", "https://api.openai.com/v1")
)# Switch providers by changing env vars — no code change
LLM_API_KEY=sk-...
LLM_BASE_URL=https://sovereigneg.com/v1What's different
| Feature | OpenAI | SovereignEG |
|---|---|---|
| Latency from MENA | Provider dependent | Provider dependent on the selected model/backing |
| Billing currency | USD only | EGP |
| Data location | US/EU by default | Standard routing today; contact us for Egypt-hosted deployments |
| Arabic models | Limited | Live multilingual models in the Model Library |
| Pricing | USD | EGP prepaid credits |
LangChain migration
If you're using LangChain, it's the same one-line change:
from langchain_openai import ChatOpenAI
llm = ChatOpenAI(
model="...",
api_key="sk-...",
base_url="https://sovereigneg.com/v1"
)All LangChain chains, agents, and tools work unchanged.