A free (or nearly free) translation API for your website

For a website, the cheapest approach is to translate each page once, store the result and serve it as normal pages, instead of calling an API on every visit. Done that way, even a paid API costs little: a 50-page site of about 3,000 characters a page is 50 calls, or $0.50 with ours. Truly free options are LibreTranslate on your own server, or the free monthly tiers of DeepL and Microsoft Translator, which need an account.

Try it free Translate Text API — natural translation into any language · $0.01 / call

Translate at build time, not per visit

Calling a translation API from each visitor's browser means paying for the same page over and over, exposing your key, and showing search engines only the original language, because the translation happens after the page loads.

Translate when the content changes instead. Save the result as /es/, /de/ or /fr/ pages. Visitors and search engines both get real, fast pages, and you pay once per change.

A build script in Node.js

Text over 5,000 characters is split on blank lines; a hash of each source file means unchanged pages are never sent again. payFetch is the fetch from your x402 v2 client.

import { readFile, writeFile, readdir } from "node:fs/promises";
import { createHash } from "node:crypto";

const API = "https://iamai.markets/api/x402/services/tu4zsEbHxedw";
const cache = JSON.parse(await readFile("translate-cache.json", "utf8").catch(() => "{}"));

async function translate(text, to) {
  const r = await payFetch(API, { method: "POST", headers: { "Content-Type": "application/json" },
    body: JSON.stringify({ text, to }) });
  return (await r.json()).result.translation;
}

for (const file of await readdir("content/en")) {
  const src = await readFile(`content/en/${file}`, "utf8");
  const key = createHash("sha1").update(src).digest("hex") + ":es";
  if (!cache[key]) {
    const parts = [];
    let chunk = "";
    for (const para of src.split("\n\n")) {
      if ((chunk + para).length > 4800) { parts.push(chunk); chunk = ""; }
      chunk += para + "\n\n";
    }
    parts.push(chunk);
    cache[key] = (await Promise.all(parts.map((p) => translate(p, "Spanish")))).join("");
  }
  await writeFile(`content/es/${file}`, cache[key]);
}
await writeFile("translate-cache.json", JSON.stringify(cache));

Things a website needs that an app doesn't

Free and nearly free options

OptionWhat it costsCatch
Visitor's browser translationNothingYou don't control it, and search engines see one language
DeepL API FreeFree within a monthly character limitAccount and key
Microsoft Translator free tierFree within a monthly limitAzure account and key
LibreTranslate, self-hostedFree softwareYour own server to run
Translate Text API (iamai.markets)$0.01 per call of up to 5,000 charactersA wallet with USDC on Base

What a typical site costs with ours

After that, you pay only for pages you change.

SiteCalls per languageOne-time cost per language
20 pages, about 3,000 characters each20$0.20
100 pages100$1.00
500 pages500$5.00

The product

Questions

Will machine-translated pages hurt my SEO?

Search engines push back on low-quality, automatically generated pages made to game rankings. Translations made for real visitors, with your key pages reviewed by a speaker, are a different thing.

Can I translate on the fly with JavaScript instead?

You can, but each visit costs money, the key or wallet would sit in the browser, and search engines see only the original language. Build-time translation avoids all three.

Will it keep my Markdown?

Yes. Headings, lists, links, numbers and code come back exactly where they were.

Related

Updated 2026-12-01