curl --request POST \
--url https://api.voxnexus.ai/v1/translate \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <api-key>' \
--data '
{
"texts": [
"第一句",
"第二句"
],
"target_language": "en",
"model_id": "vn-translate-basic",
"source_language": "zh-Hans"
}
'import requests
url = "https://api.voxnexus.ai/v1/translate"
payload = {
"texts": ["第一句", "第二句"],
"target_language": "en",
"model_id": "vn-translate-basic",
"source_language": "zh-Hans"
}
headers = {
"X-Api-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Api-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
texts: ['第一句', '第二句'],
target_language: 'en',
model_id: 'vn-translate-basic',
source_language: 'zh-Hans'
})
};
fetch('https://api.voxnexus.ai/v1/translate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.voxnexus.ai/v1/translate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'texts' => [
'第一句',
'第二句'
],
'target_language' => 'en',
'model_id' => 'vn-translate-basic',
'source_language' => 'zh-Hans'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Api-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.voxnexus.ai/v1/translate"
payload := strings.NewReader("{\n \"texts\": [\n \"第一句\",\n \"第二句\"\n ],\n \"target_language\": \"en\",\n \"model_id\": \"vn-translate-basic\",\n \"source_language\": \"zh-Hans\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Api-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.voxnexus.ai/v1/translate")
.header("X-Api-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"texts\": [\n \"第一句\",\n \"第二句\"\n ],\n \"target_language\": \"en\",\n \"model_id\": \"vn-translate-basic\",\n \"source_language\": \"zh-Hans\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.voxnexus.ai/v1/translate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Api-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"texts\": [\n \"第一句\",\n \"第二句\"\n ],\n \"target_language\": \"en\",\n \"model_id\": \"vn-translate-basic\",\n \"source_language\": \"zh-Hans\"\n}"
response = http.request(request)
puts response.read_body[
{
"text": "Hello",
"detected_source_language": "zh-Hans"
}
]{
"error": "Invalid request parameters",
"code": "INVALID_REQUEST",
"details": "Detailed error information",
"request_id": "req_1234567890"
}{
"error": "Invalid request parameters",
"code": "INVALID_REQUEST",
"details": "Detailed error information",
"request_id": "req_1234567890"
}{
"error": "Invalid request parameters",
"code": "INVALID_REQUEST",
"details": "Detailed error information",
"request_id": "req_1234567890"
}{
"error": "Invalid request parameters",
"code": "INVALID_REQUEST",
"details": "Detailed error information",
"request_id": "req_1234567890"
}{
"error": "Invalid request parameters",
"code": "INVALID_REQUEST",
"details": "Detailed error information",
"request_id": "req_1234567890"
}{
"error": "Invalid request parameters",
"code": "INVALID_REQUEST",
"details": "Detailed error information",
"request_id": "req_1234567890"
}Translate Text
Translate one or more texts into a single target language. Source language is auto-detected when not specified.
curl --request POST \
--url https://api.voxnexus.ai/v1/translate \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <api-key>' \
--data '
{
"texts": [
"第一句",
"第二句"
],
"target_language": "en",
"model_id": "vn-translate-basic",
"source_language": "zh-Hans"
}
'import requests
url = "https://api.voxnexus.ai/v1/translate"
payload = {
"texts": ["第一句", "第二句"],
"target_language": "en",
"model_id": "vn-translate-basic",
"source_language": "zh-Hans"
}
headers = {
"X-Api-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Api-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
texts: ['第一句', '第二句'],
target_language: 'en',
model_id: 'vn-translate-basic',
source_language: 'zh-Hans'
})
};
fetch('https://api.voxnexus.ai/v1/translate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.voxnexus.ai/v1/translate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'texts' => [
'第一句',
'第二句'
],
'target_language' => 'en',
'model_id' => 'vn-translate-basic',
'source_language' => 'zh-Hans'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Api-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.voxnexus.ai/v1/translate"
payload := strings.NewReader("{\n \"texts\": [\n \"第一句\",\n \"第二句\"\n ],\n \"target_language\": \"en\",\n \"model_id\": \"vn-translate-basic\",\n \"source_language\": \"zh-Hans\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Api-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.voxnexus.ai/v1/translate")
.header("X-Api-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"texts\": [\n \"第一句\",\n \"第二句\"\n ],\n \"target_language\": \"en\",\n \"model_id\": \"vn-translate-basic\",\n \"source_language\": \"zh-Hans\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.voxnexus.ai/v1/translate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Api-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"texts\": [\n \"第一句\",\n \"第二句\"\n ],\n \"target_language\": \"en\",\n \"model_id\": \"vn-translate-basic\",\n \"source_language\": \"zh-Hans\"\n}"
response = http.request(request)
puts response.read_body[
{
"text": "Hello",
"detected_source_language": "zh-Hans"
}
]{
"error": "Invalid request parameters",
"code": "INVALID_REQUEST",
"details": "Detailed error information",
"request_id": "req_1234567890"
}{
"error": "Invalid request parameters",
"code": "INVALID_REQUEST",
"details": "Detailed error information",
"request_id": "req_1234567890"
}{
"error": "Invalid request parameters",
"code": "INVALID_REQUEST",
"details": "Detailed error information",
"request_id": "req_1234567890"
}{
"error": "Invalid request parameters",
"code": "INVALID_REQUEST",
"details": "Detailed error information",
"request_id": "req_1234567890"
}{
"error": "Invalid request parameters",
"code": "INVALID_REQUEST",
"details": "Detailed error information",
"request_id": "req_1234567890"
}{
"error": "Invalid request parameters",
"code": "INVALID_REQUEST",
"details": "Detailed error information",
"request_id": "req_1234567890"
}Authorizations
Authenticate using X-Api-Key header
Body
Text translation request
Texts to translate (max 100 items / 50,000 characters)
["第一句", "第二句"]
Target language code (required). Same format as source_language; see GET /v1/models/{model_id} → translate_capability.target_languages for the codes a model supports.
"en"
Translation model ID (e.g. vn-translate-basic).
"vn-translate-basic"
Source language code. Omit (or pass auto) for automatic detection; providing this forces the source language.
VoxNexus translation language codes use the language[-Script] form without a region: the shortest ISO 639 language code, plus an ISO 15924 script code when needed, e.g. en, ar, hi-Latn, zh-Hans, zh-Hant. The script is omitted when it is the language's default (en, ja) and always written for multi-script languages (zh-Hans, sr-Cyrl, mni-Mtei, mni-Beng). Other common forms are accepted and normalized, case-insensitively and with - or _: ISO 639-3 (eng), <ISO 639-3>_<Script> (eng_Latn, zho_Hans) and BCP 47 tags with a region (zh-TW, pt-BR). A region subtag only selects the script and is then dropped (zh-TW → zh-Hant, pt-BR → pt).
"zh-Hans"
Response
Translation successful
Translated text
"Hello"
When source_language is specified (not blank or auto), it is echoed unchanged (e.g. en, EN_us) and takes precedence over the detected language. Otherwise the detected language is returned as a language[-Script] code (e.g. zh-Hans, en).
"zh-Hans"

