Skip to content

MaaS-ASpeech-Translation

Request Method

POST

Request Path

{basePath}/v1/ai/{endpointPath}/audio/realtime/translation

Request Header

Parameter Description Example
Authorization AccessKey
Bearer ${AccessKey}
Bearer RWxxxxxxxx0Gd
Host Host address of the service genaiapi.cloudsway.net

Request Parameters

Field Name Type Required Description Example Value
targetLanguages String Yes List of target translation languages "en-US", "ja"
file File Yes Audio file (audio file within 30 seconds). Audio files longer than 30 seconds will only transcribe and translate the first 30 seconds "C:\Users\zhcn_continuous_mode_sample.wav"
recognitionLanguages String Yes List of recognition languages. When multiple are provided, hasRecognize must be enabled; otherwise, only the first will be recognized "zh-CN", "en-US"
hasRecognize String No Whether recognition is required; defaults to false "true"
SegmentationSilenceTimeoutMs String No Segmentation silence timeout setting (in milliseconds), defaults to 2000 "1000"

Return Values

Field Name Type Description Example Value
text String Original text "Good morning, Steve. Good morning, Katie. ..."
translations Object Translation results, containing texts in different languages {"ja": "おはようございます、スティーブ。おはようございます、ケイティ。..."}
language String Original language of the audio "en-US"
duration Integer Audio duration, in hundred-nanosecond units 286400000
resultId String Unique identifier for the task result "5518458c7dec4003b9281662d9c763a7"
durationInSeconds Integer Audio duration, in seconds 29

Example

Request

curl --location --request POST 'https://genaiapi.cloudsway.net/v1/ai/YAzGCqDxSYQFlYie/audio/realtime/translation' \
--header 'Authorization: Bearer ${AccessKey}' \
--header 'Connection: keep-alive' \
--form 'targetLanguages="en-US,ja"' \
--form 'file=@path/to/your/audio/file"' \
--form 'recognitionLanguages="zh-CN,en-US"' \
--form 'hasRecognize="true"' \
--form 'SegmentationSilenceTimeoutMs="1000"'

Return Values

{
  "text": "秋天总是那么那么富有诗意,树叶渐渐变红街道旁的银杏树开始落叶,人们穿上厚重的外套,享受着凉爽的秋风。黄昏时分,夕阳洒在街道上,给忙碌的一天增添了一抹温暖。无论是散步还是小憩,这个季节总能带来宁静和满足。",
  "translations": {
    "en-US": "Autumn is always so poetic, the leaves are turning red, the ginkgo trees along the streets are starting to lose their leaves, and people are wearing heavy coats and enjoying the cool autumn breeze. At dusk, the setting sun shines on the streets, adding a touch of warmth to a busy day. Whether it's a walk or a nap, this season always brings tranquility and fulfillment.",
    "ja": "秋はいつもとても詩的で、葉は赤く色づき、通り沿いのイチョウの木は葉を失い始め、人々は厚手のコートを着て涼しい秋の風を楽しんでいます。 夕暮れ時には、夕日が通りを照らし、忙しい一日に暖かさを加えます。 散歩でも昼寝でも、この季節はいつも静けさと充実感をもたらします。"
  },
  "language": "zh-CN",
  "duration": 260400000,
  "resultId": "ad03ee3a708e435dbe0ee808bb68f918",
  "durationInSeconds": 27
}