Introducing ChatGPT and Whisper APIs

If you want to get Whisper transcriptions in python and not deal with the overhead of the OpenAI python bindings, here is the python code I came up with:

import requests
import os

ApiKey = os.environ.get("ApiKey")

headers = {
    'Authorization': f'Bearer {ApiKey}'
}

files = {
    'file': open('/local/path/to/your/file/audio.wav', 'rb'),
    'model': (None, 'whisper-1'),
}

response = requests.post('https://api.openai.com/v1/audio/transcriptions', headers=headers, files=files)

print(response.json())
5 Likes