DEV Community

Rambo Peng
Rambo Peng

Posted on

🚨 OpenAI API Blocked in China? Here's a Working Solution for Developers

🚨 OpenAI API Blocked in China? Here's a Working Solution for Developers

Since July 2024, OpenAI has blocked API access for developers in China. If you're a Chinese developer or building apps for the Chinese market, you've likely hit this wall. But there's a solution.

The Problem

  • OpenAI API is blocked in mainland China and Hong Kong
  • Azure OpenAI isn't available for mainland China enterprises either
  • VPNs are unstable and violate Terms of Service
  • Developers need a stable, legal way to access AI APIs

The Solution: ChinaWhAPI (chinawhapi.com)

A proxy service that provides access to global AI models (OpenAI, Claude, Gemini) with:

  • Stable API endpoints - works from China without VPN
  • OpenAI-compatible format - just change your base URL
  • Competitive pricing - pay in CNY, no foreign cards needed
  • Multiple providers - switch between models easily

Quick Integration

// Just change the baseURL - everything else stays the same
const response = await fetch('https://chinawhapi.com/v1/chat/completions', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer YOUR_API_KEY`,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    model: 'gpt-4',
    messages: [{ role: 'user', content: 'Hello!' }]
  })
});
Enter fullscreen mode Exit fullscreen mode

Who Is This For?

  • 📱 App developers building AI features for Chinese users
  • 🏢 Enterprises needing AI integration in China
  • 🌏 Foreign devs building products for the Chinese market
  • 🔧 AI startups in China requiring stable API access

Alternatives Considered

Solution Pros Cons
Azure OpenAI Reliable Not available in mainland China
Domestic LLMs Available Different API, higher cost
VPN + OpenAI Works Unstable, ToS violation
ChinaWhAPI Stable, legal, compatible New service

Try it now: chinawhapi.com

Would love feedback from the community! Has anyone else found good solutions for this problem?

Top comments (0)