Skip to main content

Translation

POST 

/v1/models/translate

Translate text between supported languages.

What does this endpoint do?

  • This endpoint translates text from a specified source language to a target language.
  • It supports Bambara, French, and English.

Request Requirements:

  • The request body must include:
    • text (str): The text to translate.
    • source (str): The language code of the source text (e.g., "fra_Latn").
    • target (str): The language code of the target language (e.g., "bam_Latn").

Headers:

  • x-api-key: Your API key for authentication.
  • Content-Type: Must be set to application/json.

Example Request Body:

{
"text": "Bonjour",
"source": "fra_Latn",
"target": "bam_Latn"
}

Example Response:

{
"text": "Aw ni ce"
}

How to use this endpoint?

  • Use the /translate/supported-languages endpoint to get a list of valid language codes.
  • Provide the text, source, and target fields in the request body.

Returns: TranslationResponse: A dictionary containing the translated text.

Request

Responses

Successful Response