Inference Providers documentation
Translation
Translation
Translation is the task of converting text from one language to another.
For more details about the translation
task, check out its dedicated page! You will find examples and related materials.
Recommended models
Explore all available models and find the one that suits you best here.
Using the API
There are currently no snippet examples for the translation task, as no providers support it yet.
API specification
Request
Headers | ||
---|---|---|
authorization | string | Authentication header in the form 'Bearer: hf_****' when hf_**** is a personal user access token with “Inference Providers” permission. You can generate one from your settings page. |
Payload | ||
---|---|---|
inputs* | string | The text to translate. |
parameters | object | |
src_lang | string | The source language of the text. Required for models that can translate from multiple languages. |
tgt_lang | string | Target language to translate to. Required for models that can translate to multiple languages. |
clean_up_tokenization_spaces | boolean | Whether to clean up the potential extra spaces in the text output. |
truncation | enum | Possible values: do_not_truncate, longest_first, only_first, only_second. |
generate_parameters | object | Additional parametrization of the text generation algorithm. |
Response
Body | ||
---|---|---|
translation_text | string | The translated text. |