DEV Community

Rambo Peng
Rambo Peng

Posted on

How to Use DeepSeek API and Qwen API Outside China (OpenAI-Compatible Chinese LLM Gateway)

If you're building an AI product, agent, or SaaS tool and need access to Chinese LLMs like DeepSeek and Qwen from anywhere in the world, you've probably run into regional access restrictions or complex API onboarding. There's a simpler way.

In this guide, I'll show you how to use ChinaWHAPI — an OpenAI-compatible gateway for Chinese LLMs that works globally, with no VPN or China-specific setup required.

Why Use Chinese LLMs?

Chinese large language models like DeepSeek and Qwen offer:

  • Strong performance on multilingual and reasoning tasks
  • Cost efficiency compared to some Western models
  • Specialized capabilities for Chinese language understanding
  • Compliance with China data regulations when needed

But accessing them from outside China can be complicated. That's where an API gateway helps.

What Is ChinaWHAPI?

ChinaWHAPI is an OpenAI-compatible API gateway that gives global developers instant access to:

  • DeepSeek (all versions)
  • Qwen / Qwen2 / Qwen-VL
  • Other Chinese LLMs

The key benefits:

OpenAI SDK compatible — drop-in replacement, no code rewrite

Global access — works from anywhere without VPN

Single API key — manage multiple models from one dashboard

Dify / LangChain / Cursor ready — integrate into your existing stack

👉 Get started at chinawhapi.com

How to Use DeepSeek API Outside China

Here's how to call DeepSeek through ChinaWHAPI using the standard OpenAI SDK:

from openai import OpenAI

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

response = client.chat.completions.create(
    model="deepseek-chat",
    messages=[
        {"role": "user", "content": "Explain quantum computing in simple terms"}
    ]
)

print(response.choices[0].message.content)
Enter fullscreen mode Exit fullscreen mode

That's it. Same SDK, same structure — just change the base_url and api_key.

How to Use Qwen API Globally

Qwen works exactly the same way:

from openai import OpenAI

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

response = client.chat.completions.create(
    model="qwen-turbo",
    messages=[
        {"role": "user", "content": "Summarize this article in Chinese"}
    ]
)

print(response.choices[0].message.content)
Enter fullscreen mode Exit fullscreen mode

No special setup. No region checks. It just works.

How to Connect Dify with DeepSeek and Qwen

If you're using Dify for AI workflows, ChinaWHAPI integrates directly:

  1. Open your Dify workspace
  2. Go to SettingsModel ProviderAdd Custom Provider
  3. Enter:
    • API Endpoint: https://chinawhapi.com/v1
    • API Key: Your ChinaWHAPI key
    • Model List: deepseek-chat, qwen-turbo, etc.
  4. Save and start building workflows with Chinese LLMs

How to Use Chinese LLM APIs in LangChain

LangChain also supports OpenAI-compatible endpoints:

from langchain_openai import ChatOpenAI

llm = ChatOpenAI(
    model="deepseek-chat",
    openai_api_key="YOUR_CHINAWHAPI_KEY",
    openai_api_base="https://chinawhapi.com/v1"
)

response = llm.invoke("What are the main differences between transformers and LSTMs?")
print(response.content)
Enter fullscreen mode Exit fullscreen mode

You can swap between DeepSeek, Qwen, GPT-4, Claude, and Gemini without changing your LangChain pipeline structure.

How to Use DeepSeek and Qwen in Cursor

Cursor (the AI-powered code editor) lets you add custom model providers:

  1. Open Cursor → SettingsModels
  2. Add a new OpenAI-compatible provider:
    • Base URL: https://chinawhapi.com/v1
    • API Key: Your ChinaWHAPI key
  3. Select deepseek-chat or qwen-turbo from the model dropdown
  4. Start coding with Chinese LLMs powering your autocomplete and chat

Summary

If you need global access to DeepSeek, Qwen, and other Chinese LLMs without VPN setup or regional restrictions, ChinaWHAPI gives you:

✅ OpenAI-compatible API

✅ Works with Dify, LangChain, Cursor

✅ Single key for all models

✅ Global availability

👉 Start building with Chinese LLMs at chinawhapi.com

Top comments (0)