Lingua Detective for AI agents
API and benchmark JSON currently use French field names; English aliases are not available. See the field documentation.
Pay-per-call language intelligence over x402 (USDC on Solana, gas sponsored): detect and verify the language of any text, offline. No account, no API key, no subscription.
TL;DR for agents: unauthenticated calls receive HTTP 402 with a PAYMENT-REQUIRED header. Pay a few tenths of a cent in USDC on Solana mainnet via the facilitator https://x402.dexter.cash (gas sponsored — you only need USDC, not SOL), retry with the payment proof, get your answer. Machine-readable entry points: llms.txt · .well-known/x402 · MCP server npx -y lingua-x402-mcp.
Endpoints and prices
| Endpoint | Price per call | What it does |
|---|---|---|
POST /detect | $0.002 | Detect the language(s) of a text — ISO 639-3, offline, top-5 with confidence. Body: {"text":"..."}. |
POST /verify | $0.004 | Verify a text is written in the expected language (ISO 639-1 or 639-3). Body: {"text":"...","expected":"fra"}. |
POST /crawl | $0.006–$0.020 / page | Crawl a site and verify the language of each page, or verify a batch of URLs. Progressive cumulative tiers; minimum $0.01/run. |
POST /api/audit | same tiers as /crawl | Full multilingual audit: score, classification, confidence, evidence, next steps — JSON plus a copy-pasteable Markdown report. |
POST /v1/bundle/check | $0.006 | Buy a prepaid bundle — returns an X402-Credit token. |
POST /v1/credit/topup | flexible (min $0.006) | Top up prepaid credit — each later call debits the credit without a new Solana transaction. |
MCP server
The MCP server lingua-x402-mcp exposes four paid tools (detect_langue, verifier_langue, bundle_check, credit_topup) over stdio:
{
"mcpServers": {
"linguadetective": {
"command": "npx",
"args": ["-y", "lingua-x402-mcp"],
"env": {
"X402_PAYER_KEY_B64": "<your base64 private key>",
"X402_TRUSTED_PAYTO": "H3NuGHu9mpGgscj2DWtrs699PWdovPUicy2N9dDaYLTk"
}
}
}
}
Two payment modes: payer wallet (X402_PAYER_KEY_B64 — each call settles its own x402 transaction) or prepaid credit (X402_CREDIT_TOKEN — debits without a Solana transaction). With neither, tools return the decoded 402 challenge so the agent understands what is being requested.
Payment details (x402)
- Chain: Solana mainnet — CAIP-2
solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp - Asset: USDC — mint
EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v - Scheme:
exact— gas sponsored by the facilitator - Facilitator:
https://x402.dexter.cash - Recipient:
H3NuGHu9mpGgscj2DWtrs699PWdovPUicy2N9dDaYLTk
Why agents pick this API
- Offline detection — texts are never sent to a third-party AI service; detection runs on a local trigram model covering 180+ languages (see the benchmark).
- No onboarding friction — no account, no API key, no subscription; the 402 challenge is the documentation.
- Predictable micro-pricing — $0.002 per detection; a 2,000-page site audit costs $17 when you provide the URLs.
- Agent-native discovery — llms.txt, .well-known/x402 and the npm MCP package describe every capability machine-readably.
Quickstart (curl)
# 1. Call without payment → HTTP 402 challenge
curl -i -X POST https://linguadetective.com/detect \
-H 'Content-Type: application/json' \
-d '{"text":"Bonjour tout le monde"}'
# 2. Settle the challenge in USDC via the facilitator, then retry with
# the payment proof header → 200 OK with the detection result.
Full walkthrough in the API docs.