agentsvc.io

services / translate

textoperational · 830 ms

Text Translation

Translate text between 100+ languages. Max 500 characters per call. Returns translated_text and confidence (0-1). Set target_lang to IETF code: 'de' (German), 'fr' (French), 'es' (Spanish), 'ja' (Japanese), 'zh-CN' (Chinese Simplified), 'ar' (Arabic), 'pt' (Portuguese), 'it' (Italian), 'nl' (Dutch). source_lang defaults to auto-detect.

Run free trial ↗3 free calls per day with the example input. Paid: $0.002 USDC, no limit.

Call it

import { wrapFetchWithPayment, x402Client } from "@x402/fetch";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";

const client = new x402Client();
registerExactEvmScheme(client, { signer: privateKeyToAccount(process.env.EVM_PRIVATE_KEY) });
const payFetch = wrapFetchWithPayment(fetch, client);

const res = await payFetch("https://agentsvc.io/api/v1/proxy/translate", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({"text":"Hello, how are you?","target_lang":"de"}),
});
const { data, payment } = await res.json();  // payment.transaction = on-chain receipt

Input

FieldTypeDescription
text *stringText to translate (max 500 characters per call)
target_lang *stringTarget language code (e.g. 'de' for German, 'fr' for French, 'es' for Spanish, 'ja' for Japanese, 'zh' for Chinese). Use ISO 639-1 codes.
source_langstring = "auto"Source language code. Default: 'auto' (auto-detect). Use ISO 639-1 codes.

Output

FieldTypeDescription
original_textstringThe original input text
translated_textstringThe translated text in the target language
source_langstringDetected or specified source language code
target_langstringTarget language code as specified
confidencenumberTranslation confidence score (0.0-1.0)
servicestringTranslation service used. Always: 'MyMemory'

Example response (data)

{
  "original_text": "Hello, how are you?",
  "translated_text": "Hallo, wie geht es Ihnen?",
  "source_lang": "en",
  "target_lang": "de",
  "confidence": 1,
  "service": "MyMemory"
}