Translate Text API
POST /api/translate-text $0.01 per call
USDC on Base · x402
TRANSLATION — POST {text, target} and get the translation plus the detected source language. Any language pair; target as a name or ISO code ('spanish', 'de', 'ja'). Up to 8,000 chars per call; line breaks and markdown preserved; code, URLs, and proper names left alone. Optional {source} to pin the source language, {formality}: formal|informal. Fast cheap LLM under the hood; the x402 payment IS the auth.
Parameters
| Name | In | Description | |
|---|---|---|---|
text | body | required | The text to translate, up to 8,000 characters |
target | body | required | Target language — name or ISO code ('spanish', 'de', 'ja') |
source | body | Optional source language; auto-detected when omitted | |
formality | body | formal or informal register (optional) |
Example request
curl -X POST "https://api.webbersites.com/api/translate-text" \
-H "Content-Type: application/json" \
-d '{"text":"The deploy failed because the token expired.","target":"japanese"}'
# first call returns 402 + payment requirements; an x402 client pays and retries automaticallyExample response
{
"translation": "トークンの有効期限が切れたため、デプロイは失敗しました。",
"target": "japanese",
"source_language": "English",
"model": "gemini-2.5-flash-lite"
}MCP tool: post_translate_text — via npx -y webbersites-x402-mcp (local, key stays on your machine) or the remote endpoint https://api.webbersites.com/mcp.
How payment works
There is no signup and no API key. Call the endpoint; it replies 402 Payment Required with machine-readable payment requirements. Your client signs a USDC transfer authorization (EIP-3009, gasless) and retries with the X-PAYMENT header — @x402/fetch does this automatically. See the overview for a working snippet.