← All guides

OpenAI-compatible China models: a drop-in guide

You already have an OpenAI client wired into your app. The fastest way to reach China's models is to keep it and change one line.

Why compatibility matters

Rewriting your integration for every vendor is the hidden tax of multi-model setups. OpenAI's request/response shape has become the de-facto standard, so any endpoint that speaks it lets you swap providers without touching app code.

The one-line change

// before
base_url = "https://api.openai.com/v1"
// after
base_url = "https://447a931e9b6e46249e80a111415cd170.app.workbuddy.link/v1"

Everything else — your messages array, streaming, tool calls — stays identical. Behind that URL, the gateway routes to Doubao, Qwen, GLM, or Hunyuan.

Routing without rewrites

Pass a provider hint or a tier in the request body:

{
  "provider": "auto",
  "tier": "cost",
  "messages": [{"role":"user","content":"Hi"}]
}

cost leans on the cheapest available model, balanced mixes for quality, quality prefers the strongest. Failover is automatic — if one model errors, the next takes over on the same call.

Keep your client, add China

Get an API key →