Developers
Quickstart
Install the SDK, restore audio in one call, and save the output. Review Diffio API behavior, response fields, setup details, and production workflows.
Restore speech audio by creating a project with your media file, running multiple generations, and downloading results. This quickstart sets your API key, installs the SDK, and walks through each step.
Prerequisites
Before you start, have these ready.
- A Diffio API key with read and write permissions.
- A speech focused audio file, for example sample.wav.
- Python 3.8 or later, or Node 18 or later.
Workflow overview
Projects hold your media. Each project can have multiple generations, often one per model, and you can download each result.
Using the Diffio SDK
- 1
Create an API key
Create an API key in the developer dashboard and store it as a secret. Pass the key on every request using the Authorization header (X-Api-Key and Xi-Api-Key also work).
.envDIFFIO_API_KEY=diffio_live_... - 2
Install the SDK
Install the Diffio SDK for Python or Node, then load the API key from the environment.
Pythonpip install diffio python-dotenvSDK source codeBrowse the SDK repositories on GitHub: diffio-js and diffio-python .
- 3
Create a project
Create a file named
example.pyorexample.mjs. Then create a project for your media file. The SDK uploads the file as part of project creation.Pythonfrom dotenv import load_dotenvfrom diffio import DiffioClientimport osload_dotenv()client = DiffioClient(apiKey=os.getenv("DIFFIO_API_KEY"))file_path = "sample.wav"project = client.create_project( filePath=file_path,) - 4
Run multiple generations
Create three generations, one per model, so you can compare the results.
Pythonmodels = ["diffio-2", "diffio-3.5"]generations = []for model in models: generation = client.create_generation( apiProjectId=project.apiProjectId, model=model, ) generations.append({"model": model, "generation": generation}) - 5
Download each result
Add this block near the end of the file, then poll each generation and download restored audio plus transcript JSON. Move the
node:fsimport to the top of the file with the other imports.Pythonimport timefor item in generations: status = "queued" while status not in ("complete", "failed"): progress = client.generations.get_progress( generationId=item["generation"].generationId, apiProjectId=project.apiProjectId, ) status = progress.status print(item["model"], "status:", status) if status not in ("complete", "failed"): time.sleep(5) if status != "complete": raise SystemExit(f"Generation failed for {item['model']}") output_name = f"restored-{item['model']}.mp3" client.generations.download( generationId=item["generation"].generationId, apiProjectId=project.apiProjectId, downloadFilePath=output_name, downloadType="mp3", ) transcript_name = f"transcript-{item['model']}.json" client.generations.download( generationId=item["generation"].generationId, apiProjectId=project.apiProjectId, downloadFilePath=transcript_name, downloadType="transcript", )TroubleshootingIf you receive
401Unauthorized, treated as auth error. or403Forbidden, treated as permission error., confirm the API key is valid and has read and write permissions. A402Payment required, billing issue such as paymentFailed. API usage can be blocked until billing is updated. error indicates a billing issue such as a spend limit or apaymentFailedbilling hold. API usage can be blocked until billing is updated. A409Conflict, treated as not ready yet. error indicates the generation is not complete yet, poll progress and retry the download.
