Because almost every Chinese provider exposes an OpenAI-compatible Chat Completions endpoint, moving code from OpenAI to DeepSeek, Qwen, GLM or Kimi is usually a configuration change rather than a rewrite. The real work is choosing the right model, checking which features you rely on, and validating quality before you switch production traffic.
If you use the official OpenAI SDK, the change is the base URL and the model id:
# before
client = OpenAI(api_key=os.environ["OPENAI_API_KEY"])
# after
client = OpenAI(
base_url="https://aiapi-pro.com/v1",
api_key=os.environ["NOVAI_API_KEY"],
)
resp = client.chat.completions.create(
model="deepseek-v4-flash", # was "gpt-4o-mini"
messages=[{"role": "user", "content": "Hello"}],
)
Model ids, context windows and prices are listed at /model-marketplace.html and in the machine-readable feed at /china-ai-leaderboard.json. If you use a framework (LangChain, LlamaIndex, the Vercel AI SDK), it normally reads baseURL from configuration.
These are reasonable starting points, not drop-in equivalents. Always re-run your own evaluation set.
| If you used | Consider | Model id | Notes |
|---|---|---|---|
| GPT-4o-mini (cheap general) | DeepSeek V4 Flash | deepseek-v4-flash | Strong price/quality for extraction, classification, summarisation |
| GPT-4o (general) | Qwen3.8-Max / DeepSeek V4 Flash | qwen3.8-max / deepseek-v4-flash | Test both on your prompts; Qwen is strong on multilingual |
| o-series (reasoning) | DeepSeek V4 Pro / GLM-5.3 | deepseek-v4-pro / glm-5.3 | Higher latency; visible reasoning where the model supports it |
| Long-context models | Kimi K2.8/K3 | kimi-k2.8-preview / kimi-k3 | Compare cost of a full-context pass before switching |
| Coding agents | Kimi K2.7 Code / DeepSeek V4 Flash | kimi-k2.7-code / deepseek-v4-flash | Tool-calling reliability matters more than raw price |
| Vision (image input) | Qwen3-VL-Plus / GLM-4.6V | qwen3-vl-plus / glm-4.6v | Check image limits and OCR quality per model |
| Image generation | Seedream 5.0 | doubao-seedream-5.0 | Billed per image, not per token |
| Video generation | Seedance 2.0 Fast | doubao-seedance-2.0-fast | Billed per second/generation; check resolution tiers |
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://aiapi-pro.com/v1",
apiKey: process.env.NOVAI_API_KEY,
});
const res = await client.chat.completions.create({
model: "deepseek-v4-flash",
messages: [{ role: "user", content: "Hello" }],
});
console.log(res.choices[0].message.content);
response_format, some only via prompting. Validate with your real schema.prompt_tokens count. Budget from measured usage, not estimates.| Capability | Status | What to verify per model |
|---|---|---|
| Chat Completions | Yes | Basic sanity, temperature handling |
| Streaming (SSE) | Yes | Event sequence, final usage block |
| Tool / function calling | Model-dependent | Strict schemas, parallel calls, error recovery |
| JSON mode | Model-dependent | Schema conformance on your actual output |
| Vision input | Vision models only | Image size limits, OCR quality |
| Long context | Model-dependent | Real usable window, truncation behaviour |
| Image / video generation | Separate endpoints | Billing unit (per image / per second), resolution tiers |
For a worked cost comparison of Chinese models on the same task, see the coding-agent cost model and the measured-cost hub.
Yes. Set base_url to the OpenAI-compatible endpoint and pass a model id from the provider's catalogue. Chat Completions calls, streaming and tools work; OpenAI-only APIs such as Assistants and the Responses API do not.
For Chat Completions it is compatible, but individual models differ in tool-calling strictness, JSON-mode support, vision input and tokenizer behaviour. Test your specific features.
Usually not, but Chinese models may respond differently to system prompts, formatting instructions and refusal policies. Run your evaluation set before switching production traffic.
Compare cost per successful task, not price per token: include retries, cache hit rates and output token distribution. A cheaper model that needs two attempts is often more expensive.
Yes. Use one base URL and key, then choose per task: a cheap model for extraction and a stronger one for reasoning or coding. Keep a fallback model configured.
One OpenAI-compatible endpoint for DeepSeek, Qwen, GLM, Kimi, MiniMax and Doubao. Five models are free to call without a credit card.
Get a free API key →