Diffio 2.0
BalancedFast, reliable cleanup for everyday restoration.
- Fastest turnaround in the product lineup.
- Reliable cleanup for interviews and podcasts.
- Best fit for high volume production queues.

Developers
Run the complete flow with projects, generations, progress checks, downloads, and webhooks.
This guide expands on the quickstart and walks through most of the Diffio SDK surface. You will create projects, run generations, track progress, download results, list resources, and set up webhooks so your app can react to status changes. If you want the shortest path, start with the Quickstart.
Before you start, have these ready.
Projects hold your media. Each project can have one or more generations, and you can download each result.
Polling works for quick tests. For production, use webhooks so Diffio can notify you when a generation completes. See the Webhooks guide.
Follow these steps in order, and add each block to the same file. You will create a project, run a generation, wait for completion, and download the restored audio.
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).
DIFFIO_API_KEY=diffio_live_...Store your API key as a managed secret instead of committing it to source control.
Install the Diffio Python or Node SDK, then load your API key from an environment file.
pip install diffio python-dotenvBrowse the SDK repositories on GitHub: diffio-js and diffio-python .
Use Node 18 or later so fetch is available without extra packages.
Create a file named full_guide.py or full_guide.mjs. Then initialize the client and set global request options like timeouts and retries.
from dotenv import load_dotenvfrom diffio import DiffioClient, RequestOptionsimport osload_dotenv()client = DiffioClient( apiKey=os.getenv("DIFFIO_API_KEY"), requestOptions=RequestOptions( timeoutInSeconds=60, maxRetries=2, ),) Every SDK call accepts requestOptions so you can override timeouts, retries, headers, or the API key for a single request.
Create a project for your media file. The SDK uploads the file as part of project creation. You can attach optional metadata through params.
file_path = "sample.wav"project = client.create_project( filePath=file_path, fileFormat="wav", params={ "source": "full-guide", "notes": "First upload from docs", },) Start a generation with the model you want. Use sampling or params for model specific settings.
generation = client.generations.create( apiProjectId=project.apiProjectId, model="diffio-3.5", sampling={"preset": "balanced"}, params={"tag": "docs"},)Poll until the generation completes. The wait helper returns the full progress object.
progress = client.generations.wait_for_complete( generationId=generation.generationId, apiProjectId=project.apiProjectId, pollInterval=3.0, timeout=900.0, showProgress=True,)print("Final status:", progress.status) You can combine creation and polling with client.generations.create_and_wait in Python or client.generations.createAndWait in Node.
Fetch the download URL, then save the restored audio. Signed URLs expire, so request a new URL if needed.
client.generations.download( generationId=generation.generationId, apiProjectId=project.apiProjectId, downloadFilePath="restored.mp3", downloadType="mp3",) If you receive 401Unauthorized, treated as auth error. or 403Forbidden, treated as permission error., confirm the API key is valid and has read and write permissions. A 402Payment 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 a paymentFailed billing hold. API usage can be blocked until billing is updated. A 409Conflict, treated as not ready yet. error indicates the generation is not complete yet, poll progress and retry the download.
Use list endpoints to build dashboards, resume work, or review past generations.
projects = client.projects.list()for project in projects.projects: print(project.apiProjectId, project.status, project.originalFileName)generations = client.projects.list_generations( apiProjectId=project.apiProjectId,)for generation in generations.generations: print(generation.generationId, generation.status, generation.modelKey)The audio isolation helper creates the project, starts a generation, waits for completion, and downloads the restored audio in one call.
from dotenv import load_dotenvfrom diffio import DiffioClientimport osload_dotenv()client = DiffioClient(apiKey=os.getenv("DIFFIO_API_KEY"))file_path = "sample.wav"audio_bytes, info = client.audio_isolation.restore_audio( filePath=file_path, model="diffio-3.5", downloadType="mp3",)if info["error"]: raise SystemExit(info["error"])with open("restored-one-call.mp3", "wb") as handle: handle.write(audio_bytes)The helper returns a metadata object with status, errors, and download info you can log or store alongside the result.
Webhooks let Diffio notify your service when a generation changes status. This is a condensed walkthrough. For full details, see the Webhooks guide.
Follow the webhook creation steps in the docs, then open the developer dashboard to add your endpoint URL and choose events. Save the signing secret for verification.
Each API key owns its own webhook endpoints and signing secrets.
Use the Diffio SDK helpers to verify signatures against the raw request body, not a parsed JSON object.
from fastapi import FastAPI, Request, HTTPExceptionfrom diffio import DiffioClientimport osapp = FastAPI()client = DiffioClient(apiKey=os.environ["DIFFIO_API_KEY"])@app.post("/webhooks/diffio")async def diffio_webhook(request: Request): payload = await request.body() try: event = client.webhooks.verify_signature( payload=payload, headers=request.headers, secret=os.environ["DIFFIO_WEBHOOK_SECRET"], ) except Exception: raise HTTPException(status_code=400, detail="Invalid signature") print("Webhook received", event.eventType) return {"ok": True}Use the SDKs to send a test event and confirm delivery in the portal.
from dotenv import load_dotenvfrom diffio import DiffioClientimport osload_dotenv()client = DiffioClient(apiKey=os.getenv("DIFFIO_API_KEY"))result = client.webhooks.send_test_event( eventType="generation.completed", mode="live",)print(result.svixMessageId) When you receive generation.completed, fetch the download URL and queue any heavy work.
from dotenv import load_dotenvfrom diffio import DiffioClientimport osload_dotenv()client = DiffioClient(apiKey=os.getenv("DIFFIO_API_KEY"))def handle_event(event): if event.eventType != "generation.completed": return download = client.generations.get_download( generationId=event.generationId, apiProjectId=event.apiProjectId, downloadType="audio", ) print("Download URL:", download.downloadUrl) Return a 200Success, treated as complete. response fast and push heavy work to a queue or background job.