创建转写任务
curl --request POST \
--url https://api.vmeg.ai/openapi/v1/app/task/transcription/create-async \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-Idempotency-Key: <x-idempotency-key>' \
--data '
{
"source": {
"materialId": "YOUR_MATERIAL_ID"
},
"language": {
"source": "en-US"
},
"options": {
"asr": {
"quality": "standard"
},
"speakers": "auto"
},
"title": "Weekly meeting"
}
'import requests
url = "https://api.vmeg.ai/openapi/v1/app/task/transcription/create-async"
payload = {
"source": { "materialId": "YOUR_MATERIAL_ID" },
"language": { "source": "en-US" },
"options": {
"asr": { "quality": "standard" },
"speakers": "auto"
},
"title": "Weekly meeting"
}
headers = {
"X-Idempotency-Key": "<x-idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-Idempotency-Key': '<x-idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
source: {materialId: 'YOUR_MATERIAL_ID'},
language: {source: 'en-US'},
options: {asr: {quality: 'standard'}, speakers: 'auto'},
title: 'Weekly meeting'
})
};
fetch('https://api.vmeg.ai/openapi/v1/app/task/transcription/create-async', 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.vmeg.ai/openapi/v1/app/task/transcription/create-async",
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([
'source' => [
'materialId' => 'YOUR_MATERIAL_ID'
],
'language' => [
'source' => 'en-US'
],
'options' => [
'asr' => [
'quality' => 'standard'
],
'speakers' => 'auto'
],
'title' => 'Weekly meeting'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"X-Idempotency-Key: <x-idempotency-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.vmeg.ai/openapi/v1/app/task/transcription/create-async"
payload := strings.NewReader("{\n \"source\": {\n \"materialId\": \"YOUR_MATERIAL_ID\"\n },\n \"language\": {\n \"source\": \"en-US\"\n },\n \"options\": {\n \"asr\": {\n \"quality\": \"standard\"\n },\n \"speakers\": \"auto\"\n },\n \"title\": \"Weekly meeting\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Idempotency-Key", "<x-idempotency-key>")
req.Header.Add("Authorization", "Bearer <token>")
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.vmeg.ai/openapi/v1/app/task/transcription/create-async")
.header("X-Idempotency-Key", "<x-idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"source\": {\n \"materialId\": \"YOUR_MATERIAL_ID\"\n },\n \"language\": {\n \"source\": \"en-US\"\n },\n \"options\": {\n \"asr\": {\n \"quality\": \"standard\"\n },\n \"speakers\": \"auto\"\n },\n \"title\": \"Weekly meeting\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.vmeg.ai/openapi/v1/app/task/transcription/create-async")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Idempotency-Key"] = '<x-idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"source\": {\n \"materialId\": \"YOUR_MATERIAL_ID\"\n },\n \"language\": {\n \"source\": \"en-US\"\n },\n \"options\": {\n \"asr\": {\n \"quality\": \"standard\"\n },\n \"speakers\": \"auto\"\n },\n \"title\": \"Weekly meeting\"\n}"
response = http.request(request)
puts response.read_body{
"code": 200,
"message": "",
"data": {
"taskId": "<string>",
"taskType": "transcription",
"status": "running",
"createdAt": "<string>",
"editorUrl": "https://www.vmeg.ai/transcription/editor/2047316590123456789/"
}
}转写
创建转写任务
在与 vmeg.ai 相同的链路上创建转写任务。任务会出现在网站我的任务中,打开 editorUrl 可查看和编辑转写稿。Webhook 会收到首次结果(event 为 openapi-app-media-translation,data.taskType 为 transcription),也可以轮询查询任务状态直到 status 为 finished,再从 result.srtEndpoint 下载转写稿。积分按网站规则扣除。
source 接受 materialId(音频或视频素材)或 youtubeUrl 二选一;传 sourceUrl、output、extraData 返回 400。其他未知字段会被忽略。
POST
/
openapi
/
v1
/
app
/
task
/
transcription
/
create-async
创建转写任务
curl --request POST \
--url https://api.vmeg.ai/openapi/v1/app/task/transcription/create-async \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-Idempotency-Key: <x-idempotency-key>' \
--data '
{
"source": {
"materialId": "YOUR_MATERIAL_ID"
},
"language": {
"source": "en-US"
},
"options": {
"asr": {
"quality": "standard"
},
"speakers": "auto"
},
"title": "Weekly meeting"
}
'import requests
url = "https://api.vmeg.ai/openapi/v1/app/task/transcription/create-async"
payload = {
"source": { "materialId": "YOUR_MATERIAL_ID" },
"language": { "source": "en-US" },
"options": {
"asr": { "quality": "standard" },
"speakers": "auto"
},
"title": "Weekly meeting"
}
headers = {
"X-Idempotency-Key": "<x-idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-Idempotency-Key': '<x-idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
source: {materialId: 'YOUR_MATERIAL_ID'},
language: {source: 'en-US'},
options: {asr: {quality: 'standard'}, speakers: 'auto'},
title: 'Weekly meeting'
})
};
fetch('https://api.vmeg.ai/openapi/v1/app/task/transcription/create-async', 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.vmeg.ai/openapi/v1/app/task/transcription/create-async",
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([
'source' => [
'materialId' => 'YOUR_MATERIAL_ID'
],
'language' => [
'source' => 'en-US'
],
'options' => [
'asr' => [
'quality' => 'standard'
],
'speakers' => 'auto'
],
'title' => 'Weekly meeting'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"X-Idempotency-Key: <x-idempotency-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.vmeg.ai/openapi/v1/app/task/transcription/create-async"
payload := strings.NewReader("{\n \"source\": {\n \"materialId\": \"YOUR_MATERIAL_ID\"\n },\n \"language\": {\n \"source\": \"en-US\"\n },\n \"options\": {\n \"asr\": {\n \"quality\": \"standard\"\n },\n \"speakers\": \"auto\"\n },\n \"title\": \"Weekly meeting\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Idempotency-Key", "<x-idempotency-key>")
req.Header.Add("Authorization", "Bearer <token>")
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.vmeg.ai/openapi/v1/app/task/transcription/create-async")
.header("X-Idempotency-Key", "<x-idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"source\": {\n \"materialId\": \"YOUR_MATERIAL_ID\"\n },\n \"language\": {\n \"source\": \"en-US\"\n },\n \"options\": {\n \"asr\": {\n \"quality\": \"standard\"\n },\n \"speakers\": \"auto\"\n },\n \"title\": \"Weekly meeting\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.vmeg.ai/openapi/v1/app/task/transcription/create-async")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Idempotency-Key"] = '<x-idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"source\": {\n \"materialId\": \"YOUR_MATERIAL_ID\"\n },\n \"language\": {\n \"source\": \"en-US\"\n },\n \"options\": {\n \"asr\": {\n \"quality\": \"standard\"\n },\n \"speakers\": \"auto\"\n },\n \"title\": \"Weekly meeting\"\n}"
response = http.request(request)
puts response.read_body{
"code": 200,
"message": "",
"data": {
"taskId": "<string>",
"taskType": "transcription",
"status": "running",
"createdAt": "<string>",
"editorUrl": "https://www.vmeg.ai/transcription/editor/2047316590123456789/"
}
}请求体
application/json

