DEV Community

Arson
Arson

Posted on

Stop Wasting CAPTCHA Credits: Detect What Kind of Block You Are Hitting First

The Problem

AI agents and web scrapers waste enormous amounts of time and money misclassifying web access blocks.

Here is what typically happens:

  1. Agent hits a Cloudflare page
  2. Agent assumes it is a CAPTCHA
  3. Agent submits a solve request
  4. Solve fails because it was actually a JS challenge, not a CAPTCHA
  5. Agent retries. Same result. Repeat until timeout.

Or worse:

  1. Agent hits a login page
  2. Agent sees a CAPTCHA widget on the login form
  3. Agent solves the CAPTCHA but still cannot access the content because authentication is the actual gate, not the CAPTCHA

The root cause: agents do not classify the block type before attempting to bypass it.

The Solution: Pre-flight Block Detection

We built a free endpoint at GateSolve that classifies URL access blocks:

curl "https://gatesolve.dev/api/detect?url=https://example.com"
Enter fullscreen mode Exit fullscreen mode

Response:

{
  "url": "https://example.com",
  "classification": "captcha",
  "captchaType": "cloudflare-turnstile",
  "httpStatus": 403,
  "solvable": true,
  "confidence": 0.9,
  "recommendation": "Submit to GateSolve /api/solve",
  "checkedAt": "2026-03-26T12:00:00.000Z"
}
Enter fullscreen mode Exit fullscreen mode

Classification Types

Classification What It Means Solvable? What To Do
public-ok Page is accessible No action needed Proceed normally
captcha CAPTCHA widget detected Yes Submit to a CAPTCHA solver
js-challenge Cloudflare JS interstitial No Use a real browser, wait 5-10s
auth-wall Login/auth required No Provide credentials
blocked-silent 403 with no pattern No Try different IP/user-agent
rate-limited 429 Too Many Requests No Back off and retry

Why This Matters

Every failed solve attempt costs:

  • Time: 7-15 seconds waiting for a result that was never going to work
  • Money: CAPTCHA solving credits burned on unsolvable blocks
  • Compute: retry loops that spiral into timeout

A 2-second pre-flight check saves all of that.

For Browser Automation: Client-Side Detection

If you are using Puppeteer or Playwright, we also ship detectBlock in our plugins:

import { detectBlock, solveOnPage } from '@gatesolve/puppeteer-plugin';

await page.goto('https://target-site.com');

const block = await detectBlock(page);

if (block.classification === 'captcha' && block.solvable) {
  await solveOnPage(page, { apiKey: 'gs_...' });
} else if (block.classification === 'js-challenge') {
  await page.waitForTimeout(10000);
  const recheck = await detectBlock(page);
} else if (block.classification === 'auth-wall') {
  console.log('Login required, not a CAPTCHA problem');
}
Enter fullscreen mode Exit fullscreen mode

Install:

npm install @gatesolve/puppeteer-plugin
# or
npm install @gatesolve/playwright-plugin
Enter fullscreen mode Exit fullscreen mode

Both v0.2.0, just published.

The Failure Taxonomy

This idea came from a community discussion. The insight: agents need a failure taxonomy before they need a bypass stack.

Classify first, then act. Not the other way around.


GateSolve is a CAPTCHA solving API for AI agents. Free tier with 100 solves, no credit card. The detect endpoint requires no API key at all.

Top comments (0)