Skip to content
Meta logo

m2m100-1.2b

TranslationMetaHosted

Multilingual encoder-decoder (seq-to-seq) model trained for Many-to-Many multilingual translation

Model Info
Terms and Licenselink
More informationlink
BatchYes
Unit Pricing$0.34 per M input tokens, $0.34 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>;

Parameters

Synchronous — Send a request and receive a complete response
text
stringrequiredminLength: 1The text to be translated
source_lang
stringdefault: enThe language code of the source text (e.g., 'en' for English). Defaults to 'en' if not specified
target_lang
stringrequiredThe language code to translate the text into (e.g., 'es' for Spanish)
Batch — Send multiple requests in a single API call

API Schemas (Raw)

Synchronous — Send a request and receive a complete response
{
"properties": {
"text": {
"type": "string",
"minLength": 1,
"description": "The text to be translated"
},
"source_lang": {
"type": "string",
"default": "en",
"description": "The language code of the source text (e.g., 'en' for English). Defaults to 'en' if not specified"
},
"target_lang": {
"type": "string",
"description": "The language code to translate the text into (e.g., 'es' for Spanish)"
}
},
"required": [
"text",
"target_lang"
]
}
Batch — Send multiple requests in a single API call
{
"properties": {
"requests": {
"type": "array",
"description": "Batch of the embeddings requests to run using async-queue",
"items": {
"type": "object",
"properties": {
"text": {
"type": "string",
"minLength": 1,
"description": "The text to be translated"
},
"source_lang": {
"type": "string",
"default": "en",
"description": "The language code of the source text (e.g., 'en' for English). Defaults to 'en' if not specified"
},
"target_lang": {
"type": "string",
"description": "The language code to translate the text into (e.g., 'es' for Spanish)"
}
},
"required": [
"text",
"target_lang"
]
}
}
},
"required": [
"requests"
]
}