Grab an audio file of your choice, or download this audio file
and save it as sample.mp3 in the same directory where you will save the Python script below.
Our API works best with common audio formats like MP3, WAV, M4A, OGG, WEBM, and FLAC.
from fennec_asr import FennecASRClientprint(FennecASRClient(api_key="YOUR_API_KEY").transcribe_file(r"sample.mp3"))
Don’t want to use the SDK? See the example code below:
Example Code
quickstart.py
import osimport timeimport requestsBASE_URL = "https://api.fennec-asr.com/api/v1"API_KEY = "YOUR_API_KEY_HERE" # 👈 Paste your API key hereAUDIO_PATH = "sample.mp3"POLL_INTERVAL_S = 3def transcribe_audio(): if not os.path.exists(AUDIO_PATH): print(f"❌ Error: Audio file not found at '{AUDIO_PATH}'.") print(" Please make sure the audio file is in the same directory as this script.") return if "YOUR_API_KEY_HERE" in API_KEY: print("❌ Error: Please replace 'YOUR_API_KEY_HERE' with your actual API key.") return headers = {"X-API-Key": API_KEY} with open(AUDIO_PATH, "rb") as audio_file: files = {"audio": (os.path.basename(AUDIO_PATH), audio_file, "audio/mpeg")} print(f"Submitting '{AUDIO_PATH}' for transcription...") try: # 1. Submit the job submit_response = requests.post(f"{BASE_URL}/transcribe", headers=headers, files=files) submit_response.raise_for_status() job_id = submit_response.json().get("job_id") print(f"✅ Job submitted successfully! Job ID: {job_id}\n") # 2. Poll for the result status_url = f"{BASE_URL}/transcribe/status/{job_id}" while True: status_response = requests.get(status_url, headers=headers) status_response.raise_for_status() data = status_response.json() status = data.get("status") if status == "completed": print("\n🎉 Transcription Complete!") print("-" * 25) print(data.get("transcript")) print("-" * 25) break elif status == "failed": print("\n❌ Transcription failed.") print("Error:", data.get("transcript")) break else: print(f" Current status: '{status}'... waiting.") time.sleep(POLL_INTERVAL_S) except requests.exceptions.RequestException as e: print(f"An error occurred: {e}") if e.response: print(f"Response Body: {e.response.text}")# --- Run the script ---if __name__ == "__main__": transcribe_audio()