Skip to main content

gatesolve

Solve CAPTCHAs with x402 micropayments. Built for AI agents.

PyPI Python

Install

pip install gatesolve

Quick Start

from gatesolve import GateSolve

gs = GateSolve()

# Solve a Cloudflare Turnstile CAPTCHA
solution = gs.solve(
    captcha_type="turnstile",
    sitekey="0x4AAAAAAAB...",
    pageurl="https://example.com",
)

print(solution.token)  # Use this to bypass the CAPTCHA
print(solution.solve_time)  # e.g. "1.8s"
print(solution.payment.amount)  # e.g. "0.02"

Async

import asyncio
from gatesolve import AsyncGateSolve

async def main():
    async with AsyncGateSolve() as gs:
        solution = await gs.solve(
            captcha_type="turnstile",
            sitekey="0x4AAAAAAAB...",
            pageurl="https://example.com",
        )
        print(solution.token)

asyncio.run(main())

With Playwright

from gatesolve import GateSolve
from playwright.sync_api import sync_playwright

gs = GateSolve()

with sync_playwright() as p:
    browser = p.chromium.launch()
    page = browser.new_page()
    page.goto("https://protected-site.com")
    
    sitekey = page.locator("[data-sitekey]").get_attribute("data-sitekey")
    
    solution = gs.solve(
        captcha_type="turnstile",
        sitekey=sitekey,
        pageurl=page.url,
    )
    
    page.evaluate(f"""
        document.querySelector('[name="cf-turnstile-response"]')
            .value = '{solution.token}';
    """)
    page.click("button[type=submit]")

Configuration

gs = GateSolve(
    base_url="https://api.gatesolve.dev",  # API endpoint
    wallet_address="0x...",                  # Your USDC wallet
    network="base",                          # Base L2 (default)
    max_price=0.05,                          # Max price per solve
    timeout=30,                              # Timeout in seconds
    max_retries=3,                           # Auto-retry on failure
)

Supported CAPTCHAs

Type SDK Name Price
Cloudflare Turnstile turnstile $0.02
reCAPTCHA v2 recaptcha_v2 $0.03
reCAPTCHA v3 recaptcha_v3 $0.02
hCaptcha hcaptcha $0.03

How x402 Works

  1. You call gs.solve()
  2. SDK sends request to GateSolve API
  3. API returns HTTP 402 with payment details
  4. SDK pays via USDC on Base L2
  5. API returns the CAPTCHA solution

No API keys. No accounts. The payment IS the authentication.

Error Handling

from gatesolve import GateSolve, SolveError, RateLimitError

gs = GateSolve()

try:
    solution = gs.solve(...)
except RateLimitError as e:
    print(f"Rate limited, retry in {e.retry_after}s")
except SolveError as e:
    print(f"Solve failed: {e.message} (status: {e.status_code})")

Links

License

MIT

Release files for gatesolve 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gatesolve 0.2.0
File Size Uploaded
gatesolve-0.2.0.tar.gz 5.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for gatesolve 0.2.0
File Interpreter ABI Platform
gatesolve-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 11.9 kB

Release files / gatesolve-0.2.0.tar.gz

Download URL gatesolve-0.2.0.tar.gz
Size 5.4 kB
Tags Source
SHA-256 checksum
How to use checksums
a2df89c7cbba39043f7001b874b5d13af3bdd400ddffafd3e5d6b2c304047bfb
BLAKE2b-256 checksum
How to use checksums
0c36f24c50401adcbb361b8e7d802884368dedcf35f2a89de10bd4dd3d8fae49
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release files / gatesolve-0.2.0-py3-none-any.whl

Download URL gatesolve-0.2.0-py3-none-any.whl
Size 6.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
64a4907ca17e549c24c3d3743d59ff0a6359e3c99298f6d6434ec652abc48451
BLAKE2b-256 checksum
How to use checksums
cae2c846b1662fd030067e7dfa1d769610856f36b4b9c3fec1679d183fff8543
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page