API Tutorials

Improving OCR CAPTCHA Accuracy with CaptchaAI Settings

CaptchaAI provides parameters that tell the solver what to expect in an image CAPTCHA. Using these correctly can push accuracy beyond default levels.


Key Accuracy Parameters

Parameter Type Description
numeric 0/1/2 0 = no preference, 1 = numbers only, 2 = letters only
minLen int Minimum expected text length
maxLen int Maximum expected text length
regsense 0/1 1 = case-sensitive answer required
language int Language code (0 = not specified, 1 = Cyrillic, 2 = Latin)
textinstructions string Human-readable instructions for the solver
calc 0/1 1 = CAPTCHA contains a math equation

Numeric-Only CAPTCHAs

When the CAPTCHA only contains digits:

import requests
import os

API_KEY = os.environ["CAPTCHAAI_API_KEY"]


def solve_numeric_captcha(image_b64):
    """Solve a CAPTCHA that contains only numbers."""
    resp = requests.post("https://ocr.captchaai.com/in.php", data={
        "key": API_KEY,
        "method": "base64",
        "body": image_b64,
        "numeric": 1,     # Numbers only
        "minLen": 4,       # At least 4 digits
        "maxLen": 6,       # At most 6 digits
        "json": 1,
    }, timeout=30)
    return resp.json()


# Without numeric=1, solver might read "0" as "O" or "1" as "l"
# With numeric=1, these ambiguities are eliminated

Letters-Only CAPTCHAs

def solve_letters_only(image_b64):
    """Solve when CAPTCHA contains only letters."""
    resp = requests.post("https://ocr.captchaai.com/in.php", data={
        "key": API_KEY,
        "method": "base64",
        "body": image_b64,
        "numeric": 2,      # Letters only — no digits
        "regsense": 1,     # Case-sensitive
        "language": 2,     # Latin alphabet
        "json": 1,
    }, timeout=30)
    return resp.json()

Case Sensitivity

def solve_case_sensitive(image_b64):
    """Solve when the site validates case."""
    resp = requests.post("https://ocr.captchaai.com/in.php", data={
        "key": API_KEY,
        "method": "base64",
        "body": image_b64,
        "regsense": 1,    # Must preserve case
        "json": 1,
    }, timeout=30)
    return resp.json()

# Default (regsense=0): "AbCd" might return as "abcd"
# With regsense=1: "AbCd" returns as "AbCd"

Length Constraints

Setting min/max length eliminates impossible answers:

def solve_fixed_length(image_b64, length=6):
    """Solve when CAPTCHA text is always a fixed length."""
    resp = requests.post("https://ocr.captchaai.com/in.php", data={
        "key": API_KEY,
        "method": "base64",
        "body": image_b64,
        "minLen": length,
        "maxLen": length,  # Same value = exact length
        "json": 1,
    }, timeout=30)
    return resp.json()

Text Instructions

For complex CAPTCHAs, provide natural language hints:

def solve_with_instructions(image_b64, instructions):
    """Provide text instructions to guide the solver."""
    resp = requests.post("https://ocr.captchaai.com/in.php", data={
        "key": API_KEY,
        "method": "base64",
        "body": image_b64,
        "textinstructions": instructions,
        "json": 1,
    }, timeout=30)
    return resp.json()


# Examples of helpful instructions:
solve_with_instructions(b64, "Enter only the red characters")
solve_with_instructions(b64, "Type the 4-digit number shown")
solve_with_instructions(b64, "Enter the characters ignoring strikethrough lines")
solve_with_instructions(b64, "Solve the math equation and enter the result")

Language-Specific CAPTCHAs

# Language codes:
# 0 = not specified (default)
# 1 = Cyrillic (Russian, Ukrainian, etc.)
# 2 = Latin (English, French, etc.)

def solve_cyrillic(image_b64):
    resp = requests.post("https://ocr.captchaai.com/in.php", data={
        "key": API_KEY,
        "method": "base64",
        "body": image_b64,
        "language": 1,     # Cyrillic
        "json": 1,
    }, timeout=30)
    return resp.json()

Parameter Combination Patterns

Bank Security Code (6 digits)

params = {
    "numeric": 1,
    "minLen": 6,
    "maxLen": 6,
}

Forum Registration (mixed, case-sensitive, Latin)

params = {
    "regsense": 1,
    "language": 2,
    "minLen": 5,
    "maxLen": 8,
}

Math CAPTCHA

params = {
    "calc": 1,
    "textinstructions": "Solve the math expression",
}

Russian Text CAPTCHA

params = {
    "language": 1,
    "regsense": 0,
    "minLen": 4,
    "maxLen": 7,
}

Smart Parameter Detection

# auto_params.py

def detect_captcha_hints(page_html):
    """Auto-detect CAPTCHA parameters from the page."""
    hints = {}

    lower = page_html.lower()

    # Detect numeric hints
    if "digits" in lower or "numbers only" in lower:
        hints["numeric"] = 1
    elif "letters only" in lower:
        hints["numeric"] = 2

    # Detect length from input field
    import re
    maxlength = re.search(r'maxlength="(\d+)"', page_html)
    if maxlength:
        hints["maxLen"] = int(maxlength.group(1))

    # Detect case sensitivity
    if "case sensitive" in lower or "case-sensitive" in lower:
        hints["regsense"] = 1

    # Detect math
    if "solve" in lower and ("+" in page_html or "×" in page_html):
        hints["calc"] = 1

    return hints

Troubleshooting

