LinconwavesLinconwavesUnified docs
AI Workers

M2m100 1p2b (Translation)

Translate text via the Linconwaves AI Workers API.

M2m100 1p2b (slug: m2m100-1p2b) translates text between languages.

Endpoint

  • URL: POST /:modelSlug with modelSlug = m2m100-1p2b
  • Auth: Authorization: Bearer <api_key>
  • Content-Type: application/json
  • Base URL: https://aiworker.linconwaves.com

Request

{
  "text": "Hello, welcome to Linconwaves.",
  "target_language": "hin_Deva"
}

Adjust the target code for the desired language.

Error codes

  • 401 Unauthorized — Missing/invalid API key.
  • 400 Bad Request — Invalid payload (e.g., missing text or target_language).
  • 499 Client Closed Request — Request aborted by client.
  • 500 — Upstream model error or unexpected failure.

Curl example

curl -X POST https://aiworker.linconwaves.com/m2m100-1p2b \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  --data '{"text": "Hello, welcome to Linconwaves.", "target_language": "hin_Deva"}'

JavaScript (fetch)

const resp = await fetch('https://aiworker.linconwaves.com/m2m100-1p2b', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    Authorization: `Bearer ${process.env.API_KEY}`,
  },
  body: JSON.stringify({
  "text": "Hello, welcome to Linconwaves.",
  "target_language": "hin_Deva"
}),
});

const data = await resp.json();
if (!resp.ok) {
  throw new Error(data.error || `Request failed (${resp.status})`);
}

const translated =
  data.translated_text ||
  data.text ||
  data.result?.text ||
  data.response ||
  "No translated text found.";

Backend snippets

const BASE = 'https://aiworker.linconwaves.com';
const API_KEY = process.env.AIWORKER_API_KEY!;

const payload = {
  "text": "Hello, welcome to Linconwaves.",
  "target_language": "hin_Deva"
};

const res = await fetch(`${BASE}/m2m100-1p2b`, {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    Authorization: `Bearer ${API_KEY}` ,
  },
  body: JSON.stringify(payload),
});
const data = await res.json();
console.log(data);

Frontend snippets

// app/api/aiworker/route.ts
const BASE = 'https://aiworker.linconwaves.com';
const API_KEY = process.env.AIWORKER_API_KEY!;

export async function POST(req: Request) {
  const payload = await req.json();
  const res = await fetch(`${BASE}/m2m100-1p2b`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      Authorization: `Bearer ${API_KEY}` ,
    },
    body: JSON.stringify(payload),
  });
  return new Response(await res.text(), { status: res.status, headers: res.headers });
}
  • Playground: Dashboard → Playground → select “M2m100 1p2b”, choose target language, and translate.