Skip to content

For AI agents: every API docs page in one plain-text file is at /docs/llms-full.txt, and the documentation index is at /llms.txt. This page is available as Markdown at https://diffio.ai/docs/developers/quick-start.md, and every docs URL returns Markdown when requested with Accept: text/markdown.

Quickstart: restore audio in Python or Node

Create an API key, install the SDK and restore a speech recording in one call with Python, Node.js or cURL.

Prerequisites

  • A Diffio API key with Write permission enabled
  • A speech audio or video file up to 2 GB, such as interview.mp3
  • Python 3.8+, Node 18+, or curl and jq

Restore your first file

  1. 1

    Create an API key

    Create an API key in the developer dashboard with Write permission enabled, then copy it right away (the secret is shown once). Pass it as Authorization: Bearer <key> on API requests, or set DIFFIO_API_KEY so the SDK reads it automatically.

    Terminal
    export DIFFIO_API_KEY="diffio_live_..."
  2. 2

    Install the SDK

    Install the Diffio SDK for Python or Node.js, or use curl and jq directly.

    pip install diffio
    SDK source code

    Browse the SDK repositories on GitHub: diffio-python and diffio-js.

  3. 3

    Restore a file in one call

    Run a restore on interview.mp3 with diffio-flash (the alias for diffio-4.7-flash). The SDK helper creates the project with a queued generation, uploads the file via upload.requests, marks the upload complete, polls until status is complete and saves the restored MP3.

    from diffio import DiffioClient
    
    client = DiffioClient()  # reads DIFFIO_API_KEY
    
    result = client.restore_audio(
        "interview.mp3",
        model="diffio-flash",
        output_path="interview-restored.mp3",
        on_progress=lambda generation: print(generation.status, generation.stage),
    )
    print(result.project.id, result.generation.id, result.output_path)

    Expected result

    The generation reaches status: "complete" on diffio-4.7-flash and writes the restored recording to interview-restored.mp3; each tab prints the project id, the generation id and the file. To fetch the word-timed transcript too, call Get a generation's transcript with the returned project and generation ids.

How it fits together

Projects hold your uploaded audio or video. Each project can run one or more generations across Diffio models, and you fetch temporary URLs from generation media to stream or download restored files.

Create a project with a media file, run multiple generations with different models, then download the results.

  1. 1Create projectwith your audio or video file
  2. 2Generationsdiffio-4.7-flashdiffio-4.7-pro
  3. 3Download resultsrestored audio, video or transcript

Troubleshooting

  • 401Unauthorized: the API key is missing or invalid.403Forbidden: the key lacks permission.Pass Authorization: Bearer <key> with an active key that has Write permission.

    The key is missing (missing_api_key), invalid (invalid_api_key), inactive, or lacks Write permission (permission_denied).

  • 402Payment required: see error.code for the billing problem.insufficient_creditAdd credit on the Billing page of the developer dashboard.

    Your API credit is used up, or cannot cover the file.

  • 409Conflict: see error.code for which one.not_readyPoll the generation until status is complete, or finish uploading first.

    The generation, transcript, or separated tracks are still processing (not_ready), or upload/complete ran before the upload arrived (upload_missing).

Every error response includes error.code, error.message and error.request_id. Full error handling and retry rules are in the Full API guide.

Next steps

Working with a coding agent? Build with AI agents gives it every docs page as plain text, with a ready prompt.

New releases, and which SDK version talks to which API version, are listed in the Changelog.

Report an issue with this page