API Usage & Credits

Overview

The LMCS API provides multiple link correction methods depending on your needs. You can choose to use our combined endpoint, or query engines individually.

URL matching endpoint

Endpoint URL: https://faray.tech/api/lmcscloud/urls/match/best

This endpoint combines request validation, fast algorithmic matching, and fallback LLM matching into a single flow.

The request validation ensures that URLs which are commonly visited by automated bots, that constantly scan the internet, are not matched.

Pricing

Cost calculation

The cost is dynamic, you only pay for the phases that are actually executed. $0.0001 equals 1 credit.

The amount of characters that make up parts of the cost are calculated by accumulating:

  1. Sum of characters from the list of discoverable pages on your website
  2. Amount of characters from the incorrect URL the user has entered
mode value Validation phase Algorithm phase LLM phase
standard 1 credit 1 credit per 3,000 characters 1 credit per 500 characters
fast 1 credit 1 credit per 3,000 characters 3 credits per 500 characters
enhanced 1 credit 1 credit per 3,000 characters 15 credits per 500 characters
aggressive 1 credit 1 credit per 3,000 characters 15 credits per 500 characters

Cost calculation examples

We make the following assumptions:

  • mode standard is being used.
  • 60% of requests get thrown out at the validation phase.
  • 25% succeed at the algorithm phase.
  • the remaining 15% of requests reach the LLM phase.

Examples:

  • A normal corporate website like netcom-cs.de contain page names totalling about 2,500 characters.
    Realistic usage scenario (7k API requests per month): $1.4
  • Websites with lots of blog articles like nano-control.org contain page names totalling about 15,000 characters.
    Realistic usage scenario (7k API requests per month): $4.6
  • Large e-commerce sites like oceansapart.com contain page names totalling about 40,000 characters (when only using the page names from one language for the link correction) or 150,000 characters (using page names from all available languages for the link correction).
    Realistic usage scenario (133k API requests per month): $738.2

The amount of characters the user has entered in the URL is about 65 characters on average, which is negligible.

These sites are the property of their respective owners and are not affiliated with Faray Technologies. These sites have not endorsed the use of LinkAutocorrect.

Rate-limits

Same rate-limits as the LLM-only endpoint.

Rate limit level Limits
Level 1 20 RPM | 150 RPH | 1,000 RPW
Level 2 50 RPM | 500 RPH | 10,000 RPW
Level 3 (default) 100 RPM | 1000 RPH | 10,000 RPD
Level 4 (available upon request) 200 RPM | 5000 RPH | 100,000 RPD
Level 5 500 RPM | 25000 RPH | 500,000 RPD

All faray.tech accounts have rate limit level 3 selected by default. You can manually set stricter rate limits if you prefer to do so. Please Contact us if you need a higher rate limit. After your rate limit level has been set to level 4 or higher, you cannot manually lower it.

Requests are counted with a sliding time window. This is different compared to a fixed time window that would reset to zero after the time period is over.

The amount of pages on your website and the selected mode do not affect the rate limit.

Input arguments

The endpoint accepts a JSON payload with the following arguments:

Parameter Type Required Description
input String Yes The incorrect URL path that the user attempted to visit.
pages Array or String Yes A list of valid, discoverable pages on your website. Can be an array of strings or one large newline-separated string. Maximum 10,000 pages.
mode String No Set the operation mode. Must be one of: standard, fast, enhanced, or aggressive. Defaults to standard.
algo String No Set the algorithm to use. Defaults to matchcore. Alternatively, you can specify damerau_levenshtein, or jaro_winkler.
provider String No Set the LLM provider to use. Defaults to auto. Alternatively, you can specify oai, google, or groq as the provider to use, however requests will simply fail if the selected provider has an outage.
user_ua String No The User-Agent of the client to validate against blocklists.
strip_exts Array No File extensions to strip from the each page name before matching.
reject_exts Array No File extensions that should cause pages to not be considered for matching.
block_output String No Configures the amount of additional information that is output for requests which failed the validity checks. Options: normal, standard, omit, debug.
validation_mode String No Limits request validation scope. Options: normal, uaonly (only verify the User-Agent), bponly (only verify the input path).
cms_installed Array No A list of CMS systems installed on your server (e.g., ["wp", "typo3"]) to set predefined path exclusions.

JSON Output

The endpoint returns a complex JSON response containing the match results, validity checks, and detailed metadata.

