ChinaWHAPI
Global Gateway
← Back to Knowledge Center
OpenAI SDKPythonNode.jsIntegration

Calling Chinese LLMs with the OpenAI SDK: Zero-Change Cross-Platform Solution

The OpenAI SDK's widespread adoption makes it the most developer-friendly way to integrate Chinese models. This article shows how to call DeepSeek, Qwen, Kimi, and all Chinese models with one codebase.

OpenAI SDK Compatibility

The OpenAI SDK's core is the chat completions API. As long as you provide a baseURL, it can work with any server implementing the OpenAI protocol. ChinaWHAPI fully supports this protocol.

Python Integration

from openai import OpenAI

client = OpenAI(
    api_key="your_chinawhapi_key",
    base_url="https://chinawhapi.com/v1"
)

# Call DeepSeek
response = client.chat.completions.create(
    model="deepseek-v4-flash",
    messages=[{"role": "user", "content": "Explain microservices architecture"}]
)

# Switch to Qwen by changing the model field
response = client.chat.completions.create(
    model="qwen3.6-plus",
    messages=[{"role": "user", "content": "Explain microservices architecture"}]
)

Node.js Integration

import OpenAI from "openai";

const client = new OpenAI({
  apiKey: "your_chinawhapi_key",
  baseURL: "https://chinawhapi.com/v1",
});

const res = await client.chat.completions.create({
  model: "kimi-k2.6",
  messages: [{ role: "user", content: "Analyze this code" }],
});

Use Cases

Any existing project using the OpenAI SDK can switch to Chinese models at zero cost — just change baseURL and API Key, no changes to business logic.