<?php
$api_key="sk-dLwvC;
$audio_file="$argv[1]";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.openai.com/v1/audio/transcriptions');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Authorization: Bearer $api_key",
'Content-Type: multipart/form-data',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, [
'file' => new CURLFile("$audio_file"),
'model' => 'whisper-1',
]);
$response = curl_exec($ch);
$array = json_decode($response, true);
echo $array['text'];
curl_close($ch);
?>
curl https://api.openai.com/v1/audio/transcriptions \
-H "Authorization: Bearer MYAPIKEY" \
-H "Content-Type: multipart/form-data" \
-F file="@/home/ambiorixg12/Downloads/brussell-aportes-reg.mp3" \
-F model="whisper-1"
No hay comentarios:
Publicar un comentario