Translate text

    Translate text from a source language to a target language.

    Request Body

    ParameterTypeRequiredDescription
    modelvalsea-translateYesPublic translation model name. Always valsea-translate.
    textstringYesText to translate. Maximum 10,000 characters; longer requests are rejected with 413 (not truncated).
    sourcestringNoSource language name (e.g. "english", "chinese") or "auto" for detection. Default: "auto". When "auto" is used with response_format=verbose_json, the response's source_language reflects the detected language.
    targetstringYesTarget language name (e.g. "chinese", "vietnamese", "thai").
    response_formatjson | verbose_jsonNoDefault: json

    Supported targets: english, chinese, japanese, korean, vietnamese, thai, french, spanish, german, russian, indonesian, malay, filipino, tamil, khmer, and lao.

    Code Examples

    curl -X POST https://api.valsea.ai/v1/translations \
      -H "Authorization: Bearer YOUR_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "model": "valsea-translate",
        "text": "Hello, world",
        "target": "chinese"
      }'
    

    Response

    Minimal (json)

    FieldTypeDescription
    translated_textstringThe translated text in the target language.

    Verbose (verbose_json)

    FieldTypeDescription
    translated_textstringThe translated text in the target language.
    source_languagestringReturns the actual detected language if source was "auto". Otherwise, returns the source value you sent. If detection fails, defaults back to "auto".
    target_languagestringThe target language the translation was produced in (echoes the target you sent).

    Errors

    StatusDescription
    400Invalid request — malformed body, unsupported model, or unsupported target language
    401Missing or invalid API key
    402Insufficient credits
    413Text exceeds the 10,000-character limit
    429Rate limit exceeded

    Was this page helpful?