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/full-api-guide.md, and every docs URL returns Markdown when requested with Accept: text/markdown.

Full API guide: workflow, topics and limits

The Diffio API on one page: the workflow, where each topic lives, and the rules and limits that apply to every call.

Workflow

Create a project with a media file, run one or more 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

Create a project, upload the file, run one or more generations, then read their media. A webhook tells your server when each one finishes.

Topics

Limits

LimitValue
File sizeup to 2 GB (2,147,483,648 bytes); larger is 413 upload_too_large
Media lengthno limit
Upload part size32 MiB (33,554,432 bytes)
Upload token24 hours (upload.expires_at)
Media URLs6 hours (expires_at); call GET …/media again
Share URLsuntil the share is revoked or changed, then stop within about a minute
Webhook timestamp tolerance300 seconds
Restore billingwhole seconds, 60 second minimum per restore
Transcript edit billing30 seconds per restored window, no minimum
Idempotency-Keyup to 255 characters
Diffio-End-Userup to 128 characters
Generation labelup to 120 characters
metadata50 keys; keys up to 40 characters, values up to 500
List pagelimit 1 to 100, default 20
Usage periodup to 366 days and 20,000 generations
Rate limitsno general per-key quota; the edit assistant allows 30 turns per 10 minutes plus a daily cap, assistant feedback 10 per hour; 429 rate_limited means retry with backoff
SDK defaults60 second timeout; 2 retries on 408, 429, 5xx and network errors, honouring Retry-After

Pagination

GET /projects and GET /projects/{project_id}/generations answer newest first with { object: "list", data, next_cursor }. Pass next_cursor as cursor until it is null; the SDKs can walk every page for you.

  1. GET/projects?limit=20data[] newest first, next_cursor
  2. GET/projects?cursor={next_cursor}until next_cursor is null
  3. Next/projects/{project_id}/generationswith a project's id
from diffio import DiffioClient

client = DiffioClient()  # reads DIFFIO_API_KEY

page = client.projects.list(limit=20)
print([project.id for project in page.data], page.next_cursor)

for project in client.projects.iter(limit=50):  # fetches every page as needed
    latest = project.latest_generation
    print(project.id, project.file_name, latest.status if latest else "no generation")

Idempotency

POST /projects (per account and end user), POST …/generations (per project) and POST …/edits (per edited generation) honour Idempotency-Key. The SDKs send a fresh key when you pass none, so their own retries never create twice; pass your own (an order or job id) when your queue may retry from a new process.

  1. POST/projectsid
  2. POST/projects/{project_id}/generationsid
  3. GET/projects/{project_id}/generations/{generation_id}status
  4. GET/projects/{project_id}/generations/{generation_id}/mediafiles
Replays and conflicts, case by case
  • First request201Created. new generation
  • Same Idempotency-Key, same body201Created. the same generation id
  • Same Idempotency-Key, other model, sampling or label409Conflict: see error.code for which one. idempotency_key_conflict
  • Same Idempotency-Key + same body201Created. with the existing resource, never billed twice
  • Same Idempotency-Key + different body409Conflict: see error.code for which one. idempotency_key_conflict
# The same key on a retry returns the same generation and bills it once.
generation = client.generations.create(
    project_id,
    model="diffio-pro",
    idempotency_key="order-1042-restore",
)

End users

Send Diffio-End-User to act for one of your customers: their projects, usage and events stay apart under one API key. How it works and its limits: End users.

customer_client = DiffioClient(end_user="customer-42")  # every call acts for this end user
customer_projects = customer_client.projects.list()

# Or scope a single call on an account-wide client:
customer_usage = client.usage.get(end_user="customer-42")

Errors

Every failure answers { "error": { "code", "message", "request_id", "details" } }. The common ones and their fixes are below; every code is on Errors.

  • 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.

  • 402Payment required: see error.code for the billing problem.needs_payment_methodAdd a payment method in the developer dashboard.

    Accounts with card billing only: the credit is used up, or cannot cover the file, and no payment method is saved.

  • 402Payment required: see error.code for the billing problem.payment_failedOn the Billing page, select Update payment method and choose a card for your subscription, or Pay invoice once card billing has ended.

    A payment for API usage failed, or the last invoice of ended card billing is unpaid. API usage is blocked until that invoice is paid. Accounts with card billing only.

  • 402Payment required: see error.code for the billing problem.usage_limit_reachedWait for the charge to complete; the API continues as soon as it does.

    Unbilled usage reached $100; it is being charged now. Accounts with card billing only.

  • 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).

  • 404Not found.transcript_not_foundCheck error.code and confirm any Diffio-End-User header matches the project.

    This generation has no transcript, or the project or generation id does not exist for this end user (project_not_found, generation_not_found).

Report an issue with this page