Skip to main content
The official Python SDK provides a convenient way to interact with the Sully.ai API from your Python applications. It includes type hints, Pydantic models for response validation, and supports both synchronous and asynchronous usage.

Installation

Install the SDK using pip:

Quick Setup

Environment Variables

Set your API credentials as environment variables:

Initialize the Client

Sync vs Async

The SDK provides both synchronous and asynchronous clients to fit your application’s needs.

Synchronous Client

Use SullyAI for standard synchronous operations:

Asynchronous Client

Use AsyncSullyAI for async applications with asyncio:

Audio Transcriptions

Upload a File

Submit an audio file for transcription:

Poll for Completion

Audio transcription is an asynchronous process. Poll until it completes: Synchronous polling:
Asynchronous polling:

Delete a Transcription

Remove a transcription when no longer needed:

Notes

Create a SOAP Note

Generate a SOAP note from a transcript:

Create with Context

Provide additional context to improve note quality:

Retrieve a Note

Poll for the completed note:

Response Handling

Pydantic Models

All API responses are returned as Pydantic models with full type hints:

Serialization Methods

Convert responses to different formats:

Distinguishing Null vs Missing Fields

Use model_fields_set to check which fields were explicitly returned:

Error Handling

The SDK raises specific exceptions for different error conditions:

Exception Classes

Automatic Retries

The SDK automatically retries failed requests with exponential backoff. By default, it attempts 2 retries for transient errors (network issues, 5xx errors).

Timeouts

Configure timeouts to control how long the client waits for responses.

Global Timeout

Set a default timeout for all requests:

Per-Request Timeout

Override the timeout for individual requests:

Next Steps

Audio Transcription Guide

Learn about transcription options and best practices

Error Handling Guide

Understand API events and error responses