1. Which providers can take the task
A provider is a candidate when all of these hold:- it offers the captcha type;
- it accepts the task as sent, for example with your own proxy;
- the API key and the account don’t exclude it;
- it isn’t paused (see When a provider is unwell).
routing.providers, only those are candidates, unless routing.fallback is true.
2. Scores, per site
For each candidate the router keeps two measurements: how often its tokens work and how long it takes (the time within which 90% of its solves finish). Both are measured as close to your task as the data allows:- on the same captcha type, site and sitekey;
- else on the same captcha type and site;
- else on the captcha type anywhere;
- else a cautious starting value, for a provider with no history.
websiteURL: www.example.com and shop.example.com count as example.com.
3. Policies
The policy decides the order. It is a setting of the API key; the default isbalanced.
With the first three, a provider whose success on the site is poor is ranked after every provider that does well, whatever its price or speed. So
cheapest means the cheapest provider that works there.
4. Attempts and fallback
The router tries the first provider. What happens after a failure depends on the failure:
Three limits bound a task, all settings of the key: 3 attempts, 2 providers and 120 seconds by default. When they are used up, the task fails with the last error, or
TIMEOUT. When no provider can take the task at all, it fails with NO_PROVIDER_AVAILABLE, and the error message says why.
All of this happens inside your one request. A failed attempt, a retry and a fallback cost nothing: you pay once, for the provider that returned the token.
When a provider is unwell
A provider that fails several times in a row, or asks to be sent less, is paused for a short time. While paused it gets no tasks. Then it is sent one task as a test: if that works it is back, if not the pause gets longer. A provider’s bad hour therefore costs you a few slow tasks, not an hour of failures.How the router learns
- Every attempt counts. Each success, failure and solve time updates that provider’s figures for that site.
- Your reports count. A provider can return a token the site then refuses. Only you see that. Report it within an hour and it counts as a failure for that provider on that site.
- A small share of tasks explores. Now and then the router sends a task to the least-measured candidate first, so a provider that got better is noticed. Tasks with the policy
pinned, or with providers named in the request, are never used for this.
See the decision
Every answer of the native API is a receipt:provider is who solved it, cost is what you paid, and attempts lists each try in order with its provider, its duration and, for a failed one, the error code.
GET /v1/stats/providers, without a key.