Skip to content
This page was translated from the Chinese original, which has changed since — it may be out of date. The Chinese version is authoritative. View the Chinese original →
Migrate from OpenAI

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.

5 minutesEstimated time
1 changeCode edit
0 restartsRestarts

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 ​

diff
- 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 modelRecommended Lurus equivalent
gpt-5gpt-5 (passthrough) or deepseek-chat / claude-sonnet-4
gpt-4o-minideepseek-chat / qwen-turbo
gpt-4oclaude-sonnet-4 / gemini-3-pro
o1deepseek-reasoner
text-embedding-3-smallbge-m3 (local) / text-embedding-3-small

See the full list under Supported models.

Rollout steps ​

  1. Verify connectivity — run it once; success means you receive a reply.

    python
    resp = client.chat.completions.create(
        model="deepseek-chat",
        messages=[{"role": "user", "content": "你好"}],
    )
    print(resp.choices[0].message.content)
  2. Canary rollout — shift traffic from OpenAI to Lurus by ratio, ramping gradually from 0.1 → 0.5 → 1.0.

    python
    import 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"))
  3. Rollback — remove base_url to 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.

Next steps ​

Next steps

Powered by Lurus Technologies