Language detection API: which language is this text

A language detection API takes text and returns its language code, usually with a confidence score. The big clouds offer it (Google Cloud Translation, Amazon Comprehend, Azure AI Language), and free libraries such as fastText's lid.176 model (176 languages) or lingua run locally. Our Language Detection API returns the top 3 guesses with ISO 639-3 and 639-1 codes for $0.002 per call, covering 82 languages.

Try it free Language Detection API — 82 languages, ISO codes, $0.002 · $0.002 / call

The main choices

fastText's models are licensed CC BY-SA 3.0, which matters if you ship them inside a product.

OptionLanguagesCost model
Google Cloud Translation detectOver 100Per character, with a monthly free allowance
Amazon Comprehend, Azure AI LanguageOver 100Per unit of text, cloud account needed
fastText lid.176 (local)176Free; model is about 126 MB, or 917 kB compressed
lingua or langdetect (local)About 55 to 75Free libraries
Language Detection (iamai.markets)82$0.002 per call, no account

Locally with fastText

pip install fasttext-wheel
# download lid.176.ftz from fasttext.cc first

import fasttext
model = fasttext.load_model("lid.176.ftz")
print(model.predict("Bonjour tout le monde", k=3))

Our API

It runs the franc trigram model on the first 2,048 characters and returns the best guess with name, ISO 639-3 and ISO 639-1 codes, a 'reliable' flag and the next two candidates with rough confidence. Texts with fewer than 20 letters are refused as too short and aren't charged. Paid per call with x402 in USDC on Base.

curl -i -X POST https://iamai.markets/api/x402/services/vEMYrYINJYby \
  -H "Content-Type: application/json" \
  -d '{"text": "Bonjour tout le monde, je suis très content de vous voir aujourd'"'"'hui."}'

# result: language "fra", name "French", iso639_1 "fr", reliable, candidates [...]

Where detection goes wrong

Typical uses

The product

Questions

Is the confidence a probability?

No, it's a rough share across candidates. Use the reliable flag and your own thresholds.

Does it detect sign language?

No. It works on written text only.

Which scripts does it handle?

Latin, Cyrillic, Arabic, Devanagari, Chinese, Japanese, Korean, Thai, Greek and others among its 82 languages.

Related

Updated 2026-12-02