generation

Translate text

Translate a text into a target language with an LLM. Returns translation, the detected source language (source_lang code + source_lang_name; the detection is reported, never guessed from the hint) and the normalized target (target_lang, target_lang_name). Line breaks, markup and placeholders are preserved in place. target_lang and source_lang accept an ISO 639 code ("fr", "zh-TW") or an English language name ("French"); region variants zh-CN/zh-TW/zh-HK, pt-BR/pt-PT, en-GB/en-US, fr-CA and es-419 are supported as targets. Optional formality picks a formal or informal register where the target language distinguishes them.

post/api/v1/translate

Request

  • Base URL: https://api.sapling.ai
  • URL: https://api.sapling.ai/api/v1/translate
  • Auth: one of:
    • HTTP bearer
    • OAuth 2 (authorization code, authorization URL https://api.sapling.ai/oauth/authorize, token URL https://api.sapling.ai/oauth/token, scopes: sapling:api)
    • none

Request body

OR

Response

Successful response. Field-level schemas and examples: https://sapling.ai/docs/api/translate/ A batch (texts) request answers {"results": [...]} instead: one single-text response per input text, in input order.

resultsobject[]

Present only for a batch (texts) request: one entry per input text, in input order, each shaped exactly like the single-text response.

Changes

No recorded changes to this operation across all 1 revision of this API.