AI语音合成API接口

在线文字转语音,语音合成工具,从文字到语音,提供在线一键文字转语音,包括中文语音处理和语音合成,提供mp3文件下载。

接口文档 《查看会员》
接口地址: http://api.toolfk.com/api/text2video | 在线体验接口
请求方法: [ "GET", "POST" ]
请求参数:
名称 类型 描述 示例
token string 请求的token 用户中心获取token
content string 文字内容 欢迎来到toolfk工具网
per string 播音员:标准女声(sijia),标准男声(sicheng),温柔女声(siyue),儿童女声(yuer),儿童男声(mashu),亲和女声(aixia),温柔女声(aiyue),严厉女声(aijing),甜美女声(xiaomei),自然男声(aishuo),亲切女声(xiaoxian),活力女声(maoxiaomei),卖场广播(qiaowei),悬疑解说(ailun),激昂男声(aifei),知心姐姐(Aiyuan),广告男声(Ainan),磁性男声(Aixiang),资讯男声(Aihao),萝莉女声(xiaobei),粤语女声(shanshan),东北男声(dahu),台湾女声(qingqing),东北女声(cuijie),湖南男声(xiaoze),四川女声(chuangirl),日语女声(tomoka),日语男声(tomoya),美音女声(abby),英音女声(emily),美音男声(andy),英音男声(harry),英中双语(lydia), siyue
vol string 音量,取值范围:0~100。默认值:50 50
spd string 语速,取值范围:-500~500。默认值:1 1
pit string 语调,取值范围:-500~500。默认值:1 1
-- 漂亮的分割符 --
返回数据:

{
    "status": 1,
    "data": "https://www.toolfk.com/storage/mp3/0b1112bcf66c24f291757d2cdbff4e20.mp3"
}

                            
代码示例:
  • Curl
  • PHP
  • Java
  • Python
  • JavaScript
  • Go
  • Nodejs

    curl -X POST \
    http://api.toolfk.com/api/text2video \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    -d 'token=用户中心获取&content=%E6%AC%A2%E8%BF%8E%E6%9D%A5%E5%88%B0toolfk%E5%B7%A5%E5%85%B7%E7%BD%91&per=siyue&vol=50&spd=1&pit=1'
                                       
//记得去掉这个 "\" 斜线
<\?php
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "http://api.toolfk.com/api/text2video",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "token=用户中心获取&content=%E6%AC%A2%E8%BF%8E%E6%9D%A5%E5%88%B0toolfk%E5%B7%A5%E5%85%B7%E7%BD%91&per=siyue&vol=50&spd=1&pit=1",
  CURLOPT_HTTPHEADER => array(
    "Content-Type: application/x-www-form-urlencoded",
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
   

OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
RequestBody body = RequestBody.create(mediaType, "token=用户中心获取&content=%E6%AC%A2%E8%BF%8E%E6%9D%A5%E5%88%B0toolfk%E5%B7%A5%E5%85%B7%E7%BD%91&per=siyue&vol=50&spd=1&pit=1");
Request request = new Request.Builder()
  .url("http://api.toolfk.com/api/text2video")
  .post(body)
  .addHeader("Content-Type", "application/x-www-form-urlencoded")
  .build();

Response response = client.newCall(request).execute();


                                       
import requests

url = "http://api.toolfk.com/api/text2video"

payload = "token=用户中心获取&content=%E6%AC%A2%E8%BF%8E%E6%9D%A5%E5%88%B0toolfk%E5%B7%A5%E5%85%B7%E7%BD%91&per=siyue&vol=50&spd=1&pit=1"
headers = {'Content-Type': "application/x-www-form-urlencoded"}

response = requests.request("POST", url, data=payload, headers=headers)

print(response.text)
var data = "token=用户中心获取&content=%E6%AC%A2%E8%BF%8E%E6%9D%A5%E5%88%B0toolfk%E5%B7%A5%E5%85%B7%E7%BD%91&per=siyue&vol=50&spd=1&pit=1";

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
    if (this.readyState === 4) {
        console.log(this.responseText);
    }
});

xhr.open("POST", "http://api.toolfk.com/api/text2video");
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");

xhr.send(data);
                                       
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "http://api.toolfk.com/api/text2video"

	payload := strings.NewReader("token=用户中心获取&content=%E6%AC%A2%E8%BF%8E%E6%9D%A5%E5%88%B0toolfk%E5%B7%A5%E5%85%B7%E7%BD%91&per=siyue&vol=50&spd=1&pit=1")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Content-Type", "application/x-www-form-urlencoded")

	res, _ := http.DefaultClient.Do(req)

	async res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
                                       
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "http://api.toolfk.com/api/text2video"

        payload := strings.NewReader("{
          "token": "用户中心获取token",
          "type": "a",
          "format": "json"
        }")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Content-Type", "application/x-www-form-urlencoded")

	res, _ := http.DefaultClient.Do(req)

	async res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
                                       
返回状态码 status 描述参照
返回码 描述
status 1:表示成功,0:表示失败
data 成功返回数据
errmsg 失败返回数据
备注:开通API接口服务,可同时享用 www.toolfk.com 网站的会员工具。