DEV Community

youssef jamoudi
youssef jamoudi

Posted on

Why I Built a Static Checker for OpenAI/Anthropic API Bugs

If you've worked with the OpenAI or Anthropic APIs for more than a week, you've probably hit this loop: write some code, run it, wait, get a cryptic error, dig through the code, find out it was something small, fix it, run it again.

The mistakes are almost always the same handful of things:

A hardcoded API key that shouldn't be in source control
An environment variable you meant to set but left as "your-api-key-here"
A missing required field like model or max_tokens
A typo in a model name — TypeScript can't catch this since it's just a string, so it silently fails at request time instead of compile time
No retry/backoff logic, so a 429 rate-limit response crashes the whole script instead of retrying
A prompt that's quietly way over the model's context window

None of these are hard to fix once you know about them. The expensive part is the loop — running the code, waiting, and finding out the hard way, especially when each run costs tokens or burns rate-limit budget.

So I built API Guard — a VS Code extension that scans your JS/TS/Python files on save and flags this whole category before you hit run.

Free tier:

Hardcoded API key/secret detection
Placeholder environment variable detection

Pro tier (one-time unlock, no subscription):

Model name typo detection (fuzzy-matched against known OpenAI/Anthropic model names)
Missing retry/backoff detection
Context window overflow estimation

Everything runs locally — your code never leaves your machine.

Links:

Extension: https://marketplace.visualstudio.com/items?itemName=youssef3131.api-guard
Pro unlock: https://youssefjamoudi.gumroad.com/l/spyax

This is a first version. If you try it and find a false positive, or think it's missing an obvious check, I'd genuinely like to hear about it — better to know now than after more people install it.

Top comments (0)