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://tidelink.xyz/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.
Get an API key →
</div
Get a free TideLink API key — call GLM, Qwen, DeepSeek and more through one OpenAI-compatible endpoint: https://tidelink.xyz/dashboard.html?cid=devto
Top comments (0)