chengsokdara / use-whisper

React hook for OpenAI Whisper with speech recorder, real-time transcription, and silence removal built-in
MIT License
733 stars 139 forks source link

error while streaming or after stop recording POST https://api.openai.com/v1/audio/transcriptions 401 #48

Open alihinnawe opened 1 year ago

alihinnawe commented 1 year ago

Hi, iam running a 401 error while iam speaking:
I am using REACT Nextjs. xhr.js:251 POST https://api.openai.com/v1/audio/transcriptions 401 dispatchXhrRequest @ xhr.js:251 xhr @ xhr.js:49 dispatchRequest @ dispatchRequest.js:51 request @ Axios.js:146 httpMethod @ Axios.js:185 wrap @ bind.js:5 eval @ chunk-32KRFHOA.js:5 await in eval (async) eval @ chunk-YORICPLC.js:1 Z @ chunk-32KRFHOA.js:5 await in Z (async) eval @ RecordRTC.js:3201 webWorker.onmessage @ RecordRTC.js:2810 client.js:1 useMemo AxiosError {message: 'Request failed with status code 401', name: 'AxiosError', code: 'ERR_BAD_REQUEST', config: {…}, request: XMLHttpRequest, …}

the status of transcribing was true when i was recording but producing this error

The code iam using is the same as you provided exept my API token Any suggestions and help please?

`import { useWhisper } from "@chengsokdara/use-whisper";

const LiveWhisper = () => { const { recording, speaking, transcribing, transcript, pauseRecording, startRecording, stopRecording, } = useWhisper({ apiKey: process.env.NEXT_PUBLIC_OPENAI_API_TOKEN, // YOUR_OPEN_AI_TOKEN streaming: true, timeSlice: 1_000, // 1 second whisperConfig: { language: "en", }, }); console.log( ``

return (

Recording: {recording}

Speaking: {speaking}

Transcribing: {transcribing}

Transcribed Text: {transcript.text}

); };

export default LiveWhisper; `

SinazoBogicevic commented 2 months ago

Hey @alihinnawe did you ever solve this issue?

alihinnawe commented 2 months ago

@SinazoBogicevic no i used react speech to text library installed