Issue Cause Fix
Returns letters when only digits exist Missing numeric=1 Set numeric=1 for digit-only CAPTCHAs
Wrong case Missing regsense=1 Enable case sensitivity
Extra/fewer characters No length constraint Set minLen and maxLen
Wrong language characters Missing language Set language=1 (Cyrillic) or language=2 (Latin)
Math result wrong Missing calc=1 Enable calc mode for math CAPTCHAs

FAQ

Do these parameters cost extra?

No. All OCR parameters are included in the standard image CAPTCHA price.

What if I set wrong hints?

The solver may return lower-quality results. Only set parameters you're confident about. When in doubt, omit optional parameters.

Can I combine all parameters?

Yes. Use as many as apply simultaneously — numeric, regsense, minLen, maxLen, language, and textinstructions all work together.



Maximize OCR accuracy — start with CaptchaAI.

Discussions (0)

No comments yet.

Related Posts

API Tutorials Case-Sensitive CAPTCHA API Parameter Guide
How to use the regsense parameter for case-sensitive CAPTCHA solving with Captcha AI.

How to use the regsense parameter for case-sensitive CAPTCHA solving with Captcha AI. Covers when to use, comm...

Python Web Scraping Image OCR
Apr 09, 2026
API Tutorials Image CAPTCHA Base64 Encoding Best Practices
Best practices for base 64 encoding CAPTCHA images before submitting to Captcha AI.

Best practices for base 64 encoding CAPTCHA images before submitting to Captcha AI. Covers format, quality, si...

Python Web Scraping Image OCR
Apr 06, 2026
API Tutorials Custom CAPTCHA Types: Submitting Unusual Challenges to CaptchaAI
How to submit non-standard and custom CAPTCHA types to Captcha AI — drag-and-drop, slider, puzzle, audio, and custom interactive challenges.

How to submit non-standard and custom CAPTCHA types to Captcha AI — drag-and-drop, slider, puzzle, audio, and...

Python Web Scraping Image OCR
Feb 07, 2026
Tutorials Grid Image CAPTCHA: Coordinate Mapping and Cell Selection
Map grid image CAPTCHA cells to coordinates, extract the full grid, and solve re CAPTCHA-style image challenges with Captcha AI.

Map grid image CAPTCHA cells to coordinates, extract the full grid, and solve re CAPTCHA-style image challenge...

Python Web Scraping Image OCR
Jan 20, 2026
API Tutorials Math CAPTCHA Solving with CaptchaAI calc Parameter
Solve math CAPTCHAs using Captcha AI's calc parameter.

Solve math CAPTCHAs using Captcha AI's calc parameter. The API reads the equation and returns the computed res...

Python Web Scraping Image OCR
Apr 02, 2026
API Tutorials Phrase, MinLen, and MaxLen Parameters for Image CAPTCHA
Use phrase, min Len, and max Len parameters to constrain image CAPTCHA solving with Captcha AI and improve accuracy.

Use phrase, min Len, and max Len parameters to constrain image CAPTCHA solving with Captcha AI and improve acc...

Python Web Scraping Image OCR
Jan 09, 2026
API Tutorials CAPTCHA Image Preprocessing for Better Solve Rates
Preprocess CAPTCHA images using Python PIL to improve solve rates — grayscale conversion, noise removal, contrast enhancement, and binarization.

Preprocess CAPTCHA images using Python PIL to improve solve rates — grayscale conversion, noise removal, contr...

Python Web Scraping Image OCR
Mar 15, 2026
Use Cases Shipping and Logistics Rate Scraping with CAPTCHA Solving
Scrape shipping rates, tracking data, and logistics information from carrier websites protected by CAPTCHAs using Captcha AI.

Scrape shipping rates, tracking data, and logistics information from carrier websites protected by CAPTCHAs us...

Python reCAPTCHA v2 Cloudflare Turnstile
Jan 25, 2026
API Tutorials Multi-Character Image CAPTCHA Solving Strategies
Strategies for solving multi-character image CAPTCHAs — handling connected letters, overlapping characters, and distorted text with Captcha AI.

Strategies for solving multi-character image CAPTCHAs — handling connected letters, overlapping characters, an...

Python Web Scraping Image OCR
Jan 20, 2026
Use Cases Legal Research Web Scraping with CAPTCHA Handling
Scrape legal databases, court records, and case law from portals protected by CAPTCHAs using Captcha AI for automated legal research.

Scrape legal databases, court records, and case law from portals protected by CAPTCHAs using Captcha AI for au...

Python reCAPTCHA v2 Web Scraping
Jan 17, 2026
API Tutorials How to Solve reCAPTCHA v2 Enterprise with Python
Solve re CAPTCHA v 2 Enterprise using Python and Captcha AI API.

Solve re CAPTCHA v 2 Enterprise using Python and Captcha AI API. Complete guide with sitekey extraction, task...

Automation Python reCAPTCHA v2
Apr 08, 2026
API Tutorials Solving CAPTCHAs with Kotlin and CaptchaAI API
Complete guide to solving re CAPTCHA, Turnstile, and image CAPTCHAs in Kotlin using Captcha AI's HTTP API with Ok Http, Ktor client, and coroutines.

Complete guide to solving re CAPTCHA, Turnstile, and image CAPTCHAs in Kotlin using Captcha AI's HTTP API with...

Automation reCAPTCHA v2 Cloudflare Turnstile
Mar 06, 2026
API Tutorials Graceful Degradation When CAPTCHA Solving Fails
Keep your automation running when CAPTCHA solving fails — fallback strategies, queue-based retries, and degraded-mode patterns.

Keep your automation running when CAPTCHA solving fails — fallback strategies, queue-based retries, and degrad...

Automation Python All CAPTCHA Types
Apr 06, 2026