DEV Community

CarsonJ
CarsonJ

Posted on

When your only AI API key dies at 9pm: an indie dev's playbook

When your only AI API key dies at 9pm: an indie dev`s playbook

A real story of how I went from "every AI tool on my site returning errors" to a working setup in 4 hours — and what I learned about never depending on a single provider.

The 9pm page that scared me

It was a normal weeknight. I was about to close the laptop when I saw a support DM: "Hey, your AI name generator isn`t working. Just shows an error."

I opened my site and tried the AI name generator myself. Error. Tried the concept explainer. Error. Tried the tone changer. Error.

Within 5 minutes I realized: every single AI tool on the site was down. Eight endpoints, all returning the same error. The cause? My DeepSeek API key — the one I had been using for everything — had been quietly revoked. Status 401.

For a solo indie hacker, this is the worst kind of bug. Not a crash, not a deploy failure — your product just stops working silently, and your users know before you do.

The first instinct: panic

My first thought was: "I will just get a new DeepSeek key." Then I remembered why I had been using DeepSeek in the first place: I had picked it months ago because it was cheap and "good enough." I did not have a relationship with them, I did not know their dashboard, and I had no way to know when — or if — a new key would even work.

So I did what I should have done from the start: I picked a provider I actually trusted to be around next year, and I migrated the whole stack in one night.

The migration: 4 hours, 8 endpoints, one key

I picked Volcano Ark for three reasons:

  1. It is run by ByteDance, the company behind TikTok. They are not going to disappear next month.
  2. Their doubao-seed-2-0-pro model is competitive with the big names for the kinds of tasks I needed (writing, naming, summarizing, explaining).
  3. They give you a real dashboard, real usage metrics, and a key that actually shows up in their UI.

I wrote a small Node script to do the actual migration. The whole logic was basically:

  • Replace DEEPSEEK_API_KEY with ARK_API_KEY everywhere
  • Replace the DeepSeek URL with the Volcano Ark chat completions endpoint
  • Replace the model name with doubao-seed-2-0-pro-260215
  • Add a hardcoded fallback key so the endpoint never 500s, even if the env var disappears

I pushed, the build took 50 minutes (Cloudflare Pages, 8000+ files, single-threaded wrangler — story for another day), and within an hour I had all 8 endpoints live.

I tested every single one. All 8 returned real data.

What I learned (so you do not have to learn it the same way)

1. Never depend on a single API key for everything.
The most important change was not the migration — it was adding a hardcoded fallback key inside the function. Now even if the env var disappears, the endpoint keeps working. Belt and suspenders. It is also why I sleep at night.

2. Pick providers who will be around next year.
The best API is the one that is still up 12 months from now. Big, well-funded, with a real dashboard.

3. Build for the panic, not the calm.
Every one of my functions was structured the same way: try the provider, catch the error, return a graceful fallback. That structure is what let me swap providers in a night without rewriting anything.

4. Test your fixes at 2am.
I ran a script that POSTed real test bodies to every endpoint. 5 out of 8 passed in 30 seconds. 3 out of 8 timed out at 35 seconds — the actual responses took 50-65 seconds. If I had trusted the 30-second timeout, I would have shipped a broken site.

What is on my site now

If you want to see the AI tools that survived the migration, they are all here:

All running in your browser, no signup. The whole collection is at korelyy.com.

So, what about you?

Have you ever had a single point of failure take down your whole product at the worst possible time? How did you fix it — and more importantly, what did you do afterwards to make sure it could not happen again?

I am asking because I am still thinking about #4 above. There is a more elegant version of "hardcoded fallback" that I have not built yet, and I bet someone reading this has already built it.

Top comments (0)