Field Type Description
success Boolean Returns true if the request was processed successfully.
validity Boolean Returns true if the request passed validation, or false if it was blocked.
match Boolean Returns true if a corrected URL was identified.
output String The correct URL path. If no match is found, this will return "404".
input String The original incorrect URL path provided in the request.
blockreason String (Optional) The reason the request was blocked (e.g., "blockedua", "blockedpath").
blockedfor Array (Optional) The specific rules that triggered the block.
error String (Optional) Contains an error message if the request failed.
metadata Object Detailed metadata about the request execution. .
Meta Field Type Description
pages_amount Integer The number of pages processed.
cms_installed Array The validated list of CMS systems used for path blocking.
blocklists ObjectInformation about the blocklists used. Format: filename => hash:%rules (the xxh3 hash of our internal block list file, useful to track changes over time, followed by the amount of rules).
strip_extensions / reject_extensions Array The sanitized extensions used during processing.
similarity_threshold / distance_threshold Float (Optional) The similarity score/distance threshold above which the match status is set to true.
distance_metric / distance_metric Float (Optional) Similarity score/distance to the best candidate.
provider String (Optional) The LLM provider used (e.g., "oai").
latency_ms Integer Total processing time in milliseconds.
cost Integer Total credits consumed by the request.
method String The engine that found the match: "none", "algo", or "llm".
mode String The mode used for the request.

Example responses

Example Output 1 (successful match)

(
    [success] => true
    [validity] => true
    [match] => true
    [output] => /get-in-touch-with-us
    [input] => /contact.html
    [metadata] =>
        (
            [pages_amount] => 3
            [cms_installed] => ['wp']
            [blocklists] =>
                (
                    [blockedua] =>
                        (
                            [commonbots-fullstring-hashed.txt] => df8e1326ad3014b3:%43
// Format: filename => xxh3 hash of that file:%amount-of-rules
                            [maliciousbots-fullstring-hashed.txt] => 97f5413a457aa694:%15
                            [maliciousbots-wildcard-hashed.txt] => 4a810bf527d20875:%14
                        )

                    [blockedpaths] =>
                        (
                            [arguments.txt] => 3126634b36652552:%10
                            [config-anywhere-block.txt] => 72f37d1fb5898179:%86
                            [general-anywhere-hardblock.txt] => 56a4cc45348b0bbe:%390
                            [general-rootdir-softblock.txt] => c8cede5cc5e5fc38:%791
                            [typo3.txt] => 2bcb0804b1e96067:%12
                            [wp.txt] => d60249f2ea529a58:%35
                        )
                )
            [strip_extensions] => []
            [reject_extensions] => []
            [similarity_threshold] => 0.85
            [similarity_metric] => 0.5577
            [provider] => oai
            [latency_ms] => 1344
            [cost] => 3
            [method] => llm
            [mode] => standard
        )
)

Example Output 2 (blocked request)

(
    [success] => true
    [validity] => false
    [match] => false
    [blockreason] => blockedpath
    [blockedfor] =>
        (
            [0] => /(^|\/).*\.env($|\/)/i
        )
    [blockedpaths] =>
        (
            [0] => /.env
            [1] => /.env.backup
        )
    [output] => 404
    [input] => /.env
    [metadata] =>
        (
            [pages_amount] => 4
            [cms_installed] => []
            [blocklists] =>
                (
                    [blockedua] =>
                        (
                            [commonbots-fullstring-hashed.txt] => df8e1326ad3014b3:%43
                            [maliciousbots-fullstring-hashed.txt] => 97f5413a457aa694:%15
                            [maliciousbots-wildcard-hashed.txt] => 4a810bf527d20875:%14
                        )
                    [blockedpaths] =>
                        (
                            [arguments.txt] => 3126634b36652552:%10
                            [config-anywhere-block.txt] => 72f37d1fb5898179:%86
                            [general-anywhere-hardblock.txt] => 56a4cc45348b0bbe:%390
                            [general-rootdir-softblock.txt] => c8cede5cc5e5fc38:%791
                            [typo3.txt] => 2bcb0804b1e96067:%12
                            [wp.txt] => d60249f2ea529a58:%35
                        )
                )
            [strip_extensions] => []
            [reject_extensions] => []
            [latency_ms] => 31
            [cost] => 1
            [method] => none
            [mode] => enhanced
        )
)

Algorithm-only URL matching endpoint

Endpoint URL: https://faray.tech/api/lmcscloud/urls/match/algo

This endpoint provides blazing fast, algorithmic link matching without validation steps. Our proprietary string-matching algorithm "matchcore" spanning across over 800 lines of code is rivaling the accuracy of LLMs for this use-case while being highly cost-efficient. The success rate of matchcore is way ahead of typical fuzzy string-matching algorithms. We can only recommend to try it out for yourself.

Pricing

The cost for an API request is 1 credit for every 3,000 characters.

The character count is the sum of characters from the list of discoverable pages plus the characters from the incorrect URL.

Response latency

This API endpoint is optimal for low-latency applications where consistent response times are crucial. Response times for requests larger than 200,000 bytes can exceed one second but always stay below five seconds.

Rate-limits

This endpoint offers significantly higher rate limits.

Rate limit level Limits
Level 1 50 RPM | 500 RPH | 10,000 RPW
Level 2 100 RPM | 1000 RPH | 10,000 RPD
Level 3 (default) 200 RPM | 5000 RPH | 100,000 RPD
Level 4 1000 RPM | 30000 RPH | 500,000 RPD
Level 5 3000 RPM | 100000 RPH | 2,500,000 RPD

Input arguments

