Captcha bypass tutorials

Was this helpful?

How to solve Tencent captcha on OpenModel AI

Gregory Fisher
Gregory Fisher

Technical engineer

Introduction

OpenModel AI is a platform for working with artificial intelligence models. To protect authentication and registration processes, the site uses Tencent CAPTCHA. This is a behavioral captcha that often looks like a slider or a puzzle assembly task.

In this guide, we will break down how to get the necessary parameters, solve the captcha via the 2Captcha API, and correctly inject the received tokens (ticket and randstr) into the authorization page.

Task parameters

To bypass Tencent CAPTCHA on OpenModel AI, the TencentTaskProxyless task type is used (or TencentTask if your proxies are required).

json Copy
{
    "clientKey": "YOUR_API_KEY",
    "task": {
        "type": "TencentTaskProxyless",
        "appId": "196724674",
        "websiteURL": "https://console.openmodel.ai/auth",
        "captchaScript": "https://captchacdn.tencentcloudcs.com/TCaptcha-global.js"
    }
}

How to find parameters

websiteURL

This is the full address of the page where the captcha appears. In this case, it is the authorization page: https://console.openmodel.ai/auth

appId (CaptchaAppId)

This is the unique application identifier in Tencent Cloud.

  1. Open the authorization page and press F12 (Developer Tools).
  2. Go to the Network tab.
  3. Refresh the page or trigger the captcha to appear.
  4. In the filter, type tencent or captcha.
  5. Find the request to the captcha API or the initialization script. In the request parameters (Query String Parameters) or in the page source code (in the new TencentCaptcha('...', ...) call), you will find the appId value. For OpenModel AI, it is 196724674.

captchaScript (CRITICALLY IMPORTANT)

This is the URL of the JavaScript library that the site uses to display the captcha.

IMPORTANT: To correctly solve the captcha on this site, you must pass exactly https://captchacdn.tencentcloudcs.com/TCaptcha-global.js. Using the default standard script or any other URL will result in a solving error (ERROR_CAPTCHA_UNSOLVABLE) or the site rejecting the token.

How to find:

  1. On the Network tab, filter requests by JS type.
  2. Find the request loading the Tencent library (usually contains TCaptcha or tencentcloudcs).
  3. Copy the full URL of this script and pass it to the captchaScript parameter.

Code examples

Python + requests (Getting tokens)

This code sends a task to the API and returns the ready ticket and randstr tokens.

python Copy
import sys
import os
sys.path.append(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))

from twocaptcha import TwoCaptcha

api_key = os.getenv('APIKEY_2CAPTCHA', 'YOUR_API_KEY')
solver = TwoCaptcha(api_key)

try:
    result = solver.tencent(
        app_id='196724674',
        url='https://console.openmodel.ai/auth',
        captcha_script='https://captchacdn.tencentcloudcs.com/TCaptcha-global.js'
    )
    print("Captcha successfully solved!")
    print(f"Ticket: {result['ticket']}")
    print(f"Randstr: {result['randstr']}")
    
except Exception as e:
    print(f"An error occurred: {e}")

Python + Playwright (Browser automation)

When automating a browser, the received tokens must be injected into hidden form fields or a callback function must be called so the site recognizes the successful verification.

python Copy
import asyncio
from playwright.async_api import async_playwright
from twocaptcha import TwoCaptcha

API_KEY = 'YOUR_API_KEY'
APP_ID = '196724674'
PAGE_URL = 'https://console.openmodel.ai/auth'
CAPTCHA_SCRIPT = 'https://captchacdn.tencentcloudcs.com/TCaptcha-global.js'

async def solve_and_inject():
    solver = TwoCaptcha(API_KEY)
    
    try:
        # 1. Solve the captcha via API
        result = solver.tencent(
            app_id=APP_ID,
            url=PAGE_URL,
            captcha_script=CAPTCHA_SCRIPT
        )
        ticket = result['ticket']
        randstr = result['randstr']
        print(f"Captcha solved! Ticket: {ticket}, Randstr: {randstr}")
        
        async with async_playwright() as p:
            browser = await p.chromium.launch(headless=False)
            page = await browser.new_page()
            
            await page.goto(PAGE_URL)
            await page.wait_for_selector('iframe[src*="tencent"]', timeout=10000)
            
            # 2. Inject tokens into hidden fields (standard method for Tencent)
            await page.evaluate(f"""
                // Find and fill standard hidden Tencent fields
                const ticketInput = document.querySelector('input[name="ticket"]') || document.getElementById('ticket');
                const randstrInput = document.querySelector('input[name="randstr"]') || document.getElementById('randstr');
                
                if (ticketInput) ticketInput.value = '{ticket}';
                if (randstrInput) randstrInput.value = '{randstr}';
                
                // If the site uses a callback, try to call it
                if (typeof window.onTencentCaptchaSuccess === 'function') {{
                    window.onTencentCaptchaSuccess({{ ret: 0, ticket: '{ticket}', randstr: '{randstr}' }});
                }}
            """)
            
            # 3. Click the login/submit button (uncomment and adapt the selector to the real site)
            # await page.click('button[type="submit"]')
            
            await asyncio.sleep(5) # Pause for visual verification
            await browser.close()
            
    except Exception as e:
        print(f"Error: {e}")

asyncio.run(solve_and_inject())

Solution accuracy reports

If the site rejected the received tokens, be sure to report it via the reportIncorrect method. This helps the service improve its algorithms and refunds your funds for the failed attempt. If the tokens were successfully accepted, send reportCorrect.

You can submit a report via the API:

python Copy
import requests

API_KEY = "YOUR_API_KEY"
TASK_ID = "123456789" # Replace with the real task ID from the API response

# Report for an incorrect solution
requests.post(
    "https://api.2captcha.com/reportIncorrect",
    json={"clientKey": API_KEY, "taskId": TASK_ID}
)

# Report for a correct solution
requests.post(
    "https://api.2captcha.com/reportCorrect",
    json={"clientKey": API_KEY, "taskId": TASK_ID}
)

Detailed guide on submitting reports with examples for different languages: https://2captcha.com/h/how-to-submit-reports

Common errors and solutions

Error / Problem Cause Solution
ERROR_CAPTCHA_UNSOLVABLE Incorrect appId or, most often, incorrect captchaScript. Make sure you pass exactly https://captchacdn.tencentcloudcs.com/TCaptcha-global.js in the captchaScript parameter.
Tokens received, but the site does not let you in Tokens were not injected into the correct fields, or their lifespan expired. Inject ticket and randstr immediately after receiving them. Check via DevTools which exact input fields or callback functions the OpenModel AI form expects.
ERROR_WRONG_USER_KEY Invalid API key. Check that you are using the correct key from your 2Captcha dashboard.
ERROR_ZERO_BALANCE Insufficient funds on balance. Top up your account in your 2Captcha dashboard.