curl --request POST \
--url https://fanifyai.com/api/v1/hub/audio/transcriptions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form file=@example-file \
--form 'model=<string>' \
--form 'language=<string>' \
--form temperature=123 \
--form 'prompt=<string>'import requests
url = "https://fanifyai.com/api/v1/hub/audio/transcriptions"
files = { "file": ("example-file", open("example-file", "rb")) }
payload = {
"model": "<string>",
"language": "<string>",
"temperature": "123",
"prompt": "<string>"
}
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('file', '<string>');
form.append('model', '<string>');
form.append('language', '<string>');
form.append('temperature', '123');
form.append('prompt', '<string>');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://fanifyai.com/api/v1/hub/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://fanifyai.com/api/v1/hub/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=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"model\"\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=\"temperature\"\r\n\r\n123\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"prompt\"\r\n\r\n<string>\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://fanifyai.com/api/v1/hub/audio/transcriptions"
payload := strings.NewReader("-----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=\"model\"\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=\"temperature\"\r\n\r\n123\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"prompt\"\r\n\r\n<string>\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://fanifyai.com/api/v1/hub/audio/transcriptions")
.header("Authorization", "Bearer <token>")
.body("-----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=\"model\"\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=\"temperature\"\r\n\r\n123\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"prompt\"\r\n\r\n<string>\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://fanifyai.com/api/v1/hub/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=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"model\"\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=\"temperature\"\r\n\r\n123\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"prompt\"\r\n\r\n<string>\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"text": "Hi, it's Paul. Are you free tonight?",
"language": "en",
"duration": 3.4,
"segments": [
{
"id": 0,
"start": 0,
"end": 3.4,
"text": "Hi, it's Paul. Are you free tonight?"
}
],
"usage": {
"type": "duration",
"seconds": 4,
"cost": 0.000001
}
}{
"error": {
"message": "The request input is invalid.",
"code": "invalid_input",
"type": "invalid_request_error"
}
}{
"type": "https://fanifyai.com/docs/hub/errors#unauthorized",
"title": "Unauthorized",
"status": 401,
"code": "unauthorized"
}{
"error": {
"message": "Your available balance does not cover this generation.",
"code": "insufficient_credits",
"type": "invalid_request_error"
}
}{
"error": {
"message": "The requested model was not found.",
"code": "model_not_found",
"type": "invalid_request_error"
}
}{
"error": {
"message": "The requested file has expired or is unavailable.",
"code": "file_expired",
"type": "invalid_request_error"
}
}{
"error": {
"message": "The uploaded file exceeds the allowed size.",
"code": "payload_too_large",
"type": "invalid_request_error"
}
}{
"error": {
"message": "This idempotency key was already used with a different request.",
"code": "idempotency_conflict",
"type": "invalid_request_error"
}
}{
"error": {
"message": "Rate limit reached, retry later.",
"code": "rate_limited",
"type": "invalid_request_error"
}
}{
"error": {
"message": "A generation with this idempotency key is still in progress.",
"code": "generation_in_progress",
"type": "invalid_request_error"
}
}Transcription
Transcribes an audio file synchronously (transcription models only), as OpenAI-compatible multipart or as JSON input_audio. Up to 25 MB of mp3, wav, ogg, webm, m4a, mp4, flac or aac audio; audio URLs are not accepted. Billed per second of audio, rounded up to the next 0.000001 EUR. Provider failures preserve an upstream 4xx status, except 401 and 402 which return 503, and use the provider_error code; upstream 5xx failures return 503.
curl --request POST \
--url https://fanifyai.com/api/v1/hub/audio/transcriptions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form file=@example-file \
--form 'model=<string>' \
--form 'language=<string>' \
--form temperature=123 \
--form 'prompt=<string>'import requests
url = "https://fanifyai.com/api/v1/hub/audio/transcriptions"
files = { "file": ("example-file", open("example-file", "rb")) }
payload = {
"model": "<string>",
"language": "<string>",
"temperature": "123",
"prompt": "<string>"
}
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('file', '<string>');
form.append('model', '<string>');
form.append('language', '<string>');
form.append('temperature', '123');
form.append('prompt', '<string>');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://fanifyai.com/api/v1/hub/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://fanifyai.com/api/v1/hub/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=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"model\"\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=\"temperature\"\r\n\r\n123\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"prompt\"\r\n\r\n<string>\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://fanifyai.com/api/v1/hub/audio/transcriptions"
payload := strings.NewReader("-----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=\"model\"\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=\"temperature\"\r\n\r\n123\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"prompt\"\r\n\r\n<string>\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://fanifyai.com/api/v1/hub/audio/transcriptions")
.header("Authorization", "Bearer <token>")
.body("-----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=\"model\"\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=\"temperature\"\r\n\r\n123\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"prompt\"\r\n\r\n<string>\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://fanifyai.com/api/v1/hub/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=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"model\"\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=\"temperature\"\r\n\r\n123\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"prompt\"\r\n\r\n<string>\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"text": "Hi, it's Paul. Are you free tonight?",
"language": "en",
"duration": 3.4,
"segments": [
{
"id": 0,
"start": 0,
"end": 3.4,
"text": "Hi, it's Paul. Are you free tonight?"
}
],
"usage": {
"type": "duration",
"seconds": 4,
"cost": 0.000001
}
}{
"error": {
"message": "The request input is invalid.",
"code": "invalid_input",
"type": "invalid_request_error"
}
}{
"type": "https://fanifyai.com/docs/hub/errors#unauthorized",
"title": "Unauthorized",
"status": 401,
"code": "unauthorized"
}{
"error": {
"message": "Your available balance does not cover this generation.",
"code": "insufficient_credits",
"type": "invalid_request_error"
}
}{
"error": {
"message": "The requested model was not found.",
"code": "model_not_found",
"type": "invalid_request_error"
}
}{
"error": {
"message": "The requested file has expired or is unavailable.",
"code": "file_expired",
"type": "invalid_request_error"
}
}{
"error": {
"message": "The uploaded file exceeds the allowed size.",
"code": "payload_too_large",
"type": "invalid_request_error"
}
}{
"error": {
"message": "This idempotency key was already used with a different request.",
"code": "idempotency_conflict",
"type": "invalid_request_error"
}
}{
"error": {
"message": "Rate limit reached, retry later.",
"code": "rate_limited",
"type": "invalid_request_error"
}
}{
"error": {
"message": "A generation with this idempotency key is still in progress.",
"code": "generation_in_progress",
"type": "invalid_request_error"
}
}En-têtes
Corps
multipart/form-data (recommended) or JSON with base64 input_audio. Unknown fields are forwarded; stream and audio URLs (source_url, input_audio.url) are refused.
Réponse
OpenAI-compatible transcription: text, plus language, duration and segments[] or words[] with verbose_json. usage.seconds is the billed audio duration, usage.cost the billed cost in EUR.
The response is of type object.
Cette page vous a-t-elle été utile ?
