Most "hcaptcha-challenger not working" reports in 2026 come from one change: the project no longer ships local image models. It now sends hCaptcha challenges to Google's Gemini models, so it needs a GEMINI_API_KEY, a compatible google-genai package and the new AgentV API. Code written for the old install()/solve() functions fails on import, and a missing or quota-limited key fails before any challenge is solved.
Below: the exact errors and what they mean, how to set up the current version, the open issues you may be hitting, and what the tool cannot do. One honest note up front: NSLSolver does not solve hCaptcha. We cover what it does solve, and when that matters, at the end. Facts about hcaptcha-challenger come from its docs, source, PyPI and GitHub issues, checked 2026-12-01.
Quick answer: match your error to the fix
These are the messages hcaptcha-challenger users paste into search. Find yours, then jump to the matching section.
- GEMINI_API_KEY is required but not provided. Please either pass it directly or set the GEMINI_API_KEY environment variable.
- AgentConfig found no key. Create a key at aistudio.google.com/apikey and put GEMINI_API_KEY in the environment or a .env file in the working directory (issue #1091 shows it as a ValidationError).
- ImportError: cannot import name 'install' from 'hcaptcha_challenger'
- You are following a tutorial for the old, local-model API. That API was removed. Use AgentV and AgentConfig from hcaptcha_challenger.agent (code below).
- AttributeError: 'BaseApiClient' object has no attribute '_async_httpx_client'
- A google-genai compatibility problem reported with 0.19.0 and google-genai 1.56.0 (issue #1090, open). Print your versions, read the issue thread for a working combination, or try the main branch, which has changes that are not on PyPI yet.
- int() argument must be a string, a bytes-like object or a real number, not 'dict'
- Reported in the same issue (#1090). Same fix: check versions and follow the open issue.
- HSW reverse failed, fallback to regular processing
- A warning, not a crash. The tool falls back to its normal path. If solving also fails, the cause is elsewhere (see #1090, #1091, #1093).
- Cannot find a valid challenge frame
- The agent could not locate the hCaptcha challenge iframe or its task images. Make sure the checkbox was clicked and the challenge is visible; issues #1063 and #1076 (open) track this.
- Challenge execution timed out / Wait for captcha response timeout
- The model or the page took longer than the configured timeouts. Raise EXECUTION_TIMEOUT and RESPONSE_TIMEOUT, and check your Gemini quota.
- Loops forever on "Select the immobile object"
- A challenge type the agent keeps failing (issue #1093, open). Cap your retries and request a fresh challenge instead of looping.
Error strings are quoted from the hcaptcha-challenger source and GitHub issues; versions from PyPI and GitHub releases, checked 2026-12-01. Sources are listed at the end of the article.
What hcaptcha-challenger is in 2026
hcaptcha-challenger (github.com/QIN2DIM/hcaptcha-challenger, GPL-3.0, not archived) automates hCaptcha challenges in a Playwright page. Earlier versions used locally trained image models; the current docs explain why that stopped: hCaptcha "can implement extremely frequent updates to its challenge types", which made trained models "quickly obsolete or ineffective". The project now relies on the "spatial chain-of-thought (SCoT) reasoning capabilities of multimodal large language models", in practice Gemini, and requires a GEMINI_API_KEY.
The latest PyPI release is 0.19.0 (uploaded 2025-12-21, tagged on GitHub 2026-01-05). It requires Python 3.10 or newer and depends on google-genai and playwright. The main branch kept moving after that release: commit 28ee79b on 2026-08-15 updated the default models (#1101). So a fresh pip install and a git checkout can behave differently.
The README lists which hCaptcha challenge types are covered:
| Challenge type | Supported (README) |
|---|---|
| image_label_binary | Yes |
| image_label_area_select: point | Yes |
| image_drag_drop | Yes |
| image_label_area_select: bounding box | No |
| image_label_multiple_choice | No |
Source: hcaptcha-challenger README, checked 2026-12-01.
Fix 1: install the current version and check your dependencies
Start by printing the three versions that matter. Many errors in the open issues come from mixing a release with a newer google-genai, or from code written for an older hcaptcha-challenger. Note that there is no [playwright] extra (users tried pip install hcaptcha-challenger[playwright] in #1091); playwright is already a core dependency, and the optional extras are camoufox, dataset and server.
If you hit the google-genai errors from issue #1090 ('_async_httpx_client' or the int() TypeError), read that thread before changing anything: it is open, and the fix depends on the exact versions. Installing from the main branch (uv pip install git+https://github.com/QIN2DIM/hcaptcha-challenger.git) gets you the post-release changes, at the cost of running unreleased code.
# Which versions are you actually running?
python -c "import importlib.metadata as m; [print(p, m.version(p)) for p in ('hcaptcha-challenger', 'google-genai', 'playwright')]"
# Current install (the project docs use uv; plain pip works the same way)
uv pip install -U hcaptcha-challenger
# Playwright needs a browser binary once per machine (standard Playwright step)
playwright install chromiumFix 2: give it a Gemini key (and expect to pay for it)
AgentConfig is a pydantic settings class, so it picks up GEMINI_API_KEY from the environment or from a .env file in the directory you run from. If neither has it, you get "GEMINI_API_KEY is required but not provided..." before the browser does anything. The same class reads the timeouts and model names, so you can change them without touching code.
Budget for the key. Issue #1097 (open) notes that Google discontinued the older Gemini models the tool used and that "the new models, however, are not free". Every challenge round is one or more model calls, so cost and rate limits scale with the number of challenges, and a quota error looks like a solving failure unless you read the logs.
# .env in the working directory (AgentConfig is a pydantic BaseSettings class,
# so it reads these from the environment or from .env)
GEMINI_API_KEY=your-key-from-aistudio.google.com
# Optional overrides, named as in agent/challenger.py:
# EXECUTION_TIMEOUT=...
# RESPONSE_TIMEOUT=... # seconds; used in "Wait for captcha response timeout"
# RETRY_ON_FAILURE=...
# CHALLENGE_CLASSIFIER_MODEL=...
# IMAGE_CLASSIFIER_MODEL=...
# SPATIAL_POINT_REASONER_MODEL=...
# SPATIAL_PATH_REASONER_MODEL=...Fix 3: migrate old code to AgentV
If your script starts with from hcaptcha_challenger import install, or calls solve() on a local model, it targets an API that no longer exists, hence "ImportError: cannot import name 'install'". The current entry point is AgentV: click the checkbox through agent.robotic_arm, wait for the challenge, then read the CaptchaResponse objects in agent.cr_list. The example below follows the project's own docs and opens its test page first, so you can confirm your setup before pointing it at anything else.
import asyncio
from playwright.async_api import Page, async_playwright
from hcaptcha_challenger.agent import AgentConfig, AgentV
from hcaptcha_challenger.utils import SiteKey
async def challenge(page: Page) -> AgentV:
agent_config = AgentConfig() # reads GEMINI_API_KEY from env / .env
agent = AgentV(page=page, agent_config=agent_config)
await agent.robotic_arm.click_checkbox()
await agent.wait_for_challenge()
return agent
async def main():
async with async_playwright() as p:
browser = await p.chromium.launch(headless=False)
page = await browser.new_page()
# The project's own test page; swap in your page once this works
await page.goto(SiteKey.as_site_link(SiteKey.user_easy))
agent = await challenge(page)
if agent.cr_list:
print(agent.cr_list[-1]) # the last CaptchaResponse
else:
print("no captcha response captured")
await browser.close()
asyncio.run(main())Fix 4: frames, timeouts and challenge loops
- "Cannot find a valid challenge frame": the agent looks for the challenge iframe and the task images (issues #1063 and #1076 report the //div[@class='task-image'] locator failing). Run headed first, confirm the checkbox click opened a challenge, and make sure nothing (a cookie banner, a modal) covers it.
- "Challenge execution timed out" or "Wait for captcha response timeout": the model calls or the page were slower than the configured limits. Raise EXECUTION_TIMEOUT and RESPONSE_TIMEOUT, and check whether your Gemini quota is the real bottleneck.
- Endless retries on one prompt ("Select the immobile object", #1093): cap retries in your own loop and reload the page for a fresh challenge.
- Unsupported types: bounding-box area selection and multiple choice are not supported per the README. When one appears, refresh rather than wait.
- Production pages are harder than the demo. Sites can raise hCaptcha difficulty for traffic they distrust, so test with the IP and browser profile you will really use.
Limits you cannot configure away
hcaptcha-challenger is an honest, actively developed project, but its design has fixed costs. It needs a real browser page, a paid model API and a round trip to the model for each challenge image set. Its accuracy depends on how well the current Gemini models handle whatever challenge types hCaptcha serves that week, which the project itself describes as frequently changing. Several of the issues above were still open on 2026-12-01.
Use it on sites you own or are authorised to test, and plan for failures: retry with a fresh challenge, log every response, and keep a fallback path.
Is it really hCaptcha? Check before you fix
A surprising number of "hcaptcha-challenger fails on site X" problems are not hCaptcha at all. Many sites have moved to Cloudflare Turnstile or reCAPTCHA, or show different widgets on different pages. Check the page source: hCaptcha loads from js.hcaptcha.com, Turnstile from challenges.cloudflare.com, reCAPTCHA from google.com/recaptcha or recaptcha.net.
import re
import requests
html = requests.get("https://your-site.example.com/signup", timeout=30).text
checks = {
"hCaptcha": r"js\.hcaptcha\.com|hcaptcha\.com/1/api\.js|class=\"h-captcha\"",
"Cloudflare Turnstile": r"challenges\.cloudflare\.com/turnstile|class=\"cf-turnstile\"",
"reCAPTCHA": r"google\.com/recaptcha|recaptcha\.net/recaptcha|grecaptcha",
}
for name, pattern in checks.items():
if re.search(pattern, html):
print("found:", name)When an API makes sense (and what NSLSolver does not do)
To be clear: NSLSolver does not solve hCaptcha, and neither this guide nor our API offers a workaround for it. If your target uses hCaptcha, keep hcaptcha-challenger, or check a hosted provider's current list of supported types before building on it.
NSLSolver solves Cloudflare Turnstile, the Cloudflare Challenge (cf_clearance), reCAPTCHA v3 and Enterprise, Kasada and Akamai (beta), with no browser on your side: one POST to https://api.nslsolver.com/solve with your X-API-Key. If the detection script above shows Turnstile, see our Cloudflare Turnstile solver API: about 250 ms on average, $0.80 per 1,000 solves, only successful solves billed. For score-based Google widgets, see reCAPTCHA v3 and Enterprise; for "Just a moment..." pages, the cf_clearance cookie guide. Sign-ups with Google, Gmail or Proton get free trial credit, no card needed.
import requests
# Only for pages that load Cloudflare Turnstile. NSLSolver does NOT solve hCaptcha.
resp = requests.post(
"https://api.nslsolver.com/solve",
headers={"X-API-Key": "YOUR_API_KEY"},
json={
"type": "turnstile",
"site_key": "0x4AAAAAAA...", # data-sitekey of the cf-turnstile widget
"url": "https://your-site.example.com/signup",
},
timeout=120,
)
data = resp.json()
print(data["token"]) # submit as cf-turnstile-response; single use, valid for 300 secondsRelated guides
- Open-source CAPTCHA solvers in 2026: every protection type, what works and how well it is maintained.
- Types of CAPTCHA in 2026: how hCaptcha, Turnstile and reCAPTCHA differ.
- Buster and reCAPTCHA audio solvers not working: the reCAPTCHA v2 counterpart of this guide.
- Cloudflare Turnstile solver API: if the page actually uses Turnstile.
- Pay-per-solve pricing: Turnstile $0.80 per 1,000; failed solves are free.
Sources (checked 2026-12-01)
- GitHub: QIN2DIM/hcaptcha-challenger
- hcaptcha-challenger docs (install, GEMINI_API_KEY, AgentV example)
- GitHub releases (v0.19.0, 2026-01-05)
- PyPI: hcaptcha-challenger 0.19.0
- Source: agent/challenger.py (AgentConfig, error strings)
- Issue #1090: google-genai errors with 0.19.0
- Issue #1091: GEMINI_API_KEY / ImportError install
- Issue #1093: retry loop on one prompt
- Issue #1097: old Gemini models discontinued
- Issue #1063: cannot find a valid challenge frame
- Cloudflare: Turnstile server-side validation