m2m100-1.2b
Translation • Meta
@cf/meta/m2m100-1.2b
- Cloudflare-hosted
- Batch
Multilingual encoder-decoder (seq-to-seq) model trained for Many-to-Many multilingual translation
| Model Info | |
|---|---|
| Terms and License | link ↗ |
| More information | link ↗ |
| Batch | Yes |
| Unit Pricing | $0.342 per M input tokens, $0.342 per M output tokens |
Usage
export interface Env {
AI: Ai;
}
export default {
async fetch(request, env): Promise<Response> {
const response = await env.AI.run(
"@cf/meta/m2m100-1.2b",
{
text: "I'll have an order of the moule frites",
source_lang: "english", // defaults to english
target_lang: "french",
}
);
return new Response(JSON.stringify(response));
},
} satisfies ExportedHandler<Env>;
import requests
API_BASE_URL = "https://api.cloudflare.com/client/v4/accounts/{ACCOUNT_ID}/ai/run/"
headers = {"Authorization": "Bearer {API_TOKEN}"}
def run(model, input):
response = requests.post(f"{API_BASE_URL}{model}", headers=headers, json=input)
return response.json()
output = run('@cf/meta/m2m100-1.2b', {
"text": "I'll have an order of the moule frites",
"source_lang": "english",
"target_lang": "french"
})
print(output)
curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run/@cf/meta/m2m100-1.2b \
-X POST \
-H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
-d '{ "text": "Ill have an order of the moule frites", "source_lang": "english", "target_lang": "french" }'
Parameters
<details>
<summary>Synchronous — Send a request and receive a complete response</summary>
text
<code>string</code>requiredminLength: 1The text to be translated
source_lang
<code>string</code>default: enThe language code of the source text (e.g., 'en' for English). Defaults to 'en' if not specified
target_lang
<code>string</code>requiredThe language code to translate the text into (e.g., 'es' for Spanish)
request_id
<code>string</code>The async request id that can be used to obtain the results.
</details>
<details>
<summary>Batch — Send multiple requests in a single API call</summary>
▶requests[]
<code>array</code>requiredBatch of the embeddings requests to run using async-queue
request_id
<code>string</code>The async request id that can be used to obtain the results.
</details>
API Schemas (Raw)
SynchronousInput Open Download
SynchronousOutput Open Download
Was this helpful?
YesNo
On this page
{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/workers-ai/models/m2m100-1.2b/#page","headline":"m2m100-1.2b","description":"Multilingual encoder-decoder (seq-to-seq) model trained for Many-to-Many multilingual translation","url":"https://developers.cloudflare.com/workers-ai/models/m2m100-1.2b/","inLanguage":"en","image":"https://developers.cloudflare.com/og-docs.png","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"}}
description: 50 layers deep image classification CNN trained on more than 1M images from ImageNet title: resnet-50 image: https://developers.cloudflare.com/og-docs.png
Documentation Index
Fetch the complete documentation index at: https://developers.cloudflare.com/llms.txt
Use this file to discover all available pages before exploring further.

