DEV Community

Redman WorkflowAlpha
Redman WorkflowAlpha

Posted on

I audited 28 paid API descriptions. 21 were a template — here is the exact fix.

I audited 28 paid API descriptions. 21 were a template — here is the exact fix.

A few days ago an independent auditor sent me a short, uncomfortable email. He had re-probed my paid API against production rather than trusting my own description of a fix.

His verdict had two halves:

  • The fix was real. All three claims held.
  • But 21 of my 28 product descriptions were a template.

That second line was the useful one.

The template

Here is what 21 of my 28 catalogue rows said, with only the task name swapped:

keywords micro-task. Send {task, prompt}. Costs 0.01 USDC on Base, paid per call via x402 exact.
Enter fullscreen mode Exit fullscreen mode

Each string is technically distinct. Each one is also useless. An agent choosing between keywords and extract sees a name, a price, and no product. My own earlier diagnosis had been "agents read the prose, not the schema" — and a template is the one case where that is guaranteed to fail.

The seven descriptions I had written properly were code_explain, code_review, extract, sentiment, summarize, translate, web_search. web_search said "return up to 5 result URLs (DuckDuckGo Lite)". That is a claim an agent can decide against. "keywords micro-task" is not.

The fix

One dict, 21 real entries, no route or price changes:

def _task_description(task: str) -> str:
    return {
        "hash": "Hash the input with a standard algorithm (SHA-256 by default) "
                "and return the hex digest. Send {task:'hash', prompt:'text to hash'}.",
        "json_minify": "Minify JSON: remove whitespace while preserving structure "
                       "and key order. Send {task:'json_minify', prompt:'{ \"a\": 1 }'}.",
        "keywords": "Extract the most important keywords and phrases from a text, "
                    "ranked by relevance. Send {task:'keywords', prompt:'text'}.",
        # ... 18 more
    }.get(task, "%s micro-task. Send {task, prompt}." % task)
Enter fullscreen mode Exit fullscreen mode

Then the boring part that actually matters: loop all 28 names through the live endpoint and assert zero of them still contain the template string. I wrote "28/28 descriptive, 0 template" only after that loop printed it.

The trap I hit while deploying it

Two systemd units were launching the same file. I patched, restarted one, saw active, and the public response was still the old string. The unit I restarted bound port 8080. The one nginx actually proxied to — port 8000 — was a different service.

is-active on the wrong unit is a false confirmation. Find the port owner first:

sudo ss -ltnp | grep ':8000'
Enter fullscreen mode Exit fullscreen mode

What the traffic data said

I also checked who was actually calling the API. In the last 5000 requests:

  • 2867 got HTTP 402 — a payment challenge
  • 12 paid, total

The User-Agent breakdown explained the gap: PayAI-Bazaar, x402lens-indexer, BotsRated-probe (which literally says "unpaid check; no payment sent"), CarbonMonitor, BrickBlueBot. Indexers and monitors, not buyers.

And the "155 free test calls" I had been watching? 124 came from my own Sarajevo IP, from my own monitoring cron. I was measuring myself.

The rule I am keeping

A well-formed 402 with a wrong advertised resource is the pathological case. Envelope correctness is not index correctness. A catalogue row is a snapshot of the last paid call, not a directory of everything you declared — so if your last payer bought hash, that is all the catalog shows, no matter how many products you think you published.

Distinct is not descriptive. Descriptive is not distributed. I fixed the first one today; the other two are still on the list.

If you run a paid API, go read your own descriptions as if you had never seen the code. Count how many are a name and a price. Then decide whether you have a catalogue or just a template with 28 names.

Top comments (1)

Collapse
 
foundrybell profile image
Foundry Bell •

template caught