DEV Community

CtrlAltDeleteMe
CtrlAltDeleteMe

Posted on

How I Got My AI API Relay Station Running: Domain, Email, Payments, and Upstream Channels

Setting up a relay station isn't hard — there are plenty of tutorials out there. But after actually running one, I realized that a few key decisions made early on can either save you a lot of headaches or haunt you for a long time. This post is a summary of the path I took, hoping to help you avoid some of the same pitfalls. My own relay station Brivionix is linked at the end for reference.


1. Core Open Source Framework: new-api

I recommend new-api, an enhanced fork of one-api:

  • Full user registration / login / OAuth system
  • Multi-channel upstream management with automatic load balancing
  • Token-level quota limits, model whitelists, IP restrictions
  • Built-in wallet system with top-up codes and referral rewards
  • React frontend + Go backend, one-click Docker deployment
docker pull calciumion/new-api:latest
Enter fullscreen mode Exit fullscreen mode

2. Domain: Buy from Cloudflare, Save the Headache

I strongly recommend buying your .com domain directly from Cloudflare Registrar:

  • At-cost renewal pricing — no bait-and-switch with low first-year prices that skyrocket on renewal
  • Automatically hosted on Cloudflare DNS after purchase, no migration needed
  • Built-in DDoS protection, WAF, and bot blocking — essential for a high-traffic API service
  • Free SSL, full HTTPS out of the box

Stick with .com — for a developer-facing tool, it carries more credibility than alternatives.

Purchase at: dash.cloudflare.com → Domain Registration → Register Domains


3. Email: Don't Use a Personal Inbox — Get a Proper Sending Service

A lot of people start out using Gmail or a personal inbox to send verification emails. This is a ticking time bomb:

  • Personal inboxes hit sending limits fast and can get flagged or suspended
  • Verification emails frequently land in spam, directly increasing registration drop-off

I use Alibaba Cloud DirectMail with a prepaid resource pack. For a few hundred emails a day, the cost is minimal. The benefits:

  • Enterprise-grade sending infrastructure with high deliverability
  • Custom sending domain support (e.g. no-reply@yourdomain.com) — looks professional
  • Pairing with Cloudflare DNS to set up SPF / DKIM records further improves email reputation

Once configured, just fill in the SMTP settings in the new-api backend. Verification emails and password resets all handled automatically.


4. Registration: Email + Two OAuth Login Options

I've enabled three sign-up / login methods:

① Email + verification code: The baseline. With a proper sending service, verification emails arrive instantly.

② GitHub one-click login: Almost every developer has a GitHub account. One-click authorization beats filling out forms, and conversion rates are noticeably higher.

③ Google one-click login: Great for international users and anyone with a Google account.

If your audience is primarily based in China, Google OAuth requires a VPN to access. GitHub login alone may be sufficient depending on your user base.


5. Payments: Self-Hosted Is the Only Way to Keep the Money

Payments are where the actual margin lives, and the wrong choice here will quietly erode your profits.

A lot of people start with third-party payment aggregators because they're easy to set up. The problems pile up quickly though: high fees (1–3%), funds held by a third party, slow withdrawals, and the platform can shut down at any time. Self-hosted payments are the right call.

International users: Stripe

Stripe is the global standard for card payments and covers users worldwide. Developers outside the US can register and get it set up. Once integrated, top-ups are fully automated via Webhook callbacks — no manual handling needed.

Domestic users (China): Self-hosted Epay

Epay is open source and self-hostable. It supports Alipay integration, and new-api natively supports its callback protocol, so integration overhead is low. Most importantly: funds go directly into your own Alipay account — no third-party platform holding your money.

Compared to aggregators, self-hosted Epay means lower fees, a shorter money pipeline, and full control when things go wrong.


6. Upstream Channels: The Real Barrier Nobody Talks About

Once the infrastructure is in place, the station can run. But what actually determines whether it keeps running — and whether it's worth running — is your choice of upstream channels.

Two things can kill you here:

Costs that leave no room for margin

Your upstream price directly sets the ceiling on how you can price your service. If the cost you're getting upstream is already close to what other relay stations are charging users, there's no room left. Before committing to any upstream source, do the math: upstream cost × your markup rate = does a reasonable margin exist? If the numbers don't work out, no amount of good execution elsewhere will fix it.

Instability that drives users away

Frequent outages, account bans, rate limiting on the upstream side — these directly destroy the user experience. A relay station's reputation is almost entirely built on reliability. Once users hit a few failed API calls, they're gone, and they don't come back. This is harder to manage than cost because instability is often sudden and unpredictable.

Key criteria for evaluating upstream channels:

  • Cost: Does the unit price leave enough margin? Are there volume discounts for long-term purchasing?
  • Stability: Is there a track record? Any uptime or availability data to reference?
  • Supply legitimacy: Is the source clear? Can it keep supplying consistently, or is there a risk of sudden cutoff?
  • Technical compatibility: Is it OpenAI-format compatible? Is the model list complete? What's the latency like?
  • Maintenance overhead: Self-managed account pools require ongoing work — handling bans, replenishing accounts, routine checks. If you're running solo, this hidden time cost adds up and needs to be factored in from the start.

7. Pre-Launch Checklist

  • [ ] Domain purchased on Cloudflare, DNS hosted, proxy enabled
  • [ ] SSL configured, full HTTPS accessible
  • [ ] Email sending domain verified, test email lands in inbox (not spam)
  • [ ] new-api SMTP configured, registration verification email tested end-to-end
  • [ ] GitHub / Google OAuth callback URLs correct, one-click login tested
  • [ ] Stripe Webhook configured, top-up auto-credit tested
  • [ ] Epay callback URL accessible, Alipay full payment flow tested
  • [ ] Upstream channel health checks enabled, auto-failover working
  • [ ] New user default quota and referral rewards configured
  • [ ] Database backup scheduled

8. Closing

Domain, email, payments, upstream channels — none of these are complicated on their own, but getting all of them working reliably together takes time to dial in. Hopefully this saves you some of that time.

My own relay station Brivionix is currently in early access. If you run into anything while using it, feel free to drop by Discord and give feedback. New registrations come with $1 in free credits to try things out.

🔗 Website: brivionix.com

Top comments (0)