Anyone with this issue? It stopped working for me a about 10 minutes ago…
I’m curious if other members are having the same issue, on openai status it doesn’t have a report that the API is having an issue
Anyone with this issue? It stopped working for me a about 10 minutes ago…
I’m curious if other members are having the same issue, on openai status it doesn’t have a report that the API is having an issue
have been using it all day till now, so no
What error did you receive from the API? I haven’t received any notification but still I suggest you always check https://status.openai.com/ and subscribe to their notifications
Today the end-point listed in the docs gives a 404 error. Subsequently the API endpoint on Groq is giving a 520 bad Gateway like it was moved, but the documentation still lists the same URL. What’s going on with all the whispers? Lol
It’s working.
HEADERS = {'Authorization': f'Bearer {API_KEY}'}
ENDPOINT = "https://api.openai.com/v1/audio/transcriptions"
import httpx
import os
API_KEY = os.getenv('OPENAI_API_KEY')
HEADERS = {'Authorization': f'Bearer {API_KEY}'}
ENDPOINT = "https://api.openai.com/v1/audio/transcriptions"
input_file_path = "audio.mp3"
output_file_path = input_file_path + "-transcript.txt"
def transcribe_audio(input_path: str, output_path: str) -> None:
# Prepare the file for upload
with open(input_path, 'rb') as file:
files = {'file': (input_path, file, 'audio/mpeg')}
data = {
'model': 'whisper-1',
'language': 'en',
'prompt': 'Hello, and welcome to our talk.',
'response_format': 'json'
}
# Adjust the timeout settings for the request
timeout = httpx.Timeout(600.0, connect=120.0)
# Make the API request
try:
with httpx.Client(timeout=timeout) as client:
response = client.post(ENDPOINT, headers=HEADERS, files=files, data=data)
response.raise_for_status() # Will raise an exception for HTTP error responses
transcription = response.json()
except httpx.ReadTimeout:
print("The request timed out while waiting for the server to send data.")
return
except Exception as e:
print(f"API request failed: {e}")
return
# Extract the text from the JSON response
transcribed_text = transcription.get('text', '')
# Save the transcribed text to a file
try:
with open(output_path, "w") as out_file:
out_file.write(transcribed_text)
print(f"--- Transcribed text successfully saved to '{output_path}'.")
except Exception as e:
print(f"Error writing to output file: {e}")
# Optionally print an excerpt of the transcript
print(elide_text(transcribed_text))
def elide_text(text: str, start: int = 240, end: int = 240, ellipsis: str = '\n...\n') -> str:
if len(text) <= start + end:
return text
return text[:start] + ellipsis + text[-end:]
# Call the function to transcribe audio
transcribe_audio(input_file_path, output_file_path)
Weird. I am still getting 404 back with your script. Maybe this is DNS propagation related.
a couple of hours after I had that issue in May, it started working again