Skip to main content

Step 1: Get your API Key

Your API key is used to authenticate your requests. Follow this link to grab your first API key.

Step 2: Install the SDK

pip install fennec-asr
Let’s write a simple script to send a URL to the API.

Step 3: Transcribe!

from fennec_asr import FennecASRClient
print(FennecASRClient(api_key="YOUR_API_KEY").transcribe_url("https://upload.wikimedia.org/wikipedia/commons/3/3f/En-History_of_Corpus_Christi%2C_Texas.ogg"))
Don’t want to use the SDK? See the example code below:
quickstart.py
  import requests
  import json
  import time

  BASE_URL = "https://api.fennec-asr.com/api/v1"
  API_KEY = "YOUR_API_KEY_HERE"
  AUDIO_URL = "https://upload.wikimedia.org/wikipedia/commons/3/3f/En-History_of_Corpus_Christi%2C_Texas.ogg"
  POLL_INTERVAL_SECONDS = 3
  MAX_WAIT_SECONDS = 300

  headers = {"Content-Type": "application/json", "X-API-Key": API_KEY}
  payload = {"audio": AUDIO_URL, "context": "testing with a python script"}

  def transcribe_audio_url():
  try:
      # 1. Submit the job
      print("Submitting transcription job...")
      submit_response = requests.post(f"{BASE_URL}/transcribe/url", headers=headers, data=json.dumps(payload))
      submit_response.raise_for_status()
      job_info = submit_response.json()
      job_id = job_info.get("job_id")
      print(f"✅ Job submitted successfully! Job ID: {job_id}\n")

      # 2. Poll for the result
      start_time = time.time()
      while time.time() - start_time < MAX_WAIT_SECONDS:
          print("Polling for status...")
          status_url = f"{BASE_URL}/transcribe/status/{job_id}"
          status_response = requests.get(status_url, headers=headers)

          if status_response.status_code == 200:
              status_data = status_response.json()
              job_status = status_data.get("status")
              print(f"  Current status: '{job_status}'")

              if job_status == "completed":
                  print("\n🎉 Transcription complete!")
                  print("Transcript:", status_data.get("transcript"))
                  break
              elif job_status == "failed":
                  print("\n❌ Transcription failed.")
                  print("Error:", status_data.get("transcript"))  # Assuming error is stored in transcript field
                  break
          else:
              print(f"  Error polling status: {status_response.status_code}")

          time.sleep(POLL_INTERVAL_SECONDS)
      else:
          print("\n⏰ Polling timed out.")

  except requests.exceptions.RequestException as e:
      print(f"An error occurred: {e}")

  # --- Run the script ---
  if __name__ == "__main__":
      transcribe_audio_url()

Next Steps

Now that you’ve completed your first transcription, you can explore the API’s more powerful features.