Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.case.dev/llms.txt

Use this file to discover all available pages before exploring further.

Identify the language of text with confidence scores. Useful for routing multilingual content or determining if translation is needed.
Endpoint
POST /translate/v1/detect
curl -X POST https://api.case.dev/translate/v1/detect \
  -H "Authorization: Bearer sk_case_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "q": "Bonjour, comment allez-vous?"
  }'
Response
{
  "data": {
    "detections": [
      [
        {
          "language": "fr",
          "confidence": 0.98,
          "isReliable": true
        }
      ]
    ]
  }
}

Parameters

ParameterTypeRequiredDescription
qstring or string[]YesText to detect language for. Can be a single string or array for batch detection.

Response

The response contains an array of detections. Each detection includes:
FieldTypeDescription
languagestringDetected language code (ISO 639-1)
confidencenumberConfidence score from 0 to 1
isReliablebooleanWhether the detection is considered reliable

Batch detection

Detect languages for multiple texts in a single request:
casedev translate:v1 detect --q "Bonjour, comment allez-vous?"

Examples

Route content by language

# Detect the language
casedev translate:v1 detect --q "Your text here"

# Then translate if needed
casedev translate:v1 translate --q "Your text here" --target en --source fr

Filter by language confidence

casedev translate:v1 detect --q "Text to check confidence for"

Identify mixed-language documents

# Detect each paragraph separately
casedev translate:v1 detect --q "First paragraph text"
casedev translate:v1 detect --q "Second paragraph text"
Pricing: $0.05 per 1,000 characters, same as translation.