Migrate from OpenAI to the Lurus API
Change a single base_url and all your existing OpenAI SDK calls connect through — no need to rewrite business logic.
Prerequisites
You already have a Lurus API KeyAPI KeyA secret credential for accessing the API, much like a password. Each Key can have its own quota and permissions.Learn more → (how to get one).
One change
- from openai import OpenAI
-
- client = OpenAI(api_key="sk-openai-...")
+ from openai import OpenAI
+
+ client = OpenAI(
+ api_key="sk-lurus-...",
+ base_url="https://hub.lurus.cn/v1",
+ )That's all. Every client.chat.completions.create(...) call works unchanged.
Model name mapping
| OpenAI model | Recommended Lurus equivalent |
|---|---|
| gpt-5 | gpt-5 (passthrough) or deepseek-chat / claude-sonnet-4 |
| gpt-4o-mini | deepseek-chat / qwen-turbo |
| gpt-4o | claude-sonnet-4 / gemini-3-pro |
| o1 | deepseek-reasoner |
| text-embedding-3-small | bge-m3 (local) / text-embedding-3-small |
See the full list under Supported models.
Rollout steps
Verify connectivity — run it once; success means you receive a reply.
pythonresp = client.chat.completions.create( model="deepseek-chat", messages=[{"role": "user", "content": "你好"}], ) print(resp.choices[0].message.content)Canary rollout — shift traffic from OpenAI to Lurus by ratio, ramping gradually from
0.1→0.5→1.0.pythonimport os, random def get_client(): if random.random() < float(os.getenv("LURUS_TRAFFIC", "0.1")): return OpenAI(api_key=os.getenv("LURUS_API_KEY"), base_url="https://hub.lurus.cn/v1") return OpenAI(api_key=os.getenv("OPENAI_API_KEY"))Rollback — remove
base_urlto revert to OpenAI calls. No restart needed (takes effect per request).
FAQ
Can't find a model name?
Search the model catalog, or open an Issue.
Are function calling / JSON mode supported?
Lurus is fully compatible with OpenAI function calling / JSON Schema.
Do I need an organization ID?
Lurus does not require the organization field; supplying it does not cause an error.