{"id":8595,"library":"rev-ai","title":"Rev AI Python SDK","description":"The Rev AI Python SDK provides convenient access to the Rev AI Speech-to-Text APIs, enabling developers to easily integrate asynchronous and streaming speech recognition capabilities into their Python applications. It handles audio transcription for both local files and remote URLs. The library is actively maintained and receives regular updates, with the current version being 2.21.0.","status":"active","version":"2.21.0","language":"en","source_language":"en","source_url":"https://github.com/revdotcom/revai-python-sdk","tags":["speech-to-text","ASR","audio","transcription","AI","Rev AI","voice"],"install":[{"cmd":"pip install --upgrade rev-ai","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"HTTP client for API communication.","package":"requests","optional":false}],"imports":[{"note":"RevAiAPIClient is exposed directly under `rev_ai.apiclient`, so `from rev_ai import apiclient` and then `apiclient.RevAiAPIClient` is the standard pattern.","wrong":"from rev_ai.apiclient import RevAiAPIClient","symbol":"RevAiAPIClient","correct":"from rev_ai import apiclient"},{"symbol":"RevAiStreamingClient","correct":"from rev_ai.streamingclient import RevAiStreamingClient"},{"symbol":"MediaConfig","correct":"from rev_ai.models import MediaConfig"},{"note":"Used for configuring specific API deployment regions, e.g., for EU.","symbol":"RevAiApiDeployment","correct":"from rev_ai import apiclient, RevAiApiDeploymentConfigMap, RevAiApiDeployment"}],"quickstart":{"code":"import os\nimport time\nfrom rev_ai import apiclient\n\nREVAI_ACCESS_TOKEN = os.environ.get('REVAI_ACCESS_TOKEN', 'YOUR_REVAI_ACCESS_TOKEN')\nAUDIO_FILE_PATH = 'path/to/your/audio.mp3'  # Replace with your audio file path\n\nif not REVAI_ACCESS_TOKEN or REVAI_ACCESS_TOKEN == 'YOUR_REVAI_ACCESS_TOKEN':\n    print(\"Please set the REVAI_ACCESS_TOKEN environment variable or replace 'YOUR_REVAI_ACCESS_TOKEN' with your actual token.\")\n    exit(1)\n\nif not os.path.exists(AUDIO_FILE_PATH):\n    print(f\"Audio file not found: {AUDIO_FILE_PATH}\")\n    print(\"Please replace 'path/to/your/audio.mp3' with a valid audio file path.\")\n    exit(1)\n\n# Create your client\nclient = apiclient.RevAiAPIClient(REVAI_ACCESS_TOKEN)\n\nprint(f\"Submitting job for: {AUDIO_FILE_PATH}\")\n# Submit a local file for transcription\njob = client.submit_job_local_file(AUDIO_FILE_PATH)\n\njob_id = job.id\nprint(f\"Job submitted with ID: {job_id}\")\n\n# Polling for job completion (simple example, consider webhooks for production)\nwhile True:\n    job_details = client.get_job_details(job_id)\n    if job_details.status == 'transcribed':\n        print(\"Job transcribed successfully!\")\n        break\n    elif job_details.status == 'failed':\n        print(f\"Job failed: {job_details.failure_detail}\")\n        exit(1)\n    else:\n        print(f\"Job status: {job_details.status}... waiting\")\n        time.sleep(5) # Wait 5 seconds before checking again\n\n# Retrieve transcript as text\ntranscript_text = client.get_transcript_text(job_id)\nprint(\"\\n--- Transcript (Text) ---\")\nprint(transcript_text[:500]) # Print first 500 characters\nprint(\"...\")\n\n# You can also retrieve as JSON or a Python object\n# transcript_json = client.get_transcript_json(job_id)\n# transcript_object = client.get_transcript_object(job_id)\n\n# Delete the job (optional, but good practice for cost/data management)\nclient.delete_job(job_id)\nprint(f\"Job {job_id} deleted.\")\n","lang":"python","description":"This quickstart demonstrates how to initialize the Rev AI client, submit a local audio file for transcription, poll for job completion, retrieve the transcript as text, and finally delete the job. Remember to replace the placeholder `AUDIO_FILE_PATH` and set your `REVAI_ACCESS_TOKEN` environment variable."},"warnings":[{"fix":"Migrate to `source_config` for specifying audio URLs and `notification_config` for webhook callbacks. These new parameters offer enhanced security and allow for authentication headers.","message":"The `media_url` and `callback_url` parameters were deprecated in SDK version 2.16.0 in favor of `source_config` and `notification_config`. While the old parameters are still supported in the API, future SDK versions may remove support.","severity":"breaking","affected_versions":">=2.16.0"},{"fix":"Implement robust error handling and retry mechanisms with exponential backoff. For large-scale usage, consider optimizing job submission patterns or contacting Rev AI support to adjust limits.","message":"Rev AI APIs have rate limits (e.g., 10,000 requests/10 minutes, 500 processed/10 minutes) and file size limits (2GB for multipart/form-data, 5TB via `source_config` with URL). Exceeding these limits can lead to queued jobs or API errors.","severity":"gotcha","affected_versions":"All"},{"fix":"When initializing `RevAiAPIClient`, pass the correct `url` parameter using `RevAiApiDeploymentConfigMap` and `RevAiApiDeployment` for your specific region (e.g., EU).","message":"Different base URLs are used for non-US deployments. Using the incorrect base URL for your selected deployment will result in connection errors or incorrect data routing.","severity":"gotcha","affected_versions":"All"},{"fix":"For production applications, use webhooks (`notification_config`) to receive asynchronous notifications when a job's status changes.","message":"Polling for job status, as shown in simple quickstarts, is inefficient for high-volume or long-running jobs. It can lead to unnecessary API calls and potential rate limiting.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Ensure your `REVAI_ACCESS_TOKEN` environment variable or direct client initialization uses a valid, current access token from your Rev AI account.","cause":"The provided Rev AI Access Token is invalid, expired, or missing in the request.","error":"401 Authorization Denied"},{"fix":"Consult the Rev AI API documentation for a list of supported languages and their availability for asynchronous, streaming, or specific transcriber models. Ensure the `language` parameter (if used) matches a supported code.","cause":"Attempting to transcribe audio in a language that the Rev AI API does not currently support for the specified transcriber or API endpoint.","error":"Error: Unsupported Language - The requested language is not supported by the API."},{"fix":"Verify the callback URL is publicly accessible, correctly configured, and that your server is running and can process incoming POST requests from Rev AI. Test the URL independently.","cause":"The webhook URL provided in `notification_config` (or deprecated `callback_url`) is inaccessible, misconfigured, or your server failed to respond correctly to Rev AI's callback.","error":"Callback Failure: Callback URL unreachable or server did not respond."},{"fix":"Carefully review the Rev AI API documentation for the specific endpoint and ensure all required parameters are present and correctly formatted, and that values are within acceptable ranges.","cause":"One or more parameters submitted with your transcription job (e.g., file path, custom vocabulary, API options) are invalid, missing, or malformed according to the API specification.","error":"400 Invalid Request / Malformed input"}]}