Skip to content

Smart Routing

Every CAPTCHA task submitted to uCaptcha is routed through a scoring algorithm that evaluates all available providers and selects the best one based on speed, cost, and reliability. The router adapts in real time using observed performance data, ensuring optimal provider selection for every request.

The routing algorithm executes the following steps for each incoming task:

  1. Gather candidates — Identify all providers that support the requested task type.
  2. Collect real-time stats — For each candidate, retrieve current metrics:
    • Cost: Per-task cost based on an EWMA (exponentially weighted moving average) of observed pricing
    • Speed: Rolling average solve time from recent completions
    • Reliability: Success rate over the recent window
  3. Apply Pareto filter — Remove any provider that is both slower and more expensive than another candidate. Only non-dominated providers remain.
  4. Score remaining candidates:
    • Normalize cost and speed values to a 0-1 range across the candidate set
    • Calculate baseScore = (speedWeight / 100) * speedScore + (costWeight / 100) * priceScore
    • Calculate reliabilityMultiplier = 0.3 + 0.7 * (successRate / 100)
    • Final score: totalScore = baseScore * reliabilityMultiplier
  5. Apply recycle bias — If the user has a recycled provider API key with remaining balance, boost that provider’s score by up to 15%.
  6. Route — Send the task to the highest-scoring provider.

Each API key has a speed/cost priority value from 0 to 100 that controls the tradeoff between fast and cheap:

ValueBehavior
0Cheapest providers preferred
50Balanced (default)
100Fastest providers preferred

The slider maps directly to the speedWeight in the scoring formula. A costWeight is derived as 100 - speedWeight. At value 50, speed and cost contribute equally to the score.

Each API key has independent routing configuration. This allows you to run multiple strategies simultaneously:

  • One key optimized for speed (high-priority scraping)
  • Another key optimized for cost (batch processing)
  • A third with custom settings for a specific use case

Configure routing per key in the Telegram Mini App under the API tab.

Override routing behavior on a per-request basis using the selectionMode parameter in your createTask call:

Selection ModeSpeed WeightDescription
autoCheapest10Strongly prefer cheapest provider
autoFastest90Strongly prefer fastest provider
autoMostReliable50Balanced, but reliability has standard weight
priority50Same as autoMostReliable
{
"clientKey": "YOUR_API_KEY",
"task": {
"type": "ReCaptchaV2TokenProxyLess",
"websiteURL": "https://example.com",
"websiteKey": "6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-"
},
"selectionMode": "autoFastest"
}

If you need to bypass routing entirely and send a task to a specific provider, use the provider parameter:

{
"clientKey": "YOUR_API_KEY",
"task": {
"type": "ReCaptchaV2TokenProxyLess",
"websiteURL": "https://example.com",
"websiteKey": "6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-"
},
"provider": "capsolver"
}

Valid provider identifiers: 2captcha, capsolver, anticaptcha, capmonster, multibot, ucaptcha.

When you submit your own provider API keys through Key Recycling, the routing algorithm gives a small preference (up to 15% score boost) to providers where your recycled key has remaining balance. This maximizes utilization of your existing provider balances while still maintaining intelligent routing.

The bias is capped to prevent recycled keys from overriding a significantly better provider choice. If another provider scores substantially higher on speed, cost, or reliability, the router will still select it.

If the selected provider fails to accept or solve a task, uCaptcha does not automatically retry with a different provider. The failure is returned to the caller. To implement retry logic with a fallback provider, resubmit the task and optionally exclude the failed provider or force a different one using the provider parameter.