from openai import OpenAI import glob client = OpenAI() # Find all chunk files like finity_000.wav, finity_001.wav, ... chunk_files = sorted(glob.glob("finity_*.wav")) all_text = [] for fname in chunk_files: print(f"Transcribing {fname}...") with open(fname, "rb") as audio_file: tr = client.audio.transcriptions.create( model="gpt-4o-mini-transcribe", file=audio_file, language="en", # optional ) # `tr` is a Transcription object with `.text` all_text.append(tr.text) full = "\n\n".join(all_text) with open("finity-full-transcript.txt", "w", encoding="utf-8") as f: f.write(full) print("Done, wrote finity-full-transcript.txt")