语音转文字接口
curl --request POST \
--url https://geekai.co/api/v1/audio/transcriptions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form model=whisper-1 \
--form file='@example-file' \
--form 'prompt=<string>' \
--form 'language=<string>' \
--form response_format=text \
--form stream=true \
--form temperature=0 \
--form retries=0import requests
url = "https://geekai.co/api/v1/audio/transcriptions"
files = { "file": ("example-file", open("example-file", "rb")) }
payload = {
"model": "whisper-1",
"prompt": "<string>",
"language": "<string>",
"response_format": "text",
"stream": "true",
"temperature": "0",
"retries": "0"
}
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('model', 'whisper-1');
form.append('file', '<string>');
form.append('prompt', '<string>');
form.append('language', '<string>');
form.append('response_format', 'text');
form.append('stream', 'true');
form.append('temperature', '0');
form.append('retries', '0');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://geekai.co/api/v1/audio/transcriptions', 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://geekai.co/api/v1/audio/transcriptions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"model\"\r\n\r\nwhisper-1\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"prompt\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"language\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"response_format\"\r\n\r\ntext\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"stream\"\r\n\r\ntrue\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"temperature\"\r\n\r\n0\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"retries\"\r\n\r\n0\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: multipart/form-data"
],
]);
$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://geekai.co/api/v1/audio/transcriptions"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"model\"\r\n\r\nwhisper-1\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"prompt\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"language\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"response_format\"\r\n\r\ntext\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"stream\"\r\n\r\ntrue\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"temperature\"\r\n\r\n0\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"retries\"\r\n\r\n0\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://geekai.co/api/v1/audio/transcriptions")
.header("Authorization", "Bearer <token>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"model\"\r\n\r\nwhisper-1\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"prompt\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"language\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"response_format\"\r\n\r\ntext\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"stream\"\r\n\r\ntrue\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"temperature\"\r\n\r\n0\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"retries\"\r\n\r\n0\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://geekai.co/api/v1/audio/transcriptions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"model\"\r\n\r\nwhisper-1\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"prompt\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"language\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"response_format\"\r\n\r\ntext\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"stream\"\r\n\r\ntrue\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"temperature\"\r\n\r\n0\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"retries\"\r\n\r\n0\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body"<string>"{
"code": "validation_error",
"message": "参数验证失败",
"details": {
"field": "错误描述"
}
}{
"code": "unauthorized",
"message": "Invalid API key or token"
}{
"code": "invalid_request",
"message": "请求参数不合法"
}{
"code": "invalid_request",
"message": "请求参数不合法"
}{
"code": "invalid_request",
"message": "请求参数不合法"
}Audio
Speech to Text
POST
/
audio
/
transcriptions
语音转文字接口
curl --request POST \
--url https://geekai.co/api/v1/audio/transcriptions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form model=whisper-1 \
--form file='@example-file' \
--form 'prompt=<string>' \
--form 'language=<string>' \
--form response_format=text \
--form stream=true \
--form temperature=0 \
--form retries=0import requests
url = "https://geekai.co/api/v1/audio/transcriptions"
files = { "file": ("example-file", open("example-file", "rb")) }
payload = {
"model": "whisper-1",
"prompt": "<string>",
"language": "<string>",
"response_format": "text",
"stream": "true",
"temperature": "0",
"retries": "0"
}
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('model', 'whisper-1');
form.append('file', '<string>');
form.append('prompt', '<string>');
form.append('language', '<string>');
form.append('response_format', 'text');
form.append('stream', 'true');
form.append('temperature', '0');
form.append('retries', '0');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://geekai.co/api/v1/audio/transcriptions', 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://geekai.co/api/v1/audio/transcriptions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"model\"\r\n\r\nwhisper-1\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"prompt\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"language\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"response_format\"\r\n\r\ntext\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"stream\"\r\n\r\ntrue\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"temperature\"\r\n\r\n0\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"retries\"\r\n\r\n0\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: multipart/form-data"
],
]);
$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://geekai.co/api/v1/audio/transcriptions"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"model\"\r\n\r\nwhisper-1\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"prompt\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"language\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"response_format\"\r\n\r\ntext\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"stream\"\r\n\r\ntrue\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"temperature\"\r\n\r\n0\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"retries\"\r\n\r\n0\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://geekai.co/api/v1/audio/transcriptions")
.header("Authorization", "Bearer <token>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"model\"\r\n\r\nwhisper-1\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"prompt\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"language\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"response_format\"\r\n\r\ntext\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"stream\"\r\n\r\ntrue\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"temperature\"\r\n\r\n0\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"retries\"\r\n\r\n0\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://geekai.co/api/v1/audio/transcriptions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"model\"\r\n\r\nwhisper-1\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"prompt\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"language\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"response_format\"\r\n\r\ntext\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"stream\"\r\n\r\ntrue\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"temperature\"\r\n\r\n0\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"retries\"\r\n\r\n0\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body"<string>"{
"code": "validation_error",
"message": "参数验证失败",
"details": {
"field": "错误描述"
}
}{
"code": "unauthorized",
"message": "Invalid API key or token"
}{
"code": "invalid_request",
"message": "请求参数不合法"
}{
"code": "invalid_request",
"message": "请求参数不合法"
}{
"code": "invalid_request",
"message": "请求参数不合法"
}Note: For speech model name settings, refer to the System Supported Transcription Speech Model List. The request/response parameter structure is fully compatible with OpenAI. When switching models, you only need to modify the corresponding model name. If the model request/response parameters are inconsistent with OpenAI, GeekAI will automatically convert and align them at the backend.
cURL Request Example
curl --location 'https://geekai.dev/api/v1/audio/transcriptions' \
--header 'Authorization: {YOUR_GEEKAI_API_KEY}' \
--form 'file=@"/C:/User/GeekAI/Downloads/2cd359fe642c33deaa943f7306d73f30.mp3"' \
--form 'model="whisper-1"' \
--form 'response_format="text"'
Authorizations
bearerAuthapiKeyAuth
API认证token
Body
multipart/form-data
语音识别模型
音频文件
提示文本,用于指导转录风格
音频语言
响应格式,
Available options:
text, srt, vtt, json 是否返回流式响应,默认false,whisper-1 模型不支持该设置
Example:
true
采样温度,控制输出的随机性
自动重试次数,默认0,表示失败不重试
Response
成功响应
纯文本格式的转录结果
Was this page helpful?
⌘I
