How I Built a Cost-Effective AI API Gateway for Chinese LLMs in 10 Minutes
As an indie developer, I've been looking for ways to reduce API costs without sacrificing quality. OpenAI is great, but the cost adds up quickly.
I started exploring Chinese LLMs β they offer similar quality at a much lower price. But there's a problem: each provider has its own API format, payment system, and sometimes requires a Chinese phone number to register.
So I built a unified API gateway using an open-source tool called One API. It translates standard OpenAI-style requests into calls to various Chinese model providers.
Quick Demo
Here's what I did:
- Deployed One API on a VPS
- Added a channel for Zhipu AI (Chinese provider)
- Generated an API key
- Tested it with curl
Here's a sample call:
bash
curl http://aitokenshub.net:3000/v1/chat/completions \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"model": "glm-4-flash",
"messages": [{"role": "user", "content": "Hello, introduce yourself"}]
}'
Top comments (1)
Hi everyone π I'm the author. I built this because I couldn't afford OpenAI's API for my side projects. Happy to answer any questions about how it works!