The endpoint accepts a JSON payload with the following arguments:

Parameter Type Required Description
input String Yes The incorrect URL path that the user attempted to visit.
pages Array or String Yes A list of valid, discoverable pages on your website. Can be an array of strings or one large newline-separated string. Maximum 50,000 pages.
algo String No The algorithm to use (matchcore, damerau_levenshtein, jaro_winkler). Defaults to matchcore.

JSON Output

The endpoint returns a JSON response containing the match results and algorithmic metadata.

Field Type Description
success Boolean Returns true if the request was processed without any fatal errors.
match Boolean Returns true if a corrected URL was successfully identified based on the algorithm's threshold.
output String The corrected URL path. If no match is found, this will return "404".
input String The original incorrect URL path provided in the request.
metadata Object Metadata including pages_amount, similarity_threshold, similarity_metric, latency_ms, cost, and mode.

Example Output

(
    [success] => true
    [match] => true
    [output] => /us/en/printers/pagewide/managed-p55250dw
    [input] => /us/en/printers/widepage/mangaet-p55250dw
    [metadata] =>
        (
            [pages_amount] => 6
            [similarity_threshold] => 0.85
            [similarity_metric] => 0.9863
            [latency_ms] => 48
            [cost] => 1
            [mode] => standard
        )
)

The brand PageWide is the property of HP Inc. which is not affiliated with Faray Technologies.

LLM-only URL matching endpoint

Endpoint URL: https://faray.tech/api/lmcscloud/urls/match/llm

This endpoint directly queries the LLM engine.

Pricing

The cost changes depending on the mode value that you have configured.

mode value Cost multiplier
standard 1x
fast 3x
enhanced 15x
aggressive 15x

Common API requests from websites with 100 pages cost about 0.2 cents. Given that most 404 errors can be resolved with other link correction methods, this is incredibly cheap.

You will not be charged for failed API requests.

Response latency

The delay between the API request and the response differs greatly depending on the amount of characters in the API request (see calculation above) and varies between each provider.
The response times should stay below 5 seconds if you keep the provider option set to auto.
We typically see a response time of 2 seconds for mode fast and 4 seconds otherwise.
Response times from our API will never exceed 30 seconds.

Request size limits

One character like c typically counts as one byte. Some characters like emojis 🌳 count as multiple bytes. However this shouldn't be relevant since emojis normally don't occur within URLs.

Provider /
modevalue
auto OpenAI Google Groq
standard 395.000 bytes 395.000 bytes 395.000 bytes N/A
fast 395.000 bytes 395.000 bytes 395.000 bytes 60.000 bytes
enhanced 1.000.000 bytes 395.000 bytes 1.000.000 bytes 120.000 bytes
aggressive 1.000.000 bytes 395.000 bytes 1.000.000 bytes 120.000 bytes

All LLM-type endpoints feature a limit of 10,000 pages.

The size of a specific request does not affect your rate limit.

Rate-limits

Rate limit level Limits
Level 1 20 RPM | 150 RPH | 1,000 RPW
Level 2 50 RPM | 500 RPH | 10,000 RPW
Level 3 (default) 100 RPM | 1000 RPH | 10,000 RPD
Level 4 (available upon request) 200 RPM | 5000 RPH | 100,000 RPD
Level 5 500 RPM | 25000 RPH | 500,000 RPD

Providers

We use external LLM providers to access cost-efficient and the most cutting-edge models.

By default, the provider option is set to auto which ensures that all API requests are answered successfully, even if a provider is experiencing an outage.
You can also manually choose between one of the following providers:

  • OpenAI
  • Google
  • Groq (not to be confused with Grok)

Input arguments

The endpoint accepts a JSON payload with the following arguments:

Parameter Type Required Description
mode String Yes The correction mode to use. Must be one of: standard, fast, enhanced, or aggressive.
input String Yes The incorrect URL path that the user attempted to visit.
pages Array or String Yes A list of valid, discoverable pages on your website. Can be an array of strings or one large newline-separated string. Maximum 10,000 pages.
provider String Yes The LLM provider to process the request.

JSON Output

The endpoint returns a JSON response containing the match results and metadata. Below is a detailed breakdown of the output fields:

Field Type Description
success Boolean Returns true if the request was processed without any fatal errors, even if no match was found.
match Boolean Returns true if a corrected URL was successfully identified.
output String The corrected URL path. If no match is found, this will return "404".
input String The original incorrect URL path provided in the request.
error String Contains an error message if the request failed (e.g., rate limit exceeded, invalid input). Omitted or null if successful.
metadata Object Metadata about the request execution. Includes cost (credits consumed), pages_amount (number of pages processed), and latency_ms (processing time in milliseconds).

Example Output

(
    [success] => true
    [match] => true
    [output] => /us/en/printers/
    [input] => /us/en/copy-machines
    [metadata] =>
        (
            [pages_amount] => 5
            [provider] => oai
            [latency_ms] => 1631
            [cost] => 1
            [mode] => standard
        )
)