Migrate from OpenAI: base_url and SDK
Keep your code, change two values. The API is OpenAI-compatible: same routes, same streaming format, same error envelope. Here is the migration path, including what does not carry over.
1. Change the base URL and key
from openai import OpenAI
client = OpenAI(
base_url="https://api.effrenus.com/v1",
api_key="sk-ef-...",
)
const client = new OpenAI({
baseURL: "https://api.effrenus.com/v1",
apiKey: process.env.EF_KEY,
});
curl https://api.effrenus.com/v1/chat/completions \
-H "Authorization: Bearer $EF_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "dolphin-3.0-llama3.1-8b",
"messages": [{"role": "user", "content": "Hello"}]
}'
2. Map model ids
Model ids differ from OpenAI names. List the served catalogue with
GET /v1/models, then pick a model from the
catalogue page. Model names are stable per
deployment; an id not present in the served catalogue returns
404 model_not_found.
3. Streaming and tool calling
- Streaming: identical SSE format,
data: [DONE]terminator, optionalstream_options.include_usage. See streaming. - Tool calling: OpenAI format, but only for models whose
catalogue capabilities include
tools. See tool calling. - Not provided: assistants, fine-tuning, batches and other OpenAI-only products.
4. Error mapping
| OpenAI code you may handle | Effrenus equivalent |
|---|---|
| invalid_api_key (401) | missing_api_key / invalid_api_key (401) |
| insufficient_quota (429) | insufficient_credits (402) — top up |
| model_not_found (404) | model_not_found (404) |
| rate_limit_exceeded (429) | rate_limit_exceeded (429) with Retry-After |
| server_error (5xx) | upstream_unavailable (503), bad_upstream_response (502) |
5. Migration checklist
- Create an Effrenus key and top up credits.
- Switch
base_urlandapi_keyin a staging environment. - Replace model ids with catalogue ids.
- Run 20–50 real prompts and compare quality.
- Check streaming, tool calling and error handling paths.
- Estimate cost on your token ratio: pricing.
FAQ
Do I need to change my SDK?
No. The official OpenAI SDKs work by changing base_url and api_key; unsupported OpenAI-only features are the only exception.
Is streaming identical?
Yes: same SSE events, same [DONE] terminator, same
stream_options.include_usage; the token counters arrive in
the last chunk.
Going further
Ready to switch?
Create a key, top up €5 and run your first request.