Registry / ai-ml / pyannoteai-sdk

pyannoteai-sdk

JSON →
library0.4.0pypypi✓ verified 26d ago

The official pyannoteAI Python SDK provides a convenient way to interact with the pyannoteAI platform. It offers state-of-the-art AI models for tasks like speaker diarization (who spoke when), speaker identification, and STT orchestration (speech-to-text with speaker attribution) via a cloud API. The library is actively maintained, with frequent releases bringing new features and improvements.

pip install pyannoteai-sdk
INSTALL
IMPORT
SIG · PYANNOTEAI-SDK
P
pyannoteai-sdk
ai-mlpythonv0.4.0
Install
2.2s avg
Import
379ms
Disk
19MB
Pass rate
8/ 10
Env Coverage8 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.4.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
✓ —
✓ 2.4s
py 3.11
✓ —
✓ 2.3s
py 3.12
✓ —
✓ 2s
py 3.13
✓ —
✓ 2.1s
py 3.9
✕ build_error
✕ build_error
19MB installed
● package 19MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Client
from pyannoteai.sdk import Client

This quickstart demonstrates how to initialize the pyannoteAI client with your API key and submit an audio file for speaker diarization. It then fetches and prints the diarization results. Remember to replace `YOUR_API_KEY_HERE` with a valid key from your pyannoteAI dashboard and use a publicly accessible audio URL.

import os from pyannoteai.sdk import Client # Ensure your API key is set as an environment variable or passed directly # It's recommended to set PYANNOTE_API_KEY as an environment variable in production api_key = os.environ.get('PYANNOTE_API_KEY', 'YOUR_API_KEY_HERE') if api_key == 'YOUR_API_KEY_HERE': print("Warning: Please replace 'YOUR_API_KEY_HERE' with your actual pyannoteAI API key or set the PYANNOTE_API_KEY environment variable.") client = Client(api_key) # Example audio URL (replace with your audio file accessible via a direct public URL) audio_url = "https://files.pyannote.ai/samples/two_speakers.wav" try: # Submit a diarization job job_id = client.diarize(audio_url) print(f"Diarization job submitted with ID: {job_id}") # Wait for the job to complete and retrieve results # In a real application, you might use webhooks or polling for job status job_result = client.get_job_result(job_id) if job_result and job_result.get("status") == "completed": print("Diarization Result:") for segment in job_result.get("output", {}).get("segments", []): start = segment["start"] end = segment["end"] speaker = segment["speaker"] print(f"[ {start:.2f}s - {end:.2f}s ] Speaker {speaker}") else: print(f"Job {job_id} status: {job_result.get('status')}") print(f"Error: {job_result.get('error', 'Unknown error')}") except Exception as e: print(f"An error occurred: {e}")
Debug
Known issues
gotchaAPI keys are sensitive. Do not hardcode them in your codebase or expose them in client-side code or public repositories. It is highly recommended to use environment variables (e.g., `PYANNOTE_API_KEY`) for secure access.
fix
Store API keys as environment variables and access them using `os.environ.get('PYANNOTE_API_KEY')`.
affects: All versions
gotchaThe `diarize` and `identify` methods require a direct, publicly accessible URL to your audio file. Indirect URLs (requiring authentication, CAPTCHA, or a landing page) or private cloud storage URLs will result in 'Could not load audio' errors. Ensure the URL points directly to the file itself (e.g., ends with .wav, .mp3).
fix
Use direct, publicly accessible URLs for audio files. For cloud storage, generate signed URLs if the files are private, or upload them to pyannoteAI's servers directly using the SDK if supported.
affects: All versions
gotchaThe pyannoteAI API imposes limits on file size and audio duration. Diarization and identification jobs support files up to 1 GiB and 24 hours duration. Voiceprint jobs have tighter limits of 100 MiB and 30 seconds duration.
fix
Ensure your audio files adhere to the specified size and duration limits before submitting them. Consider pre-processing or splitting larger files if necessary.
affects: All versions
gotchaThe `pyannoteai-sdk` interacts with the pyannoteAI cloud platform, which utilizes premium, improved versions of the pyannote diarization models. These are distinct from the open-source `pyannote.audio` library, offering potentially higher accuracy and speed for specific use cases.
fix
Be aware that benchmarks and features might differ between the cloud API accessed via this SDK and the locally run open-source `pyannote.audio` library.
affects: All versions
gotchaJob results from the pyannoteAI API are automatically deleted after 24 hours. If you need to retain the results for longer, you must retrieve and save them to your own storage within this timeframe.
fix
Implement logic to poll for job completion and download/store the `get_job_result` output promptly.
affects: All versions
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'pyannoteai.sdk'
The `pyannoteai-sdk` library is not installed in your Python environment, or the environment where you are running your code is not the one where the library was installed.
fix
Install the SDK using pip: `pip install pyannoteai-sdk`
pyannoteai-sdk invalid api key
The API key provided when initializing the `Client` is either missing, incorrect, expired, or does not have the necessary permissions to access the pyannoteAI platform.
fix
Ensure you have generated a valid API key from your pyannoteAI dashboard (dashboard.pyannote.ai), copied it correctly, and are passing it to the `Client` constructor. Example: `client = Client('YOUR_API_KEY_HERE')`
'Could not load audio' Error
The pyannoteAI platform was unable to access the audio file provided, often due to an invalid, indirect, or expired URL, incorrect file permissions, or the file exceeding size limits.
fix
Verify that the audio file URL is a direct link, publicly accessible, not expired, and does not require authentication. Also, check that the file size is within the allowed limits (1GiB for diarization/identification, 100MiB for voiceprints).
pyannoteai.sdk.client.PyannoteAIFailedJob: ('An error occurred while processing the audio.', 'job_id')
A job submitted to the pyannoteAI platform failed during processing due to issues such as no speech detected in the audio, an invalid audio format, a file being too large, or other server-side processing errors.
fix
Examine the specific error message provided within the `PyannoteAIFailedJob` exception (e.g., 'no_speech_detected', 'file_not_audio', 'file_too_large'). Adjust your input audio or job parameters accordingly. For persistent or 'unknown_error' issues, consult the pyannoteAI troubleshooting guide or contact support.
Upgrade
Version history
0.4.0latest on PyPI · released Jan 14, 2026
Audit
Dependencies
requestsrequiredHTTP client for API interaction.
Agent activity
27 hits · last 30 days
node
22
Bingbot
1
Perplexity
1
OpenAI (training)
1
Resources
pyannoteai-sdk — pip install pyannoteai-sdk · libregistry