Tools / AI

Translate text

Translates up to 8000 characters into the target language. The source language is detected automatically. Markdown, line breaks and placeholders are preserved.

Price per call
$0.003 USDC
Endpoint
POST https://x402-tools.com/v1/translate
Also accepts
GET with query parameters
Payment
x402, exact scheme, USDC on Base
Returns
application/json

Parameters

NameTypeDescription
text requiredstringText to translate (max 8000 characters).
target requiredstringTarget language, as a name or code (e.g. 'Dutch' or 'nl').
sourcestringOptional source language. Detected if omitted.

Call it from an agent

import { wrapFetchWithPayment } from "x402-fetch";
import { privateKeyToAccount } from "viem/accounts";

const account = privateKeyToAccount(process.env.AGENT_PRIVATE_KEY);
const paidFetch = wrapFetchWithPayment(fetch, account);

const res = await paidFetch("https://x402-tools.com/v1/translate", {
  method: "POST",
  headers: { "content-type": "application/json" },
  body: JSON.stringify({
    "text": "Pay per request, no API key needed.",
    "target": "Dutch"
  }),
});
// costs $0.003 in USDC on Base

Without a payment the endpoint answers 402 with the price, so you can inspect it first:

curl -i -X POST "https://x402-tools.com/v1/translate" -H "content-type: application/json" -d '{"text":"Pay per request, no API key needed.","target":"Dutch"}'

Example response

{
  "translated_text": "Betaal per verzoek, geen API-sleutel nodig.",
  "target_language": "Dutch",
  "detected_source_language": "English"
}

If the tool fails or your input is invalid, the payment is not settled.

Other tools