Language Detection

Identify the likely language of supplied text. Returns the detected language, confidence and alternative language candidates.

Pay by wallet (x402) language-detect

Example

Example answer
{
  "confidence": 0.74,
  "text_length": 59,
  "alternatives": [
    {
      "confidence": 0.76,
      "language_code": "nld",
      "language_name": "Dutch"
    },
    {
      "confidence": 0.74,
      "language_code": "afr",
      "language_name": "Afrikaans"
    },
    {
      "confidence": 0.7,
      "language_code": "src",
      "language_name": "src"
    },
    {
      "confidence": 0.69,
      "language_code": "nno",
      "language_name": "nno"
    }
  ],
  "language_code": "deu",
  "language_name": "German",
  "script_detected": "Latin"
}

Inputs

FieldTypeRequiredWhat it is
textstringYesText to detect language of
min_lengthintegerNoMinimum text length for reliable detection (default 10)

Output fields

How reliably each field appears in a successful answer.

FieldTypeAppears
confidencenumberAlways (present in every successful answer)
text_lengthintegerAlways (present in every successful answer)
alternativesarrayUsually (present for most inputs)
language_codestringAlways (present in every successful answer)
language_namestringAlways (present in every successful answer)
script_detectedstringAlways (present in every successful answer)

How to call it

The same tool through each route. MCP clients reach it through Strale’s server at https://api.strale.io/mcp; the call below is what the agent sends.

# Needs an API key. max_price_cents caps what this call may cost.
curl -X POST https://api.strale.io/v1/do \
  -H "Authorization: Bearer $STRALE_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
    "capability_slug": "language-detect",
    "inputs": {
      "text": "Dies ist ein deutscher Satz zum Testen der Spracherkennung."
    },
    "max_price_cents": 2
  }'

Limitations

  • Short texts unreliable

    Texts shorter than ~20 characters produce unreliable results — trigram analysis needs sufficient sample

    What to do instead: Provide at least 30+ characters for reliable detection

  • Similar languages may be confused

    Closely related languages (e.g., Norwegian/Danish/Swedish, Serbian/Croatian) may be confused