xtekky/gpt4free · error · RuntimeError
hCaptcha accessibility cookie required: log in at https://da
Error message
hCaptcha accessibility cookie required: log in at https://dashboard.hcaptcha.com/signup?type=accessibility in your browser, or pass hc_accessibility="...".
What it means
RuntimeError from ElevenLabs when no hCaptcha accessibility cookie is available. This provider drives a real browser (nodriver) against elevenlabs.io, which is gated by hCaptcha; the accessibility cookie (from signing up at hcaptcha.com's accessibility program) is the only bypass used. It checks kwargs['hc_accessibility'] first, then the browser cookie store for .hcaptcha.com; neither found means the flow cannot proceed.
Source
Thrown at g4f/Provider/audio/ElevenLabs.py:79
**kwargs,
) -> AsyncResult:
prompt = get_last_message(messages, prompt)
if not prompt:
raise ValueError("Prompt is empty.")
voice = audio.get("voice", cls.default_voice)
model_id = audio.get("model", cls.default_model)
output_format = audio.get("format", cls.default_format)
language = audio.get("language", cls.default_language)
# hcaptcha accessibility cookie — kwarg, then browser cookie store
cookie_val = kwargs.get("hc_accessibility")
if not cookie_val:
cookie_val = get_cookies(
".hcaptcha.com", raise_requirements_error=False
).get("hc_accessibility")
if not cookie_val:
raise RuntimeError(
"hCaptcha accessibility cookie required: log in at "
"https://dashboard.hcaptcha.com/signup?type=accessibility "
'in your browser, or pass hc_accessibility="...".'
)
browser, stop_browser = await get_nodriver(proxy=proxy)
try:
cookie_params = get_cookie_params_from_dict(
{"hc_accessibility": cookie_val}, domain=".hcaptcha.com"
)
await browser.cookies.set_all(cookie_params)
page = await browser.get(cls.url)
# Wait until DOM body exists before injecting elements
await page.evaluate(
"""
document.body || new Promise(r => {
document.addEventListener('DOMContentLoaded', r, {once: true});View on GitHub (pinned to 973504e177)
Solutions
- Sign up at https://dashboard.hcaptcha.com/signup?type=accessibility in your browser, then retry so the cookie is harvested
- Pass the cookie directly: create(..., hc_accessibility='your-cookie-value')
- Re-obtain the cookie if it expired and pass it via the kwarg on servers without a browser
- Use an ElevenLabs API-key provider variant instead of the browser-based one for production
Example fix
# before resp = await client.speech.create(model='ElevenLabs', text='hi') # after resp = await client.speech.create(model='ElevenLabs', text='hi', hc_accessibility=os.environ['HC_ACCESSIBILITY'])
Defensive patterns
Strategy: validation
Validate before calling
import os
def has_hcaptcha_cookie():
return bool(os.getenv('HC_ACCESSIBILITY')) # if you pass it explicitly
# else: first run will lack it — expect RuntimeError once, then browser cookie exists Try / catch
try:
resp = await client.speech.create(model='ElevenLabs', text=text)
except RuntimeError as e:
if 'hCaptcha accessibility cookie' in str(e):
raise ConfigError('run hcaptcha accessibility signup once, or pass hc_accessibility') Prevention
- Enroll in hCaptcha accessibility once per environment and store the cookie value in secret management
- Pass hc_accessibility explicitly on servers without a browser
- Remember the cookie expires periodically — automate refresh or alert on this error
When it happens
Trigger: First-time use on a machine with no prior hcaptcha.com accessibility login in the browser, and no hc_accessibility kwarg passed; or browser profile/cookies cleared.
Common situations: Headless servers and CI (no browser cookies); users who never enrolled in hCaptcha's accessibility program; cookie expiring (accessibility cookies periodically rotate and must be refreshed).
Related errors
- No audio chunks received from ElevenLabs.
- No Yupp accounts configured. Set YUPP_API_KEY environment va
- Prompt is empty.
- GitHub Copilot OAuth not configured. Please run 'g4f auth gi
- NO_TOKEN
AI-assisted analysis of xtekky/gpt4free@973504e177 (2026-08-14).
Data as JSON: /api/errors/6e9ce1884d5ef430.
Report an issue: GitHub.