DEV Community

仪袁韶
仪袁韶

Posted on Originally published at tidelink.xyz

occ_title

← 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://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.

TideLink · All guides · TideLink is operated by Yuncheng Yanhu Beicheng Chaoxi Network Technology Studio, a sole proprietorship registered in Yuncheng, China (Unified Social Credit Code 92140802MAKM59LT6K), providing software development and IT integration services. Not a resale of third-party credentials.
中国注册主体:运城市盐湖区北城街道潮汐网络科技工作室(个体工商户,统一社会信用代码 92140802MAKM59LT6K)

Top comments (0)