DEV Community

Jesse
Jesse

Posted on

Building an AI API Gateway with Go + React — Solo Dev Tech Breakdown

I built Token China — an API gateway for DeepSeek and GLM — as a solo developer. Here is the full tech breakdown.

Architecture

Nginx (HTTPS) → Go binary (embedded React SPA) → SQLite
Enter fullscreen mode Exit fullscreen mode
  • Backend: Go 1.26, forked from new-api (open source AI gateway)
  • Frontend: React + Rsbuild + TanStack Router, embedded via Go embed.FS
  • Database: SQLite (zero external dependencies)
  • Hosting: Single Vultr VPS, Singapore ($6/month)
  • Process: systemd, no Docker

Models

Four upstream channels through one OpenAI-compatible endpoint:

Model Category Multiplier
deepseek-v4-pro Reasoning 1.75x
deepseek-v4-flash Fast 0.1x
glm-5.1 General 0.5x
glm-5v-turbo Vision 0.72x

Payment

USDT (TRC20) deposits with automatic on-chain monitoring. A Python daemon polls TronGrid every 30 seconds and credits user accounts in real-time.

Lessons Learned

  1. Go embed.FS does not work with http.FileServer for SPAs — had to write a custom filesystem handler
  2. Docker OOM on a $6 VPS was a dealbreaker — native systemd reduced memory from 512MB to ~18MB
  3. DNS hijacking by ISPs is a real problem for .cc domains

Try It

token-china.cc — free starter credits on signup.

Top comments (0)