Python API reference
Signatures, parameters, return contracts and public exports of subft-client.
Parameters, returns and errors
This is a thin synchronous HTTP client. It does not prompt, scan automatically or orchestrate paid work for you. Use the complete recipe before adapting it. API methods need an account/token and access to the selected project. Planning and estimation do not charge; committing an operation does. Token generation/revocation needs the authenticated account and replaces/revokes its single active token.
positional-only, positional-or-keyword, keyword-only and variadic kinds describe Python calling syntax. A dash in Default means no default; required arguments must be supplied. _UNSET means omit a field, while None can explicitly clear a nullable project field.
JsonValue is Any, not a validated response model. HTTP helpers return decoded JSON, or None for an empty response; use the response-schema sections below for documented fields. request and put_upload_target return httpx.Response; close returns None, and resolve_url returns a URL string.
Catch SubftMaintenanceError before SubftApiError; inspect status_code, payload, response, mode and maintenance_until. SubftTransportError retains request_error. SubftError covers client-originated failures; local argument validation can also raise ValueError. A 409 requires a fresh read/plan, not replaying stale guards. Keep technical messages in internal logs and map codes to translated text in public interfaces. Do not blindly retry a charge-bearing commit after an ambiguous transport failure: reconcile the accepted operation first.
HTTP errors use {"detail":{"code":"…","params":{…}}}. Read SubftApiError.code and SubftApiError.params; raw server prose is diagnostic only. Credit amounts, maintenance metadata and subtitle line numbers are parameters. For example, an unreadable subtitle can return {"detail":{"code":"invalid_subtitles","params":{"line":2}}}. Unknown codes require a translated generic fallback in public interfaces.
SubftClient
Create one client and close it with a context manager. Optional extras are imported explicitly; the base package does not load FFmpeg or WebSocket dependencies.
SubftClient(
base_url: str,
*,
token: str | None = None,
timeout: float | httpx.Timeout = 30.0,
headers: Mapping[str, str] | None = None,
cookies: Mapping[str, str] | None = None,
transport: httpx.BaseTransport | None = None
) -> None| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
base_url | str | positional-or-keyword | — | Gateway URL serving API, authentication and realtime routes; a trailing slash is normalized. |
token | str | None | keyword-only | None | API token from Developer access. Keep it in a protected environment variable. |
timeout | float | httpx.Timeout | keyword-only | 30.0 | Timeout in seconds; inspect the signature for the specific request, probe or subscription default. |
headers | Mapping[str, str] | None | keyword-only | None | HTTP headers. Pass the upload target headers unchanged; ordinary request headers override constructor headers. |
cookies | Mapping[str, str] | None | keyword-only | None | Optional HTTP cookies for this client session. |
transport | httpx.BaseTransport | None | keyword-only | None | Optional HTTPX transport; use MockTransport in tests, not a live gateway. |
Client methods
Every public method is listed once below. Returns and shared exception behavior follow the contract above; endpoint-specific conflicts preserve the server status and payload.
abandon_content_preparation
Abandon one still-actionable source preparation, preserving the operation’s other sources.
abandon_content_preparation(
operation_id: str, media_id: str, content_id: str
) -> JsonValue| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
operation_id | str | positional-or-keyword | — | ID of the committed operation; retain it before leaving or retrying preparation. |
media_id | str | positional-or-keyword | — | Media ID in this route: a project-media ID for project routes, an operation-media ID for upload/preparation routes. |
content_id | str | positional-or-keyword | — | One source item inside an operation, not a project-media or artifact ID. |
abort_operation
Abort accepted server work using the operation’s allowed action; this differs from detaching a watcher.
abort_operation(operation_id: str) -> JsonValue| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
operation_id | str | positional-or-keyword | — | ID of the committed operation; retain it before leaving or retrying preparation. |
add_project_media
Register one locally inspected inventory item and its physical sources.
add_project_media(
project_id: str, media: Mapping[str, Any]
) -> JsonValue| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
project_id | str | positional-or-keyword | — | ID of the durable project, returned when creating or listing projects. |
media | Mapping[str, Any] | positional-or-keyword | — | Backend-ready inventory records or selected project-media IDs; obtain IDs from current responses. |
add_project_media_bulk
Register a complete batch of inspected media records.
add_project_media_bulk(
project_id: str, media: Iterable[Mapping[str, Any]]
) -> JsonValue| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
project_id | str | positional-or-keyword | — | ID of the durable project, returned when creating or listing projects. |
media | Iterable[Mapping[str, Any]] | positional-or-keyword | — | Backend-ready inventory records or selected project-media IDs; obtain IDs from current responses. |
apply_project_directory_sync
Apply a reviewed directory snapshot with current observation guards; a stale response requires another preview.
apply_project_directory_sync(
project_id: str,
*,
files: Iterable[Mapping[str, Any]],
media: Iterable[Mapping[str, Any]] | None = None,
confirmed_moves: Iterable[Mapping[str, Any]] | None = None,
confirm_reviewed: bool = False,
expected_assets: Mapping[str, Any] | None = None,
complete: bool = True
) -> JsonValue| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
project_id | str | positional-or-keyword | — | ID of the durable project, returned when creating or listing projects. |
files | Iterable[Mapping[str, Any]] | keyword-only | — | Complete directory snapshot, file list or observation evidence required by this endpoint; build it from local files. |
media | Iterable[Mapping[str, Any]] | None | keyword-only | None | Backend-ready inventory records or selected project-media IDs; obtain IDs from current responses. |
confirmed_moves | Iterable[Mapping[str, Any]] | None | keyword-only | None | Reviewed old/new media path mappings returned by the directory preview. |
confirm_reviewed | bool | keyword-only | False | Explicit approval of reviewed directory changes; no implicit approval is added by the client. |
expected_assets | Mapping[str, Any] | None | keyword-only | None | Current observation/generation/save guards from the relevant read or begin-check response; stale guards require a fresh read. |
complete | bool | keyword-only | True | Whether the snapshot is complete; do not mark a partially failed local scan as complete. |
archive_project
Archive a settled project as read-only. Repeating the request preserves its archive date.
archive_project(project_id: str) -> JsonValue| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
project_id | str | positional-or-keyword | — | ID of the durable project, returned when creating or listing projects. |
restore_project
Restore an archived project so it can be changed again. Restoring an active project changes nothing.
restore_project(project_id: str) -> JsonValue| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
project_id | str | positional-or-keyword | — | ID of the durable project, returned when creating or listing projects. |
delete_project
Permanently delete an archived project and its workspace, results and submitted inputs. Operation and credit records remain. The trimmed confirmation name must match exactly, including case.
delete_project(project_id: str, confirmation_name: str) -> JsonValue| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
project_id | str | positional-or-keyword | — | ID of the durable project, returned when creating or listing projects. |
confirmation_name | str | positional-or-keyword | — | Exact project name after trimming; case-sensitive. |
attach_project_media_sidecars
Attach reviewed subtitle sidecars to a media item using its check baseline.
attach_project_media_sidecars(
project_id: str,
media_id: str,
sidecars: Iterable[Mapping[str, Any]],
*,
expected_assets: Iterable[Mapping[str, Any]] = ()
) -> JsonValue| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
project_id | str | positional-or-keyword | — | ID of the durable project, returned when creating or listing projects. |
media_id | str | positional-or-keyword | — | Media ID in this route: a project-media ID for project routes, an operation-media ID for upload/preparation routes. |
sidecars | Iterable[Mapping[str, Any]] | positional-or-keyword | — | Observed subtitle sidecars and their pairing/classification metadata. |
expected_assets | Iterable[Mapping[str, Any]] | keyword-only | () | Current observation/generation/save guards from the relevant read or begin-check response; stale guards require a fresh read. |
begin_media_asset_checks
Read the current asset-check baseline before reconciling physical observations.
begin_media_asset_checks(
project_id: str, media_id: str, *, scope: Mapping[str, Any] | None = None
) -> JsonValue| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
project_id | str | positional-or-keyword | — | ID of the durable project, returned when creating or listing projects. |
media_id | str | positional-or-keyword | — | Media ID in this route: a project-media ID for project routes, an operation-media ID for upload/preparation routes. |
scope | Mapping[str, Any] | None | keyword-only | None | Endpoint-specific asset kind, check scope, readiness or placement selector; follow that endpoint’s contract. |
begin_project_directory_checks
Read asset-check baselines for a complete directory preview/apply cycle.
begin_project_directory_checks(project_id: str) -> JsonValue| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
project_id | str | positional-or-keyword | — | ID of the durable project, returned when creating or listing projects. |
clone_media_asset
Create an editable copy or duplicate using the current snapshot guards.
clone_media_asset(
project_id: str, media_id: str, asset_id: str, payload: Mapping[str, Any]
) -> JsonValue| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
project_id | str | positional-or-keyword | — | ID of the durable project, returned when creating or listing projects. |
media_id | str | positional-or-keyword | — | Media ID in this route: a project-media ID for project routes, an operation-media ID for upload/preparation routes. |
asset_id | str | positional-or-keyword | — | ID of the selected subtitle/audio asset owned by its media. |
payload | Mapping[str, Any] | positional-or-keyword | — | Endpoint-specific request mapping. Use its schema and preserve required observation or preparation guards. |
close
Close the HTTP connection pool; the context manager calls this automatically.
close() -> Nonecompare_media_asset_exports
Compare selected export candidates without extracting or writing local files.
compare_media_asset_exports(
project_id: str, media_id: str, asset_id: str, payload: Mapping[str, Any]
) -> JsonValue| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
project_id | str | positional-or-keyword | — | ID of the durable project, returned when creating or listing projects. |
media_id | str | positional-or-keyword | — | Media ID in this route: a project-media ID for project routes, an operation-media ID for upload/preparation routes. |
asset_id | str | positional-or-keyword | — | ID of the selected subtitle/audio asset owned by its media. |
payload | Mapping[str, Any] | positional-or-keyword | — | Endpoint-specific request mapping. Use its schema and preserve required observation or preparation guards. |
complete_media_asset_checks
Complete guarded physical checks and reconcile newly observed sources.
complete_media_asset_checks(
project_id: str, media_id: str, payload: Mapping[str, Any]
) -> JsonValue| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
project_id | str | positional-or-keyword | — | ID of the durable project, returned when creating or listing projects. |
media_id | str | positional-or-keyword | — | Media ID in this route: a project-media ID for project routes, an operation-media ID for upload/preparation routes. |
payload | Mapping[str, Any] | positional-or-keyword | — | Endpoint-specific request mapping. Use its schema and preserve required observation or preparation guards. |
complete_upload
Finalize a direct upload for its current content, upload and preparation attempt.
complete_upload(
operation_id: str,
media_id: str,
*,
content_id: str,
attempt_id: str,
upload_id: str,
content_hash: str | None = None
) -> JsonValue| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
operation_id | str | positional-or-keyword | — | ID of the committed operation; retain it before leaving or retrying preparation. |
media_id | str | positional-or-keyword | — | Media ID in this route: a project-media ID for project routes, an operation-media ID for upload/preparation routes. |
content_id | str | keyword-only | — | One source item inside an operation, not a project-media or artifact ID. |
attempt_id | str | keyword-only | — | A fresh UUID chosen by the caller and confirmed by the preparation response; use it for every request of that attempt. |
upload_id | str | keyword-only | — | Upload ID from the current target response, paired with the current attempt. |
content_hash | str | None | keyword-only | None | Hash of the prepared bytes (or the documented paired-file hash), not the original media fingerprint. |
create_blank_media_asset
Create a blank editable subtitle asset using the endpoint’s guarded request.
create_blank_media_asset(
project_id: str, media_id: str, payload: Mapping[str, Any]
) -> JsonValue| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
project_id | str | positional-or-keyword | — | ID of the durable project, returned when creating or listing projects. |
media_id | str | positional-or-keyword | — | Media ID in this route: a project-media ID for project routes, an operation-media ID for upload/preparation routes. |
payload | Mapping[str, Any] | positional-or-keyword | — | Endpoint-specific request mapping. Use its schema and preserve required observation or preparation guards. |
create_project
Create an empty file or directory project; local inventory is submitted separately.
create_project(
*, name: str, mode: str, root_label: str | None = None
) -> JsonValue| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
name | str | keyword-only | — | Project display name; update_project may use None to clear a nullable value. |
mode | str | keyword-only | — | Project mode: file or directory. |
root_label | str | None | keyword-only | None | Human-readable root label, not a server-accessible local filesystem path. |
create_project_operation
Commit the estimated, guarded source selections and charge the accepted estimate.
create_project_operation(
project_id: str,
*,
media_ids: Iterable[str],
target_language: str,
content_overrides: Iterable[Mapping[str, Any]] | None = None,
metrics: Iterable[Mapping[str, Any]] | None = None,
source_selections: Iterable[Mapping[str, Any]]
) -> JsonValue| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
project_id | str | positional-or-keyword | — | ID of the durable project, returned when creating or listing projects. |
media_ids | Iterable[str] | keyword-only | — | Backend-ready inventory records or selected project-media IDs; obtain IDs from current responses. |
target_language | str | keyword-only | — | Target language code for generated or translated subtitles. |
content_overrides | Iterable[Mapping[str, Any]] | None | keyword-only | None | Overrides keyed by stable source_ref: enable a source or explicitly override its source language. |
metrics | Iterable[Mapping[str, Any]] | None | keyword-only | None | Only source metrics requested by the current plan; derive them locally. Audio duration is already in probed inventory. |
source_selections | Iterable[Mapping[str, Any]] | keyword-only | — | Guarded selections from the estimated plan, plus canonical source_language; preserve snapshots and observations. |
create_project_operation_plan
Request a source/stage plan without charging or uploading data.
create_project_operation_plan(
project_id: str,
*,
media_ids: Iterable[str],
target_language: str,
content_overrides: Iterable[Mapping[str, Any]] | None = None
) -> JsonValue| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
project_id | str | positional-or-keyword | — | ID of the durable project, returned when creating or listing projects. |
media_ids | Iterable[str] | keyword-only | — | Backend-ready inventory records or selected project-media IDs; obtain IDs from current responses. |
target_language | str | keyword-only | — | Target language code for generated or translated subtitles. |
content_overrides | Iterable[Mapping[str, Any]] | None | keyword-only | None | Overrides keyed by stable source_ref: enable a source or explicitly override its source language. |
create_upload_target
Request or refresh a direct-upload target after the preparation enters hashing/uploading.
create_upload_target(
operation_id: str,
media_id: str,
*,
content_id: str,
attempt_id: str,
content_hash: str,
filename: str | None = None
) -> JsonValue| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
operation_id | str | positional-or-keyword | — | ID of the committed operation; retain it before leaving or retrying preparation. |
media_id | str | positional-or-keyword | — | Media ID in this route: a project-media ID for project routes, an operation-media ID for upload/preparation routes. |
content_id | str | keyword-only | — | One source item inside an operation, not a project-media or artifact ID. |
attempt_id | str | keyword-only | — | A fresh UUID chosen by the caller and confirmed by the preparation response; use it for every request of that attempt. |
content_hash | str | keyword-only | — | Hash of the prepared bytes (or the documented paired-file hash), not the original media fingerprint. |
filename | str | None | keyword-only | None | Prepared filename, including its real extension, used to select storage format. |
estimate_project_operation_plan
Estimate the current plan using real requested metrics; inspect can_commit before asking for approval.
estimate_project_operation_plan(
project_id: str,
*,
media_ids: Iterable[str],
target_language: str,
content_overrides: Iterable[Mapping[str, Any]] | None = None,
metrics: Iterable[Mapping[str, Any]] | None = None
) -> JsonValue| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
project_id | str | positional-or-keyword | — | ID of the durable project, returned when creating or listing projects. |
media_ids | Iterable[str] | keyword-only | — | Backend-ready inventory records or selected project-media IDs; obtain IDs from current responses. |
target_language | str | keyword-only | — | Target language code for generated or translated subtitles. |
content_overrides | Iterable[Mapping[str, Any]] | None | keyword-only | None | Overrides keyed by stable source_ref: enable a source or explicitly override its source language. |
metrics | Iterable[Mapping[str, Any]] | None | keyword-only | None | Only source metrics requested by the current plan; derive them locally. Audio duration is already in probed inventory. |
export_media_asset
Capture a saved asset’s subtitle export with current snapshot/version and metadata guards.
export_media_asset(
project_id: str, media_id: str, asset_id: str, payload: Mapping[str, Any]
) -> JsonValue| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
project_id | str | positional-or-keyword | — | ID of the durable project, returned when creating or listing projects. |
media_id | str | positional-or-keyword | — | Media ID in this route: a project-media ID for project routes, an operation-media ID for upload/preparation routes. |
asset_id | str | positional-or-keyword | — | ID of the selected subtitle/audio asset owned by its media. |
payload | Mapping[str, Any] | positional-or-keyword | — | Endpoint-specific request mapping. Use its schema and preserve required observation or preparation guards. |
export_project_operation_artifact
Export a specific successful immutable stage; downloading does not create an editable or physical asset.
export_project_operation_artifact(
project_id: str,
operation_id: str,
artifact_id: str,
*,
output_target: str | None = None
) -> JsonValue| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
project_id | str | positional-or-keyword | — | ID of the durable project, returned when creating or listing projects. |
operation_id | str | positional-or-keyword | — | ID of the committed operation; retain it before leaving or retrying preparation. |
artifact_id | str | positional-or-keyword | — | ID of an immutable successful operation stage returned by the result list. |
output_target | str | None | keyword-only | None | external_srt, external_vtt, external_ass or embedded; None uses the endpoint/account default. |
export_project_operation_result
Export the final successful stage for one operation source item.
export_project_operation_result(
project_id: str,
operation_id: str,
content_id: str,
*,
output_target: str | None = None
) -> JsonValue| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
project_id | str | positional-or-keyword | — | ID of the durable project, returned when creating or listing projects. |
operation_id | str | positional-or-keyword | — | ID of the committed operation; retain it before leaving or retrying preparation. |
content_id | str | positional-or-keyword | — | One source item inside an operation, not a project-media or artifact ID. |
output_target | str | None | keyword-only | None | external_srt, external_vtt, external_ass or embedded; None uses the endpoint/account default. |
export_project_operation_result_names
Final file names of the selected results written together to one ZIP or directory. Names that would clash get the source's asset number or a running number (clip.en.3.srt).
export_project_operation_result_names(
project_id: str,
operation_id: str,
artifact_ids: list[str],
*,
output_target: str
) -> JsonValue| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
project_id | str | positional-or-keyword | — | ID of the durable project, returned when creating or listing projects. |
operation_id | str | positional-or-keyword | — | ID of the committed operation; retain it before leaving or retrying preparation. |
artifact_ids | list[str] | positional-or-keyword | — | IDs of the immutable successful operation stages written together, as returned by the result list. |
output_target | str | keyword-only | — | external_srt, external_vtt or external_ass; embedded results have no file names of their own. |
generate_api_token
Generate the single active API token, replacing the previous token; callers own confirmation and secret handling.
generate_api_token() -> JsonValueget_api_token_status
Read token status without recovering an existing secret.
get_api_token_status() -> JsonValueget_asset_document
Read a consistent saved subtitle document and its current version.
get_asset_document(
project_id: str, media_id: str, asset_id: str
) -> JsonValue| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
project_id | str | positional-or-keyword | — | ID of the durable project, returned when creating or listing projects. |
media_id | str | positional-or-keyword | — | Media ID in this route: a project-media ID for project routes, an operation-media ID for upload/preparation routes. |
asset_id | str | positional-or-keyword | — | ID of the selected subtitle/audio asset owned by its media. |
get_maintenance_status
Read gateway maintenance state without authentication.
get_maintenance_status() -> JsonValueget_media_asset
Read one current asset and its binding/snapshot metadata.
get_media_asset(
project_id: str, media_id: str, asset_id: str
) -> JsonValue| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
project_id | str | positional-or-keyword | — | ID of the durable project, returned when creating or listing projects. |
media_id | str | positional-or-keyword | — | Media ID in this route: a project-media ID for project routes, an operation-media ID for upload/preparation routes. |
asset_id | str | positional-or-keyword | — | ID of the selected subtitle/audio asset owned by its media. |
get_operation
Read canonical global operation state; reconcile this after events and reconnects.
get_operation(operation_id: str) -> JsonValue| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
operation_id | str | positional-or-keyword | — | ID of the committed operation; retain it before leaving or retrying preparation. |
get_project
Read a project and its current inventory overview.
get_project(project_id: str) -> JsonValue| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
project_id | str | positional-or-keyword | — | ID of the durable project, returned when creating or listing projects. |
get_project_media
Read one current project-media record.
get_project_media(project_id: str, media_id: str) -> JsonValue| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
project_id | str | positional-or-keyword | — | ID of the durable project, returned when creating or listing projects. |
media_id | str | positional-or-keyword | — | Media ID in this route: a project-media ID for project routes, an operation-media ID for upload/preparation routes. |
get_project_operation
Read an operation through its owning project route.
get_project_operation(project_id: str, operation_id: str) -> JsonValue| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
project_id | str | positional-or-keyword | — | ID of the durable project, returned when creating or listing projects. |
operation_id | str | positional-or-keyword | — | ID of the committed operation; retain it before leaving or retrying preparation. |
get_session
Read the authenticated session resource.
get_session() -> JsonValueget_workflow_preferences
Read account workflow and export defaults; explicit choices may override them.
get_workflow_preferences() -> JsonValuehide_media_asset
Hide an asset using current guards while retaining its producing history.
hide_media_asset(
project_id: str,
media_id: str,
asset_id: str,
*,
expected_autosave_version: int | None = None,
guards: Mapping[str, Any] | None = None
) -> JsonValue| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
project_id | str | positional-or-keyword | — | ID of the durable project, returned when creating or listing projects. |
media_id | str | positional-or-keyword | — | Media ID in this route: a project-media ID for project routes, an operation-media ID for upload/preparation routes. |
asset_id | str | positional-or-keyword | — | ID of the selected subtitle/audio asset owned by its media. |
expected_autosave_version | int | None | keyword-only | None | Current observation/generation/save guards from the relevant read or begin-check response; stale guards require a fresh read. |
guards | Mapping[str, Any] | None | keyword-only | None | Current observation/generation/save guards from the relevant read or begin-check response; stale guards require a fresh read. |
import_project
Create a project from a complete supplied file/inventory setup.
import_project(
*,
name: str,
mode: str,
root_label: str | None = None,
media: Iterable[Mapping[str, Any]] | None = None,
file_evidence: Iterable[Mapping[str, Any]] | None = None
) -> JsonValue| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
name | str | keyword-only | — | Project display name; update_project may use None to clear a nullable value. |
mode | str | keyword-only | — | Project mode: file or directory. |
root_label | str | None | keyword-only | None | Human-readable root label, not a server-accessible local filesystem path. |
media | Iterable[Mapping[str, Any]] | None | keyword-only | None | Backend-ready inventory records or selected project-media IDs; obtain IDs from current responses. |
file_evidence | Iterable[Mapping[str, Any]] | None | keyword-only | None | Complete directory snapshot, file list or observation evidence required by this endpoint; build it from local files. |
list_media_assets
List saved assets belonging to one project-media item.
list_media_assets(
project_id: str,
media_id: str,
*,
limit: int = 50,
offset: int = 0,
content_type: str | None = None,
kind: str | None = None,
search: str | None = None,
language: str | None = None,
forced: bool | None = None,
sdh: bool | None = None,
commentary: bool | None = None,
classification: str | None = None,
readiness: str | None = None,
placement: str | None = None,
sort: str = 'created_at',
direction: str = 'asc'
) -> JsonValue| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
project_id | str | positional-or-keyword | — | ID of the durable project, returned when creating or listing projects. |
media_id | str | positional-or-keyword | — | Media ID in this route: a project-media ID for project routes, an operation-media ID for upload/preparation routes. |
limit | int | keyword-only | 50 | Page size or zero-based offset; continue pagination until the reported total is reached. |
offset | int | keyword-only | 0 | Page size or zero-based offset; continue pagination until the reported total is reached. |
content_type | str | None | keyword-only | None | MIME type of prepared data; target headers take precedence if they already specify it. |
kind | str | None | keyword-only | None | Endpoint-specific asset kind, check scope, readiness or placement selector; follow that endpoint’s contract. |
search | str | None | keyword-only | None | Optional search text for the requested project or media list. |
language | str | None | keyword-only | None | Subtitle language or normal/Forced/SDH/Commentary classification; technical language codes remain unchanged. |
forced | bool | None | keyword-only | None | Subtitle language or normal/Forced/SDH/Commentary classification; technical language codes remain unchanged. |
sdh | bool | None | keyword-only | None | Subtitle language or normal/Forced/SDH/Commentary classification; technical language codes remain unchanged. |
commentary | bool | None | keyword-only | None | Subtitle language or normal/Forced/SDH/Commentary classification; technical language codes remain unchanged. |
classification | str | None | keyword-only | None | Subtitle language or normal/Forced/SDH/Commentary classification; technical language codes remain unchanged. |
readiness | str | None | keyword-only | None | Endpoint-specific asset kind, check scope, readiness or placement selector; follow that endpoint’s contract. |
placement | str | None | keyword-only | None | Endpoint-specific asset kind, check scope, readiness or placement selector; follow that endpoint’s contract. |
sort | str | keyword-only | 'created_at' | Sort field or direction supported by the list endpoint. |
direction | str | keyword-only | 'asc' | Sort field or direction supported by the list endpoint. |
list_operations
List global operations with explicit pagination.
list_operations(*, limit: int = 50, offset: int = 0) -> JsonValue| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
limit | int | keyword-only | 50 | Page size or zero-based offset; continue pagination until the reported total is reached. |
offset | int | keyword-only | 0 | Page size or zero-based offset; continue pagination until the reported total is reached. |
list_project_media
List project media with filters and pagination; inspect total and status_counts.
list_project_media(
project_id: str,
*,
limit: int = 50,
offset: int = 0,
search: str | None = None,
status: str = 'all',
media_ids: Iterable[str] | None = None
) -> JsonValue| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
project_id | str | positional-or-keyword | — | ID of the durable project, returned when creating or listing projects. |
limit | int | keyword-only | 50 | Page size or zero-based offset; continue pagination until the reported total is reached. |
offset | int | keyword-only | 0 | Page size or zero-based offset; continue pagination until the reported total is reached. |
search | str | None | keyword-only | None | Optional search text for the requested project or media list. |
status | str | keyword-only | 'all' | Status filter or new status, as appropriate to the method; archived projects retain saved results. |
media_ids | Iterable[str] | None | keyword-only | None | Backend-ready inventory records or selected project-media IDs; obtain IDs from current responses. |
list_project_operation_results
List successful saved stage artifacts, including useful results from partially failed work.
list_project_operation_results(
project_id: str, operation_id: str
) -> JsonValue| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
project_id | str | positional-or-keyword | — | ID of the durable project, returned when creating or listing projects. |
operation_id | str | positional-or-keyword | — | ID of the committed operation; retain it before leaving or retrying preparation. |
list_project_operations
List operations owned by a project, optionally scoped to one media item.
list_project_operations(
project_id: str,
*,
limit: int = 50,
offset: int = 0,
media_id: str | None = None
) -> JsonValue| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
project_id | str | positional-or-keyword | — | ID of the durable project, returned when creating or listing projects. |
limit | int | keyword-only | 50 | Page size or zero-based offset; continue pagination until the reported total is reached. |
offset | int | keyword-only | 0 | Page size or zero-based offset; continue pagination until the reported total is reached. |
media_id | str | None | keyword-only | None | Media ID in this route: a project-media ID for project routes, an operation-media ID for upload/preparation routes. |
list_archived_projects
List archived projects with mode, search, sort and pagination. Newest archive date comes first by default.
list_archived_projects(
*,
limit: int = 50,
offset: int = 0,
mode: str | None = None,
search: str | None = None,
sort: str = 'archived_at',
direction: str = 'desc'
) -> JsonValue| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
limit | int | keyword-only | 50 | Page size or zero-based offset; continue pagination until the reported total is reached. |
offset | int | keyword-only | 0 | Page size or zero-based offset; continue pagination until the reported total is reached. |
mode | str | None | keyword-only | None | Project mode: file or directory. |
search | str | None | keyword-only | None | Optional search text for the requested project or media list. |
sort | str | keyword-only | 'archived_at' | Sort field or direction supported by the list endpoint. |
direction | str | keyword-only | 'desc' | Sort field or direction supported by the list endpoint. |
list_projects
List active projects with mode, search, sort and pagination.
list_projects(
*,
limit: int = 50,
offset: int = 0,
mode: str | None = None,
search: str | None = None,
sort: str = 'updated_at',
direction: str = 'desc'
) -> JsonValue| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
limit | int | keyword-only | 50 | Page size or zero-based offset; continue pagination until the reported total is reached. |
offset | int | keyword-only | 0 | Page size or zero-based offset; continue pagination until the reported total is reached. |
mode | str | None | keyword-only | None | Project mode: file or directory. |
search | str | None | keyword-only | None | Optional search text for the requested project or media list. |
sort | str | keyword-only | 'updated_at' | Sort field or direction supported by the list endpoint. |
direction | str | keyword-only | 'desc' | Sort field or direction supported by the list endpoint. |
materialize_asset
Register locally extracted physical subtitle text using current observation guards.
materialize_asset(
project_id: str, media_id: str, asset_id: str, payload: Mapping[str, Any]
) -> JsonValue| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
project_id | str | positional-or-keyword | — | ID of the durable project, returned when creating or listing projects. |
media_id | str | positional-or-keyword | — | Media ID in this route: a project-media ID for project routes, an operation-media ID for upload/preparation routes. |
asset_id | str | positional-or-keyword | — | ID of the selected subtitle/audio asset owned by its media. |
payload | Mapping[str, Any] | positional-or-keyword | — | Endpoint-specific request mapping. Use its schema and preserve required observation or preparation guards. |
preview_project_directory_sync
Compare a complete local snapshot with current inventory before applying changes.
preview_project_directory_sync(
project_id: str, files: Iterable[Mapping[str, Any]]
) -> JsonValue| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
project_id | str | positional-or-keyword | — | ID of the durable project, returned when creating or listing projects. |
files | Iterable[Mapping[str, Any]] | positional-or-keyword | — | Complete directory snapshot, file list or observation evidence required by this endpoint; build it from local files. |
preview_project_sidecars
Find sidecar matches and ambiguities before attaching them.
preview_project_sidecars(
project_id: str, sidecars: Iterable[Mapping[str, Any]]
) -> JsonValue| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
project_id | str | positional-or-keyword | — | ID of the durable project, returned when creating or listing projects. |
sidecars | Iterable[Mapping[str, Any]] | positional-or-keyword | — | Observed subtitle sidecars and their pairing/classification metadata. |
put_upload_target
Upload directly using backend-issued method and headers; the SubFT token is omitted.
put_upload_target(
upload_url: str,
*,
method: str = 'PUT',
data: Any | None = None,
content: Any | None = None,
headers: Mapping[str, str] | None = None,
content_type: str = 'application/octet-stream'
) -> httpx.Response| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
upload_url | str | positional-or-keyword | — | URL from the API; relative URLs resolve against the gateway. Upload URLs receive no SubFT token. |
method | str | keyword-only | 'PUT' | HTTP method; preserve the backend-issued method for direct upload. |
data | Any | None | keyword-only | None | Form or upload data accepted by HTTPX; do not combine it with content for direct upload. |
content | Any | None | keyword-only | None | Raw bytes or an iterable of byte chunks. For uploads use the prepared file. |
headers | Mapping[str, str] | None | keyword-only | None | HTTP headers. Pass the upload target headers unchanged; ordinary request headers override constructor headers. |
content_type | str | keyword-only | 'application/octet-stream' | MIME type of prepared data; target headers take precedence if they already specify it. |
register_verified_asset_outputs
Register locally verified physical outputs using their frozen capture; downloading alone does not register them.
register_verified_asset_outputs(
project_id: str, media_id: str, payload: Mapping[str, Any]
) -> JsonValue| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
project_id | str | positional-or-keyword | — | ID of the durable project, returned when creating or listing projects. |
media_id | str | positional-or-keyword | — | Media ID in this route: a project-media ID for project routes, an operation-media ID for upload/preparation routes. |
payload | Mapping[str, Any] | positional-or-keyword | — | Endpoint-specific request mapping. Use its schema and preserve required observation or preparation guards. |
remove_project_media
Remove a media item from active inventory through the project route.
remove_project_media(project_id: str, media_id: str) -> JsonValue| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
project_id | str | positional-or-keyword | — | ID of the durable project, returned when creating or listing projects. |
media_id | str | positional-or-keyword | — | Media ID in this route: a project-media ID for project routes, an operation-media ID for upload/preparation routes. |
replace_project_media
Reconcile a changed local media file using its fresh inventory evidence.
replace_project_media(
project_id: str, media_id: str, media: Mapping[str, Any]
) -> JsonValue| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
project_id | str | positional-or-keyword | — | ID of the durable project, returned when creating or listing projects. |
media_id | str | positional-or-keyword | — | Media ID in this route: a project-media ID for project routes, an operation-media ID for upload/preparation routes. |
media | Mapping[str, Any] | positional-or-keyword | — | Backend-ready inventory records or selected project-media IDs; obtain IDs from current responses. |
report_content_progress
Report attempt-scoped client progress with the current progress contract and increasing revision.
report_content_progress(
operation_id: str,
media_id: str,
content_id: str,
payload: Mapping[str, Any]
) -> JsonValue| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
operation_id | str | positional-or-keyword | — | ID of the committed operation; retain it before leaving or retrying preparation. |
media_id | str | positional-or-keyword | — | Media ID in this route: a project-media ID for project routes, an operation-media ID for upload/preparation routes. |
content_id | str | positional-or-keyword | — | One source item inside an operation, not a project-media or artifact ID. |
payload | Mapping[str, Any] | positional-or-keyword | — | Endpoint-specific request mapping. Use its schema and preserve required observation or preparation guards. |
request
Send an HTTP request and return the raw response after shared error handling.
request(
method: str,
path: str,
*,
params: Mapping[str, Any] | None = None,
json: JsonValue | None = None,
data: Any | None = None,
content: Any | None = None,
headers: Mapping[str, str] | None = None,
authenticated: bool = True
) -> httpx.Response| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
method | str | positional-or-keyword | — | HTTP method; preserve the backend-issued method for direct upload. |
path | str | positional-or-keyword | — | HTTP path relative to base_url, or an absolute URL; this is not a local filesystem path. |
params | Mapping[str, Any] | None | keyword-only | None | Query parameters; None values and empty collections are omitted. |
json | JsonValue | None | keyword-only | None | JSON request body. It must match the endpoint contract. |
data | Any | None | keyword-only | None | Form or upload data accepted by HTTPX; do not combine it with content for direct upload. |
content | Any | None | keyword-only | None | Raw bytes or an iterable of byte chunks. For uploads use the prepared file. |
headers | Mapping[str, str] | None | keyword-only | None | HTTP headers. Pass the upload target headers unchanged; ordinary request headers override constructor headers. |
authenticated | bool | keyword-only | True | Whether the client may add its SubFT Authorization header. Direct upload uses False. |
request_json
Send an HTTP request and decode JSON; empty responses return None.
request_json(
method: str,
path: str,
*,
params: Mapping[str, Any] | None = None,
json: JsonValue | None = None,
headers: Mapping[str, str] | None = None,
authenticated: bool = True
) -> JsonValue| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
method | str | positional-or-keyword | — | HTTP method; preserve the backend-issued method for direct upload. |
path | str | positional-or-keyword | — | HTTP path relative to base_url, or an absolute URL; this is not a local filesystem path. |
params | Mapping[str, Any] | None | keyword-only | None | Query parameters; None values and empty collections are omitted. |
json | JsonValue | None | keyword-only | None | JSON request body. It must match the endpoint contract. |
headers | Mapping[str, str] | None | keyword-only | None | HTTP headers. Pass the upload target headers unchanged; ordinary request headers override constructor headers. |
authenticated | bool | keyword-only | True | Whether the client may add its SubFT Authorization header. Direct upload uses False. |
resolve_url
Resolve a backend relative URL against the client gateway.
resolve_url(url: str) -> str| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
url | str | positional-or-keyword | — | URL from the API; relative URLs resolve against the gateway. Upload URLs receive no SubFT token. |
restore_project_media
Restore an archived item. A video or audio item needs media, its file's fresh inventory evidence: unchanged streams keep their assets. A subtitle item needs none.
restore_project_media(
project_id: str, media_id: str, media: Mapping[str, Any] | None = None
) -> JsonValue| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
project_id | str | positional-or-keyword | — | ID of the durable project, returned when creating or listing projects. |
media_id | str | positional-or-keyword | — | Media ID in this route: a project-media ID for project routes, an operation-media ID for upload/preparation routes. |
media | Mapping[str, Any] | None | positional-or-keyword | None | Inventory record of the item's file, as for replace_project_media; omit it for a subtitle item. |
retry_content_preparation
Start a fresh attempt for eligible preparation, guarded by the previous attempt ID; this starts no new operation.
retry_content_preparation(
operation_id: str,
media_id: str,
content_id: str,
*,
attempt_id: str,
previous_attempt_id: str
) -> JsonValue| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
operation_id | str | positional-or-keyword | — | ID of the committed operation; retain it before leaving or retrying preparation. |
media_id | str | positional-or-keyword | — | Media ID in this route: a project-media ID for project routes, an operation-media ID for upload/preparation routes. |
content_id | str | positional-or-keyword | — | One source item inside an operation, not a project-media or artifact ID. |
attempt_id | str | keyword-only | — | A fresh UUID chosen by the caller and confirmed by the preparation response; use it for every request of that attempt. |
previous_attempt_id | str | keyword-only | — | The attempt ID in the latest canonical preparation snapshot, used as a retry guard. |
revoke_api_token
Revoke the active server token; removing a locally stored token does not do this.
revoke_api_token() -> JsonValuesave_media_asset_document
Save editable cues with snapshot/version guards; conflicts require a fresh document read.
save_media_asset_document(
project_id: str, media_id: str, asset_id: str, payload: Mapping[str, Any]
) -> JsonValue| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
project_id | str | positional-or-keyword | — | ID of the durable project, returned when creating or listing projects. |
media_id | str | positional-or-keyword | — | Media ID in this route: a project-media ID for project routes, an operation-media ID for upload/preparation routes. |
asset_id | str | positional-or-keyword | — | ID of the selected subtitle/audio asset owned by its media. |
payload | Mapping[str, Any] | positional-or-keyword | — | Endpoint-specific request mapping. Use its schema and preserve required observation or preparation guards. |
scan_project_directory
Ask the backend to classify a supplied local snapshot; the server cannot scan the caller’s disk.
scan_project_directory(files: Iterable[str]) -> JsonValue| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
files | Iterable[str] | positional-or-keyword | — | Complete directory snapshot, file list or observation evidence required by this endpoint; build it from local files. |
start_content_preparation
Start an allowed preparation attempt with a new UUID before hashing and upload.
start_content_preparation(
operation_id: str, media_id: str, content_id: str, *, attempt_id: str
) -> JsonValue| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
operation_id | str | positional-or-keyword | — | ID of the committed operation; retain it before leaving or retrying preparation. |
media_id | str | positional-or-keyword | — | Media ID in this route: a project-media ID for project routes, an operation-media ID for upload/preparation routes. |
content_id | str | positional-or-keyword | — | One source item inside an operation, not a project-media or artifact ID. |
attempt_id | str | keyword-only | — | A fresh UUID chosen by the caller and confirmed by the preparation response; use it for every request of that attempt. |
update_content_preparation
Advance preparation, renew its heartbeat or report an awaiting_retry failure with the same attempt token.
update_content_preparation(
operation_id: str,
media_id: str,
content_id: str,
attempt_id: str,
payload: Mapping[str, Any]
) -> JsonValue| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
operation_id | str | positional-or-keyword | — | ID of the committed operation; retain it before leaving or retrying preparation. |
media_id | str | positional-or-keyword | — | Media ID in this route: a project-media ID for project routes, an operation-media ID for upload/preparation routes. |
content_id | str | positional-or-keyword | — | One source item inside an operation, not a project-media or artifact ID. |
attempt_id | str | positional-or-keyword | — | A fresh UUID chosen by the caller and confirmed by the preparation response; use it for every request of that attempt. |
payload | Mapping[str, Any] | positional-or-keyword | — | Endpoint-specific request mapping. Use its schema and preserve required observation or preparation guards. |
update_media_asset
Update allowed asset metadata, leaving subtitle content unchanged.
update_media_asset(
project_id: str, media_id: str, asset_id: str, metadata: Mapping[str, Any]
) -> JsonValue| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
project_id | str | positional-or-keyword | — | ID of the durable project, returned when creating or listing projects. |
media_id | str | positional-or-keyword | — | Media ID in this route: a project-media ID for project routes, an operation-media ID for upload/preparation routes. |
asset_id | str | positional-or-keyword | — | ID of the selected subtitle/audio asset owned by its media. |
metadata | Mapping[str, Any] | positional-or-keyword | — | Allowed language/classification metadata for the asset; this does not edit subtitle cues. |
update_project
Update supplied project fields. Omitted _UNSET fields differ from explicitly cleared None values.
update_project(
project_id: str,
*,
name: str | None | object = _UNSET,
root_label: str | None | object = _UNSET
) -> JsonValue| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
project_id | str | positional-or-keyword | — | ID of the durable project, returned when creating or listing projects. |
name | str | None | object | keyword-only | _UNSET | Project display name; update_project may use None to clear a nullable value. |
root_label | str | None | object | keyword-only | _UNSET | Human-readable root label, not a server-accessible local filesystem path. |
verify_auth
Verify the effective credential and read its account identity.
verify_auth() -> JsonValueRoot exports
Import from subft_client. Local functions need the local extra and the selected system tools. Inspect returned failures before updating backend inventory. Realtime needs its extra and performs no canonical HTTP reconciliation.
JsonArray
Public constant or type alias. The value below comes from source; identifiers and units retain their technical meaning.
JsonArray = list[Any]JsonObject
Public constant or type alias. The value below comes from source; identifiers and units retain their technical meaning.
JsonObject = dict[str, Any]JsonValue
Public constant or type alias. The value below comes from source; identifiers and units retain their technical meaning.
JsonValue = AnySubftApiError
Public exception. Catch the specific type when recovery differs; the base exception covers its subclasses. Optional constructor fields preserve HTTP status, payload or transport evidence as annotated.
SubftApiError(
status_code: int,
message: str,
*,
payload: Any | None = None,
response: httpx.Response | None = None
) -> NoneSubftClient
Public client or immutable record. Fields are returned local/realtime evidence, not an instruction to launch work. Public methods below expose its recorded values.
SubftClient(
base_url: str,
*,
token: str | None = None,
timeout: float | httpx.Timeout = 30.0,
headers: Mapping[str, str] | None = None,
cookies: Mapping[str, str] | None = None,
transport: httpx.BaseTransport | None = None
) -> NoneSubftError
Public exception. Catch the specific type when recovery differs; the base exception covers its subclasses. Optional constructor fields preserve HTTP status, payload or transport evidence as annotated.
SubftMaintenanceError
Public exception. Catch the specific type when recovery differs; the base exception covers its subclasses. Optional constructor fields preserve HTTP status, payload or transport evidence as annotated.
SubftMaintenanceError(
status_code: int,
message: str,
*,
payload: Any | None = None,
response: httpx.Response | None = None,
mode: str | None = None,
maintenance_until: str | None = None
) -> NoneSubftTransportError
Public exception. Catch the specific type when recovery differs; the base exception covers its subclasses. Optional constructor fields preserve HTTP status, payload or transport evidence as annotated.
SubftTransportError(
message: str, *, request_error: httpx.RequestError
) -> None__version__
Public constant or type alias. The value below comes from source; identifiers and units retain their technical meaning.
__version__ = '0.1.0'Local helpers and records
Import from subft_client.local. Local functions need the local extra and the selected system tools. Inspect returned failures before updating backend inventory. Realtime needs its extra and performs no canonical HTTP reconciliation.
AUDIO_EXTENSIONS
Public constant or type alias. The value below comes from source; identifiers and units retain their technical meaning.
AUDIO_EXTENSIONS = frozenset({'mp3', 'wav', 'flac', 'aac', 'ogg', 'm4a'})DEFAULT_HASH_CHUNK_SIZE
Public constant or type alias. The value below comes from source; identifiers and units retain their technical meaning.
DEFAULT_HASH_CHUNK_SIZE = 4 * 1024 * 1024DirectorySnapshotFile
Public client or immutable record. Fields are returned local/realtime evidence, not an instruction to launch work. Public methods below expose its recorded values.
| Field | Type | Required | Declaration / default | Meaning |
|---|---|---|---|---|
path | str | True | — | Local root, path or POSIX relative path. Scan helpers exclude symlinks; keep paths inside the chosen root. |
size_bytes | int | True | — | Actual file/transfer size or measured byte progress. |
last_modified_ms | int | True | — | Observed filesystem modification time in milliseconds. |
mime_type | str | None | True | — | Detected MIME type; this alone does not establish codec support. |
file_kind | LocalFileKind | True | — | Recognized extension, inventory classification or probed container. |
file_fingerprint_hash | str | None | False | None | Fingerprint/hash measured from the source; observe the record’s fingerprint kind. |
language_text_sample | str | None | False | None | Bounded real subtitle text used as language evidence. |
to_api_dict() -> JsonObjectDirectorySnapshotResult
Public client or immutable record. Fields are returned local/realtime evidence, not an instruction to launch work. Public methods below expose its recorded values.
| Field | Type | Required | Declaration / default | Meaning |
|---|---|---|---|---|
files | tuple[DirectorySnapshotFile, ...] | True | — | Complete directory snapshot, file list or observation evidence required by this endpoint; build it from local files. |
failures | tuple[LocalFailure, ...] | True | — | Recorded per-item failures; this list does not make a partial inventory safe to submit. |
to_api_dict() -> JsonObjectExtractedFile
Public client or immutable record. Fields are returned local/realtime evidence, not an instruction to launch work. Public methods below expose its recorded values.
| Field | Type | Required | Declaration / default | Meaning |
|---|---|---|---|---|
path | Path | True | — | Local root, path or POSIX relative path. Scan helpers exclude symlinks; keep paths inside the chosen root. |
filename | str | True | — | Prepared filename, including its real extension, used to select storage format. |
content_type | str | True | — | MIME type of prepared data; target headers take precedence if they already specify it. |
to_api_dict() -> JsonObjectFfmpegTools
Public client or immutable record. Fields are returned local/realtime evidence, not an instruction to launch work. Public methods below expose its recorded values.
| Field | Type | Required | Declaration / default | Meaning |
|---|---|---|---|---|
wrapper_available | bool | True | — | Observed tool installation, version or diagnostic; Python extras do not install system binaries. |
ffmpeg_path | str | None | True | — | Observed tool installation, version or diagnostic; Python extras do not install system binaries. |
ffmpeg_version | str | None | True | — | Observed tool installation, version or diagnostic; Python extras do not install system binaries. |
ffmpeg_error | str | None | True | — | Observed tool installation, version or diagnostic; Python extras do not install system binaries. |
ffprobe_path | str | None | True | — | Observed tool installation, version or diagnostic; Python extras do not install system binaries. |
ffprobe_version | str | None | True | — | Observed tool installation, version or diagnostic; Python extras do not install system binaries. |
ffprobe_error | str | None | True | — | Observed tool installation, version or diagnostic; Python extras do not install system binaries. |
ffmpeg_available: boolffprobe_available: boolavailable: boolto_api_dict() -> JsonObjectFfmpegUnavailableError
Public exception. Catch the specific type when recovery differs; the base exception covers its subclasses. Optional constructor fields preserve HTTP status, payload or transport evidence as annotated.
FileFingerprint
Public client or immutable record. Fields are returned local/realtime evidence, not an instruction to launch work. Public methods below expose its recorded values.
| Field | Type | Required | Declaration / default | Meaning |
|---|---|---|---|---|
kind | FingerprintKind | True | — | Endpoint-specific asset kind, check scope, readiness or placement selector; follow that endpoint’s contract. |
hash | str | True | — | Fingerprint/hash measured from the source; observe the record’s fingerprint kind. |
to_api_dict() -> JsonObjectGRAPHICAL_SUBTITLE_EXTENSIONS
Public constant or type alias. The value below comes from source; identifiers and units retain their technical meaning.
GRAPHICAL_SUBTITLE_EXTENSIONS = frozenset({'sup', 'idx', 'sub'})InventoryResult
Public client or immutable record. Fields are returned local/realtime evidence, not an instruction to launch work. Public methods below expose its recorded values.
| Field | Type | Required | Declaration / default | Meaning |
|---|---|---|---|---|
items | tuple[MediaInventoryItem, ...] | True | — | Inspected media inventory records; check failures before submitting them. |
failures | tuple[LocalFailure, ...] | True | — | Recorded per-item failures; this list does not make a partial inventory safe to submit. |
total_candidates | int | True | — | Number of scan candidates before unsupported files or failures are filtered. |
to_api_dict() -> JsonObjectLANGUAGE_SAMPLE_BYTES
Public constant or type alias. The value below comes from source; identifiers and units retain their technical meaning.
LANGUAGE_SAMPLE_BYTES = 64 * 1024LocalFailure
Public client or immutable record. Fields are returned local/realtime evidence, not an instruction to launch work. Public methods below expose its recorded values.
| Field | Type | Required | Declaration / default | Meaning |
|---|---|---|---|---|
path | str | True | — | Local root, path or POSIX relative path. Scan helpers exclude symlinks; keep paths inside the chosen root. |
error_type | str | True | — | Technical diagnostic data for internal logging; public interfaces must map codes to translated text. |
message | str | True | — | Technical diagnostic data for internal logging; public interfaces must map codes to translated text. |
from_exception(path: str | Path, error: Exception) -> LocalFailureto_api_dict() -> JsonObjectLocalFile
Public client or immutable record. Fields are returned local/realtime evidence, not an instruction to launch work. Public methods below expose its recorded values.
| Field | Type | Required | Declaration / default | Meaning |
|---|---|---|---|---|
absolute_path | Path | True | — | Resolved caller-local path; never publish it in public search. |
relative_path | str | True | — | Local root, path or POSIX relative path. Scan helpers exclude symlinks; keep paths inside the chosen root. |
size_bytes | int | True | — | Actual file/transfer size or measured byte progress. |
last_modified_ms | int | True | — | Observed filesystem modification time in milliseconds. |
mime_type | str | None | True | — | Detected MIME type; this alone does not establish codec support. |
suffix | str | True | — | Recognized extension, inventory classification or probed container. |
file_kind | LocalFileKind | True | — | Recognized extension, inventory classification or probed container. |
to_api_dict() -> JsonObjectLocalFileChangedError
Public exception. Catch the specific type when recovery differs; the base exception covers its subclasses. Optional constructor fields preserve HTTP status, payload or transport evidence as annotated.
LocalHashError
Public exception. Catch the specific type when recovery differs; the base exception covers its subclasses. Optional constructor fields preserve HTTP status, payload or transport evidence as annotated.
LocalPathError
Public exception. Catch the specific type when recovery differs; the base exception covers its subclasses. Optional constructor fields preserve HTTP status, payload or transport evidence as annotated.
LocalProgress
Public client or immutable record. Fields are returned local/realtime evidence, not an instruction to launch work. Public methods below expose its recorded values.
| Field | Type | Required | Declaration / default | Meaning |
|---|---|---|---|---|
phase | ProgressPhase | True | — | Local progress phase and measured item/byte completion; callbacks are synchronous. |
path | str | None | True | — | Local root, path or POSIX relative path. Scan helpers exclude symlinks; keep paths inside the chosen root. |
current | int | True | — | Local progress phase and measured item/byte completion; callbacks are synchronous. |
total | int | True | — | Local progress phase and measured item/byte completion; callbacks are synchronous. |
loaded_bytes | int | None | False | None | Actual file/transfer size or measured byte progress. |
total_bytes | int | None | False | None | Actual file/transfer size or measured byte progress. |
percent: floatto_api_dict() -> JsonObjectLocalScanError
Public exception. Catch the specific type when recovery differs; the base exception covers its subclasses. Optional constructor fields preserve HTTP status, payload or transport evidence as annotated.
MediaInventoryItem
Public client or immutable record. Fields are returned local/realtime evidence, not an instruction to launch work. Public methods below expose its recorded values.
| Field | Type | Required | Declaration / default | Meaning |
|---|---|---|---|---|
path | str | True | — | Local root, path or POSIX relative path. Scan helpers exclude symlinks; keep paths inside the chosen root. |
display_name | str | True | — | Reader-visible name of this locally observed media item. |
size_bytes | int | True | — | Actual file/transfer size or measured byte progress. |
last_modified_ms | int | True | — | Observed filesystem modification time in milliseconds. |
mime_type | str | None | True | — | Detected MIME type; this alone does not establish codec support. |
file_fingerprint_hash | str | None | True | — | Fingerprint/hash measured from the source; observe the record’s fingerprint kind. |
duration_seconds | float | True | — | Measured duration in seconds, not a promised processing time. |
container_format | str | None | True | — | Recognized extension, inventory classification or probed container. |
probe_data | JsonObject | None | True | — | Actual FFprobe container/stream evidence; opaque dictionaries retain the probe’s fields. |
streams | tuple[ProbeStream, ...] | True | — | Normalized audio/subtitle stream records, with original stream indexes. |
status | str | False | 'active' | Status filter or new status, as appropriate to the method; archived projects retain saved results. |
to_api_dict() -> JsonObjectMediaEmbeddingError
Public exception. Catch the specific type when recovery differs; the base exception covers its subclasses. Optional constructor fields preserve HTTP status, payload or transport evidence as annotated.
MediaExtractionError
Public exception. Catch the specific type when recovery differs; the base exception covers its subclasses. Optional constructor fields preserve HTTP status, payload or transport evidence as annotated.
MediaProbe
Public client or immutable record. Fields are returned local/realtime evidence, not an instruction to launch work. Public methods below expose its recorded values.
| Field | Type | Required | Declaration / default | Meaning |
|---|---|---|---|---|
duration_seconds | float | True | — | Measured duration in seconds, not a promised processing time. |
has_audio | bool | True | — | Whether this observed stream/source can be selected or contains audio. |
streams | tuple[ProbeStream, ...] | True | — | Normalized audio/subtitle stream records, with original stream indexes. |
format | JsonObject | True | — | Actual FFprobe container/stream evidence; opaque dictionaries retain the probe’s fields. |
raw_streams | tuple[JsonObject, ...] | True | — | Actual FFprobe container/stream evidence; opaque dictionaries retain the probe’s fields. |
to_api_dict() -> JsonObjectMediaProbeError
Public exception. Catch the specific type when recovery differs; the base exception covers its subclasses. Optional constructor fields preserve HTTP status, payload or transport evidence as annotated.
MuxedMedia
Public client or immutable record. Fields are returned local/realtime evidence, not an instruction to launch work. Public methods below expose its recorded values.
| Field | Type | Required | Declaration / default | Meaning |
|---|---|---|---|---|
path | Path | True | — | Local root, path or POSIX relative path. Scan helpers exclude symlinks; keep paths inside the chosen root. |
size_bytes | int | True | — | Actual file/transfer size or measured byte progress. |
last_modified_ms | int | True | — | Observed filesystem modification time in milliseconds. |
to_api_dict() -> JsonObjectProbeStream
Public client or immutable record. Fields are returned local/realtime evidence, not an instruction to launch work. Public methods below expose its recorded values.
| Field | Type | Required | Declaration / default | Meaning |
|---|---|---|---|---|
stream_index | int | None | True | — | FFprobe stream index or explicit indexes to replace, not the order in a filtered list. |
stream_type | str | True | — | Actual stream codec or subtitle classification, independently of import recognition. |
stream_class | StreamClass | True | — | Normal, or any combination of Commentary, Forced and SDH. |
codec_type | str | True | — | Actual stream codec or subtitle classification, independently of import recognition. |
codec_name | str | None | True | — | Actual stream codec or subtitle classification, independently of import recognition. |
language | str | None | True | — | Subtitle language or normal/Forced/SDH/Commentary classification; technical language codes remain unchanged. |
tags | JsonObject | None | True | — | Current stream metadata and physical evidence used by observation guards. |
disposition | JsonObject | None | True | — | Current stream metadata and physical evidence used by observation guards. |
selectable | bool | False | True | Whether this observed stream/source can be selected or contains audio. |
language_text_sample | str | None | False | None | Bounded real subtitle text used as language evidence. |
sidecar_path | str | None | False | None | Observed companion-file identity and evidence; preserve the matching file pair. |
sidecar_display_name | str | None | False | None | Observed companion-file identity and evidence; preserve the matching file pair. |
sidecar_size_bytes | int | None | False | None | Observed companion-file identity and evidence; preserve the matching file pair. |
sidecar_last_modified_ms | int | None | False | None | Observed companion-file identity and evidence; preserve the matching file pair. |
sidecar_content_hash | str | None | False | None | Observed companion-file identity and evidence; preserve the matching file pair. |
source_observation | JsonObject | None | False | None | Current stream metadata and physical evidence used by observation guards. |
text_content | str | None | False | None | Complete subtitle text stored by file projects; None for other streams. |
to_api_dict() -> JsonObjectSUBTITLE_EXTENSIONS
Public constant or type alias. The value below comes from source; identifiers and units retain their technical meaning.
SUBTITLE_EXTENSIONS = frozenset({'srt', 'vtt', 'ass'})ScanResult
Public client or immutable record. Fields are returned local/realtime evidence, not an instruction to launch work. Public methods below expose its recorded values.
| Field | Type | Required | Declaration / default | Meaning |
|---|---|---|---|---|
files | tuple[LocalFile, ...] | True | — | Complete directory snapshot, file list or observation evidence required by this endpoint; build it from local files. |
failures | tuple[LocalFailure, ...] | True | — | Recorded per-item failures; this list does not make a partial inventory safe to submit. |
to_api_dict() -> JsonObjectSubftLocalError
Public exception. Catch the specific type when recovery differs; the base exception covers its subclasses. Optional constructor fields preserve HTTP status, payload or transport evidence as annotated.
SubtitleMuxInput
Public client or immutable record. Fields are returned local/realtime evidence, not an instruction to launch work. Public methods below expose its recorded values.
| Field | Type | Required | Declaration / default | Meaning |
|---|---|---|---|---|
path | Path | True | — | Local root, path or POSIX relative path. Scan helpers exclude symlinks; keep paths inside the chosen root. |
language | str | None | False | None | Subtitle language or normal/Forced/SDH/Commentary classification; technical language codes remain unchanged. |
stream_class | StreamClass | False | 'normal' | Normal, or any combination of Commentary, Forced and SDH. |
VIDEO_EXTENSIONS
Public constant or type alias. The value below comes from source; identifiers and units retain their technical meaning.
VIDEO_EXTENSIONS = frozenset({'mp4', 'mkv', 'avi', 'mov', 'webm'})VOBSUB_EXTENSIONS
Public constant or type alias. The value below comes from source; identifiers and units retain their technical meaning.
VOBSUB_EXTENSIONS = frozenset({'idx', 'sub'})build_directory_snapshot
Build complete files, fingerprints and bounded language samples for directory reconciliation.
build_directory_snapshot(
source: FileCollection,
*,
include_hidden: bool = False,
hash_media_paths: Iterable[str | os.PathLike[str]] = (),
include_text_samples: bool = False,
on_progress: ProgressCallback | None = None
) -> DirectorySnapshotResult| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
source | FileCollection | positional-or-keyword | — | Existing local source file, LocalFile record or file collection as annotated; inspect failures before submitting inventory. |
include_hidden | bool | keyword-only | False | Include dot-prefixed files/directories when True; symlinks remain excluded. |
hash_media_paths | Iterable[str | os.PathLike[str]] | keyword-only | () | Relative media paths whose fingerprints are needed for this directory snapshot. |
include_text_samples | bool | keyword-only | False | Include bounded subtitle language samples, or set their maximum source-byte count. |
on_progress | ProgressCallback | None | keyword-only | None | Synchronous callback receiving LocalProgress. Raising cancels work; callback errors propagate. |
build_inventory
Inspect scanned media into API-ready inventory; any recorded failure must be handled before submission.
build_inventory(
source: FileCollection,
*,
include_hidden: bool = False,
ffprobe_executable: str = 'ffprobe',
probe_timeout: float = 30.0,
on_progress: ProgressCallback | None = None
) -> InventoryResult| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
source | FileCollection | positional-or-keyword | — | Existing local source file, LocalFile record or file collection as annotated; inspect failures before submitting inventory. |
include_hidden | bool | keyword-only | False | Include dot-prefixed files/directories when True; symlinks remain excluded. |
ffprobe_executable | str | keyword-only | 'ffprobe' | System executable name or path; installing the Python extra does not install these binaries. |
probe_timeout | float | keyword-only | 30.0 | Timeout in seconds; inspect the signature for the specific request, probe or subscription default. |
on_progress | ProgressCallback | None | keyword-only | None | Synchronous callback receiving LocalProgress. Raising cancels work; callback errors propagate. |
check_ffmpeg_tools
Return tool availability without requiring all tools to exist.
check_ffmpeg_tools(
*,
ffmpeg_executable: str = 'ffmpeg',
ffprobe_executable: str = 'ffprobe',
timeout: float = 5.0
) -> FfmpegTools| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
ffmpeg_executable | str | keyword-only | 'ffmpeg' | System executable name or path; installing the Python extra does not install these binaries. |
ffprobe_executable | str | keyword-only | 'ffprobe' | System executable name or path; installing the Python extra does not install these binaries. |
timeout | float | keyword-only | 5.0 | Timeout in seconds; inspect the signature for the specific request, probe or subscription default. |
count_pgs_images
Count graphical subtitle images from the real source; paired VobSub input requires both files.
count_pgs_images(content: bytes) -> int| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
content | bytes | positional-or-keyword | — | Raw bytes or an iterable of byte chunks. For uploads use the prepared file. |
count_vobsub_images
Count graphical subtitle images from the real source; paired VobSub input requires both files.
count_vobsub_images(text: str) -> int| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
text | str | positional-or-keyword | — | Actual subtitle text or its format (SRT/VTT/ASS); metrics normalize formatting instead of counting raw file bytes. |
embed_subtitle_tracks
Write a caller-owned muxed output, preserving unrelated streams; installation and registration are separate.
embed_subtitle_tracks(
source: LocalSource,
subtitles: Iterable[SubtitleMuxInput],
output_path: str | os.PathLike[str],
*,
ffmpeg_executable: str = 'ffmpeg',
ffprobe_executable: str = 'ffprobe',
timeout: float = 1800.0,
on_progress: ProgressCallback | None = None,
replace_stream_indexes: Iterable[int] = ()
) -> MuxedMedia| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
source | LocalSource | positional-or-keyword | — | Existing local source file, LocalFile record or file collection as annotated; inspect failures before submitting inventory. |
subtitles | Iterable[SubtitleMuxInput] | positional-or-keyword | — | SubtitleMuxInput records naming real SRT files, languages and stream classes to add. |
output_path | str | os.PathLike[str] | positional-or-keyword | — | Caller-owned new output path. Extraction/mux helpers do not replace the original or register backend assets. |
ffmpeg_executable | str | keyword-only | 'ffmpeg' | System executable name or path; installing the Python extra does not install these binaries. |
ffprobe_executable | str | keyword-only | 'ffprobe' | System executable name or path; installing the Python extra does not install these binaries. |
timeout | float | keyword-only | 1800.0 | Timeout in seconds; inspect the signature for the specific request, probe or subscription default. |
on_progress | ProgressCallback | None | keyword-only | None | Synchronous callback receiving LocalProgress. Raising cancels work; callback errors propagate. |
replace_stream_indexes | Iterable[int] | keyword-only | () | FFprobe stream index or explicit indexes to replace, not the order in a filtered list. |
extract_audio_stream
Extract one selected audio stream as MP3 without changing the original.
extract_audio_stream(
source: LocalSource,
stream_index: int,
output_path: str | os.PathLike[str],
*,
ffmpeg_executable: str = 'ffmpeg',
timeout: float = 1800.0,
on_progress: ProgressCallback | None = None
) -> ExtractedFile| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
source | LocalSource | positional-or-keyword | — | Existing local source file, LocalFile record or file collection as annotated; inspect failures before submitting inventory. |
stream_index | int | positional-or-keyword | — | FFprobe stream index or explicit indexes to replace, not the order in a filtered list. |
output_path | str | os.PathLike[str] | positional-or-keyword | — | Caller-owned new output path. Extraction/mux helpers do not replace the original or register backend assets. |
ffmpeg_executable | str | keyword-only | 'ffmpeg' | System executable name or path; installing the Python extra does not install these binaries. |
timeout | float | keyword-only | 1800.0 | Timeout in seconds; inspect the signature for the specific request, probe or subscription default. |
on_progress | ProgressCallback | None | keyword-only | None | Synchronous callback receiving LocalProgress. Raising cancels work; callback errors propagate. |
extract_subtitle_stream
Extract text as SRT or copy graphical subtitles to Matroska; the caller owns cleanup.
extract_subtitle_stream(
source: LocalSource,
stream_index: int,
output_path: str | os.PathLike[str],
*,
graphical: bool = False,
source_format: str = 'srt',
ffmpeg_executable: str = 'ffmpeg',
timeout: float = 1800.0,
on_progress: ProgressCallback | None = None
) -> ExtractedFile| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
source | LocalSource | positional-or-keyword | — | Existing local source file, LocalFile record or file collection as annotated; inspect failures before submitting inventory. |
stream_index | int | positional-or-keyword | — | FFprobe stream index or explicit indexes to replace, not the order in a filtered list. |
output_path | str | os.PathLike[str] | positional-or-keyword | — | Caller-owned new output path. Extraction/mux helpers do not replace the original or register backend assets. |
graphical | bool | keyword-only | False | Whether extraction copies a graphical subtitle stream into Matroska rather than producing SRT. |
source_format | str | keyword-only | 'srt' | Actual subtitle text or its format (SRT/VTT/ASS); metrics normalize formatting instead of counting raw file bytes. |
ffmpeg_executable | str | keyword-only | 'ffmpeg' | System executable name or path; installing the Python extra does not install these binaries. |
timeout | float | keyword-only | 1800.0 | Timeout in seconds; inspect the signature for the specific request, probe or subscription default. |
on_progress | ProgressCallback | None | keyword-only | None | Synchronous callback receiving LocalProgress. Raising cancels work; callback errors propagate. |
fingerprint_media_file
Compute the compatible full or partial media fingerprint and reject source mutation.
fingerprint_media_file(
source: LocalSource,
*,
chunk_size: int = DEFAULT_HASH_CHUNK_SIZE,
on_progress: ProgressCallback | None = None
) -> FileFingerprint| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
source | LocalSource | positional-or-keyword | — | Existing local source file, LocalFile record or file collection as annotated; inspect failures before submitting inventory. |
chunk_size | int | keyword-only | DEFAULT_HASH_CHUNK_SIZE | Positive number of bytes read per hashing chunk; preserve the default for compatible partial fingerprints. |
on_progress | ProgressCallback | None | keyword-only | None | Synchronous callback receiving LocalProgress. Raising cancels work; callback errors propagate. |
hash_file_sha256
Stream all bytes into a SHA-256 FileFingerprint; read its hash field for API requests.
hash_file_sha256(
source: LocalSource,
*,
chunk_size: int = DEFAULT_HASH_CHUNK_SIZE,
on_progress: ProgressCallback | None = None
) -> FileFingerprint| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
source | LocalSource | positional-or-keyword | — | Existing local source file, LocalFile record or file collection as annotated; inspect failures before submitting inventory. |
chunk_size | int | keyword-only | DEFAULT_HASH_CHUNK_SIZE | Positive number of bytes read per hashing chunk; preserve the default for compatible partial fingerprints. |
on_progress | ProgressCallback | None | keyword-only | None | Synchronous callback receiving LocalProgress. Raising cancels work; callback errors propagate. |
hash_text_subtitle
Hash subtitle text after newline and surrounding-whitespace normalization.
hash_text_subtitle(source: LocalSource) -> FileFingerprint| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
source | LocalSource | positional-or-keyword | — | Existing local source file, LocalFile record or file collection as annotated; inspect failures before submitting inventory. |
inspect_media
Inspect one supported file and return actual probe evidence and source observations.
inspect_media(
source: LocalFile | str | os.PathLike[str],
*,
relative_path: str | None = None,
ffprobe_executable: str = 'ffprobe',
probe_timeout: float = 30.0,
on_progress: ProgressCallback | None = None,
file_project: bool = False
) -> MediaInventoryItem| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
source | LocalFile | str | os.PathLike[str] | positional-or-keyword | — | Existing local source file, LocalFile record or file collection as annotated; inspect failures before submitting inventory. |
relative_path | str | None | keyword-only | None | Local root, path or POSIX relative path. Scan helpers exclude symlinks; keep paths inside the chosen root. |
ffprobe_executable | str | keyword-only | 'ffprobe' | System executable name or path; installing the Python extra does not install these binaries. |
probe_timeout | float | keyword-only | 30.0 | Timeout in seconds; inspect the signature for the specific request, probe or subscription default. |
on_progress | ProgressCallback | None | keyword-only | None | Synchronous callback receiving LocalProgress. Raising cancels work; callback errors propagate. |
file_project | bool | keyword-only | False | Apply file-project rules: include complete subtitle text and reject graphical subtitle files. |
pgs_duration_seconds
Derive subtitle duration in seconds from actual cue/image timing.
pgs_duration_seconds(content: bytes) -> float| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
content | bytes | positional-or-keyword | — | Raw bytes or an iterable of byte chunks. For uploads use the prepared file. |
probe_media
Read FFprobe duration, streams and container evidence without modifying the file.
probe_media(
source: LocalSource,
*,
ffprobe_executable: str = 'ffprobe',
timeout: float = 30.0
) -> MediaProbe| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
source | LocalSource | positional-or-keyword | — | Existing local source file, LocalFile record or file collection as annotated; inspect failures before submitting inventory. |
ffprobe_executable | str | keyword-only | 'ffprobe' | System executable name or path; installing the Python extra does not install these binaries. |
timeout | float | keyword-only | 30.0 | Timeout in seconds; inspect the signature for the specific request, probe or subscription default. |
read_subtitle_language_sample
Read a bounded source-text sample for language classification.
read_subtitle_language_sample(
source: LocalSource, *, max_bytes: int = LANGUAGE_SAMPLE_BYTES
) -> str | None| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
source | LocalSource | positional-or-keyword | — | Existing local source file, LocalFile record or file collection as annotated; inspect failures before submitting inventory. |
max_bytes | int | keyword-only | LANGUAGE_SAMPLE_BYTES | Include bounded subtitle language samples, or set their maximum source-byte count. |
require_ffmpeg_tools
Require the selected tools and raise FfmpegUnavailableError if prerequisites are absent.
require_ffmpeg_tools(
*,
ffmpeg_executable: str = 'ffmpeg',
ffprobe_executable: str = 'ffprobe',
timeout: float = 5.0,
require_ffmpeg: bool = True,
require_ffprobe: bool = True
) -> FfmpegTools| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
ffmpeg_executable | str | keyword-only | 'ffmpeg' | System executable name or path; installing the Python extra does not install these binaries. |
ffprobe_executable | str | keyword-only | 'ffprobe' | System executable name or path; installing the Python extra does not install these binaries. |
timeout | float | keyword-only | 5.0 | Timeout in seconds; inspect the signature for the specific request, probe or subscription default. |
require_ffmpeg | bool | keyword-only | True | Whether this tool check requires the corresponding executable to be available. |
require_ffprobe | bool | keyword-only | True | Whether this tool check requires the corresponding executable to be available. |
scan_directory
Scan deterministically, skip symlinks and record per-path failures.
scan_directory(
root: str | os.PathLike[str],
*,
include_hidden: bool = False,
on_progress: ProgressCallback | None = None
) -> ScanResult| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
root | str | os.PathLike[str] | positional-or-keyword | — | Local root, path or POSIX relative path. Scan helpers exclude symlinks; keep paths inside the chosen root. |
include_hidden | bool | keyword-only | False | Include dot-prefixed files/directories when True; symlinks remain excluded. |
on_progress | ProgressCallback | None | keyword-only | None | Synchronous callback receiving LocalProgress. Raising cancels work; callback errors propagate. |
subtitle_duration_seconds
Derive subtitle duration in seconds from actual cue/image timing.
subtitle_duration_seconds(
text: str, format_hint: str | None = None
) -> float| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
text | str | positional-or-keyword | — | Actual subtitle text or its format (SRT/VTT/ASS); metrics normalize formatting instead of counting raw file bytes. |
format_hint | str | None | positional-or-keyword | None | Actual subtitle text or its format (SRT/VTT/ASS); metrics normalize formatting instead of counting raw file bytes. |
vobsub_duration_seconds
Derive subtitle duration in seconds from actual cue/image timing.
vobsub_duration_seconds(text: str) -> float| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
text | str | positional-or-keyword | — | Actual subtitle text or its format (SRT/VTT/ASS); metrics normalize formatting instead of counting raw file bytes. |
vobsub_pair_hash
Combine matching IDX/SUB fingerprints in the documented deterministic order.
vobsub_pair_hash(idx_hash: str, sub_hash: str) -> str| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
idx_hash | str | positional-or-keyword | — | Hashes of the real matching IDX and SUB files, used to form a stable paired-source hash. |
sub_hash | str | positional-or-keyword | — | Hashes of the real matching IDX and SUB files, used to form a stable paired-source hash. |
visible_subtitle_character_count
Count visible subtitle characters using the billing normalization rules.
visible_subtitle_character_count(
text: str, format_hint: str | None = None
) -> int| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
text | str | positional-or-keyword | — | Actual subtitle text or its format (SRT/VTT/ASS); metrics normalize formatting instead of counting raw file bytes. |
format_hint | str | None | positional-or-keyword | None | Actual subtitle text or its format (SRT/VTT/ASS); metrics normalize formatting instead of counting raw file bytes. |
Realtime helpers and records
Import from subft_client.realtime. Local functions need the local extra and the selected system tools. Inspect returned failures before updating backend inventory. Realtime needs its extra and performs no canonical HTTP reconciliation.
OperationEvent
Public client or immutable record. Fields are returned local/realtime evidence, not an instruction to launch work. Public methods below expose its recorded values.
| Field | Type | Required | Declaration / default | Meaning |
|---|---|---|---|---|
event | str | True | — | Realtime event/connection data; fetch canonical HTTP state before deciding the outcome. |
operation_id | str | True | — | ID of the committed operation; retain it before leaving or retrying preparation. |
content_id | str | None | True | — | One source item inside an operation, not a project-media or artifact ID. |
session_id | str | None | True | — | Realtime event/connection data; fetch canonical HTTP state before deciding the outcome. |
status | str | None | True | — | Status filter or new status, as appropriate to the method; archived projects retain saved results. |
payload | Mapping[str, Any] | True | — | Endpoint-specific request mapping. Use its schema and preserve required observation or preparation guards. |
RealtimeConnectionState
Public client or immutable record. Fields are returned local/realtime evidence, not an instruction to launch work. Public methods below expose its recorded values.
| Field | Type | Required | Declaration / default | Meaning |
|---|---|---|---|---|
status | ConnectionStatus | True | — | Status filter or new status, as appropriate to the method; archived projects retain saved results. |
attempt | int | True | — | Realtime event/connection data; fetch canonical HTTP state before deciding the outcome. |
reconnected | bool | True | — | Whether the event follows a successful reconnect; fetch canonical state again. |
reason | str | None | False | None | Technical reason for this connection state; use canonical HTTP state to decide recovery. |
RealtimeDependencyError
Public exception. Catch the specific type when recovery differs; the base exception covers its subclasses. Optional constructor fields preserve HTTP status, payload or transport evidence as annotated.
RealtimeProtocolError
Public exception. Catch the specific type when recovery differs; the base exception covers its subclasses. Optional constructor fields preserve HTTP status, payload or transport evidence as annotated.
RealtimeSubscriptionError
RealtimeSubscriptionError(code: str='request_failed', params: Mapping[str, Any] | None=None)Realtime subscription rejections use event: "failed" with a {code, params} descriptor in payload.error. RealtimeSubscriptionError exposes code and params; diagnostic text is not a presentation contract.
Public exception. Catch the specific type when recovery differs; the base exception covers its subclasses. Optional constructor fields preserve HTTP status, payload or transport evidence as annotated.
SubftRealtimeError
Public exception. Catch the specific type when recovery differs; the base exception covers its subclasses. Optional constructor fields preserve HTTP status, payload or transport evidence as annotated.
watch_operation_events
Yield operation events and connection changes with reconnect/backoff; canonical HTTP reconciliation remains the caller’s responsibility.
watch_operation_events(
base_url: str,
operation_id: str,
*,
token: str,
heartbeat_interval: float = DEFAULT_HEARTBEAT_INTERVAL,
pong_timeout: float = DEFAULT_PONG_TIMEOUT,
subscribe_timeout: float = DEFAULT_SUBSCRIBE_TIMEOUT,
reconnect_initial_delay: float = DEFAULT_RECONNECT_INITIAL_DELAY,
reconnect_max_delay: float = DEFAULT_RECONNECT_MAX_DELAY,
_sleep: Callable[[float], Awaitable[None]] = asyncio.sleep
) -> AsyncGenerator[RealtimeMessage, None]| Parameter | Type | Passing | Default | Meaning |
|---|---|---|---|---|
base_url | str | positional-or-keyword | — | Gateway URL serving API, authentication and realtime routes; a trailing slash is normalized. |
operation_id | str | positional-or-keyword | — | ID of the committed operation; retain it before leaving or retrying preparation. |
token | str | keyword-only | — | API token from Developer access. Keep it in a protected environment variable. |
heartbeat_interval | float | keyword-only | DEFAULT_HEARTBEAT_INTERVAL | Heartbeat, pong or reconnect interval in seconds; reconnect uses capped backoff. |
pong_timeout | float | keyword-only | DEFAULT_PONG_TIMEOUT | Heartbeat, pong or reconnect interval in seconds; reconnect uses capped backoff. |
subscribe_timeout | float | keyword-only | DEFAULT_SUBSCRIBE_TIMEOUT | Timeout in seconds; inspect the signature for the specific request, probe or subscription default. |
reconnect_initial_delay | float | keyword-only | DEFAULT_RECONNECT_INITIAL_DELAY | Heartbeat, pong or reconnect interval in seconds; reconnect uses capped backoff. |
reconnect_max_delay | float | keyword-only | DEFAULT_RECONNECT_MAX_DELAY | Heartbeat, pong or reconnect interval in seconds; reconnect uses capped backoff. |
_sleep | Callable[[float], Awaitable[None]] | keyword-only | asyncio.sleep | Optional async sleep implementation for deterministic tests; ordinary integrations retain the default. |
Request and response schemas
The tables reproduce declared fields, including inherited fields. Required uses True/False. A dash means no default declaration; Field(...) records actual Pydantic defaults and constraints. Nullable fields can still be required. Named types describe nested records; dict[str, Any] is deliberately open, not an invented exhaustive schema. Upload targets additionally return upload_id, operation_id, media_id, content_id, upload_url, method, headers, expires_at and optional sidecar; preserve their identity, expiry and method. The worked recipe validates the fields it consumes.
AssetSelection
Source-derived contract. Keep required fields and guards when adapting the recipe; nullable values are distinct from missing required fields.
| Field | Type | Required | Declaration / default | Meaning |
|---|---|---|---|---|
media_id | str | True | Field(max_length=64) | Media ID in this route: a project-media ID for project routes, an operation-media ID for upload/preparation routes. |
asset_id | str | True | Field(max_length=64) | ID of the selected subtitle/audio asset owned by its media. |
source_language | str | True | Field(max_length=32) | Canonical source language captured with the guarded selection. |
expected_snapshot_id | str | None | False | Field(default=None, max_length=64) | Current immutable snapshot or physical check generation used to pin the source. |
expected_autosave_version | int | None | False | None | Current observation/generation/save guards from the relevant read or begin-check response; stale guards require a fresh read. |
expected_observation | SourceObservation | None | False | None | Physical files and stream evidence that must still match at commit. |
check_generation | int | None | False | None | Current immutable snapshot or physical check generation used to pin the source. |
CapturedExport
Source-derived contract. Keep required fields and guards when adapting the recipe; nullable values are distinct from missing required fields.
| Field | Type | Required | Declaration / default | Meaning |
|---|---|---|---|---|
asset_id | str | True | Field(max_length=64) | ID of the selected subtitle/audio asset owned by its media. |
snapshot_id | str | True | Field(max_length=64) | Producing/result asset and immutable snapshot lineage; preserve these identities across export. |
autosave_version | int | None | True | — | Current editable save version used to detect concurrent edits. |
effective_metadata | EffectiveMetadata | True | — | Captured container language or effective language/classification for the output. |
container_language | str | True | Field(max_length=32) | Captured container language or effective language/classification for the output. |
format | Literal['srt', 'vtt', 'ass'] | True | — | Actual FFprobe container/stream evidence; opaque dictionaries retain the probe’s fields. |
options | ExportOptions | False | Field(default_factory=ExportOptions) | Export destination identity or endpoint-specific export options. |
mime_type | str | True | Field(max_length=255) | Detected MIME type; this alone does not establish codec support. |
suggested_path | str | True | Field(max_length=2048) | Frozen export metadata, backend-suggested relative filename or actual serialized subtitle text. |
serializer_version | int | True | — | Version of the parser or export serializer used for the captured document. |
parser_version | int | True | — | Version of the parser or export serializer used for the captured document. |
text_content | str | True | Field(max_length=20000000) | Frozen export metadata, backend-suggested relative filename or actual serialized subtitle text. |
CommittedSource
Source-derived contract. Keep required fields and guards when adapting the recipe; nullable values are distinct from missing required fields.
Value under source_ref_map keyed as project-media-ID:asset-ID. Use its runtime media_id/content_id for preparation and upload; plans identify sources with source_ref.
| Field | Type | Required | Declaration / default | Meaning |
|---|---|---|---|---|
media_id | str | True | — | Media ID in this route: a project-media ID for project routes, an operation-media ID for upload/preparation routes. |
content_id | str | True | — | One source item inside an operation, not a project-media or artifact ID. |
project_media_id | str | True | — | Operation/project media relationship and the recorded relative media path. |
ContentFlow
Source-derived contract. Keep required fields and guards when adapting the recipe; nullable values are distinct from missing required fields.
| Field | Type | Required | Declaration / default | Meaning |
|---|---|---|---|---|
status | str | True | — | Status filter or new status, as appropriate to the method; archived projects retain saved results. |
step | str | True | — | Machine-readable execution step; use the enclosing flow/progress type and its enumerated values. |
execution_count | int | True | — | Number of execution attempts recorded for this source flow. |
failure_code | str | None | True | — | Nullable machine-readable failure code; map it to localized user text. |
failure_class | str | None | True | — | Nullable machine classification of the failure, separate from failure_code. |
runnable_at | str | None | True | — | Nullable timestamp at which this flow becomes eligible for execution. |
ContentPreparation
Source-derived contract. Keep required fields and guards when adapting the recipe; nullable values are distinct from missing required fields.
Canonical preparation has states awaiting_client, preparing, hashing, uploading, awaiting_retry, ready, abandoned and not_required. attempt_id and lease/upload expiry may be null. allowed_actions contains only currently eligible start_preparation, retry_preparation or abandon_source. Retry requires the previous attempt_id and a fresh UUID; ready and terminal work must not be resupplied blindly.
| Field | Type | Required | Declaration / default | Meaning |
|---|---|---|---|---|
state | str | True | — | State of this record; preparation states and operation states are distinguished in the enclosing schema explanation. |
attempt_id | str | None | True | — | A fresh UUID chosen by the caller and confirmed by the preparation response; use it for every request of that attempt. |
attempt_number | int | True | — | Preparation attempt revision, failure code or expiry; expired attempts/targets require canonical recovery. |
client_progress_revision | int | True | — | Increasing revision of accepted client progress within the current attempt. |
failure_code | str | None | True | — | Nullable machine-readable failure code; map it to localized user text. |
updated_at | str | None | True | — | Recorded server timestamp; a nullable value means the event has not occurred or is unavailable. |
lease_expires_at | str | None | True | — | Nullable ISO expiry for the preparation lease or issued upload target. |
upload_expires_at | str | None | True | — | Nullable ISO expiry for the preparation lease or issued upload target. |
allowed_actions | tuple[str, ...] | True | — | Actions currently permitted by the canonical state, not a promise for later requests. |
ContentPreparationResponse
Source-derived contract. Keep required fields and guards when adapting the recipe; nullable values are distinct from missing required fields.
This is the nested preparation snapshot, not operation execution_state. The preparation endpoint wraps it with operation_id, content_id and progress. Its state is preparing after an accepted start/retry; verify the echoed attempt_id. media_id comes from the route/source_ref_map, not this response wrapper.
| Field | Type | Required | Declaration / default | Meaning |
|---|---|---|---|---|
state | Literal['awaiting_client', 'preparing', 'hashing', 'uploading', 'awaiting_retry', 'ready', 'abandoned', 'not_required'] | True | — | State of this record; preparation states and operation states are distinguished in the enclosing schema explanation. |
attempt_id | str | None | False | None | A fresh UUID chosen by the caller and confirmed by the preparation response; use it for every request of that attempt. |
attempt_number | int | True | — | Preparation attempt revision, failure code or expiry; expired attempts/targets require canonical recovery. |
client_progress_revision | int | True | — | Increasing revision of accepted client progress within the current attempt. |
failure_code | str | None | False | None | Nullable machine-readable failure code; map it to localized user text. |
updated_at | str | None | False | None | Recorded server timestamp; a nullable value means the event has not occurred or is unavailable. |
lease_expires_at | str | None | False | None | Nullable ISO expiry for the preparation lease or issued upload target. |
upload_expires_at | str | None | False | None | Nullable ISO expiry for the preparation lease or issued upload target. |
allowed_actions | list[Literal['start_preparation', 'retry_preparation', 'abandon_source']] | True | — | Actions currently permitted by the canonical state, not a promise for later requests. |
ContentProgress
Source-derived contract. Keep required fields and guards when adapting the recipe; nullable values are distinct from missing required fields.
| Field | Type | Required | Declaration / default | Meaning |
|---|---|---|---|---|
version | int | True | — | Progress schema version, currently 4; reject unsupported versions rather than guessing their structure. |
revision | int | True | — | Increasing canonical progress revision; reconcile stale events with HTTP state. |
status | ProgressStatus | True | — | Status filter or new status, as appropriate to the method; archived projects retain saved results. |
phase_plan | tuple[str, ...] | True | — | Ordered phases in the admitted workflow; absent stages are not implied work. |
current_phase | str | None | True | — | Nullable active phase or step. A terminal snapshot can have no active phase/step. |
current_step_name | str | None | True | — | Machine-readable execution step; use the enclosing flow/progress type and its enumerated values. |
active_work_units | int | True | — | Number of work units currently active in this step, phase or snapshot. |
counts | Mapping[str, int] | True | — | Nested workflow phase counts: total, resolved, completed, skipped and failed. |
phases | Mapping[str, ProgressPhase] | True | — | Nested per-phase or per-step records keyed by the corresponding enum value; inspect their status and measurements. |
CreditEstimate
Source-derived contract. Keep required fields and guards when adapting the recipe; nullable values are distinct from missing required fields.
| Field | Type | Required | Declaration / default | Meaning |
|---|---|---|---|---|
required_credits | int | True | — | Credit quote or admission decision from the current estimate; inspect the enclosing field type. |
available_credits | int | True | — | Credit quote or admission decision from the current estimate; inspect the enclosing field type. |
shortfall | int | True | — | Credit quote or admission decision from the current estimate; inspect the enclosing field type. |
missing_metrics | int | True | — | Number of required source metrics still absent; must be zero before committing. |
can_commit | bool | True | — | Credit quote or admission decision from the current estimate; inspect the enclosing field type. |
contents | tuple[CreditEstimateContent, ...] | True | — | Nested source items or per-source estimate rows, according to the enclosing record. |
CreditEstimateContent
Source-derived contract. Keep required fields and guards when adapting the recipe; nullable values are distinct from missing required fields.
| Field | Type | Required | Declaration / default | Meaning |
|---|---|---|---|---|
source_ref | SourceRef | True | — | Stable pair of project media ID and selected asset ID; runtime content IDs are different. |
media_path | str | True | — | Operation/project media relationship and the recorded relative media path. |
type | ContentType | True | — | Source category text, audio or graphical; it determines the requested metrics and stages. |
stream_class | str | True | — | Normal, or any combination of Commentary, Forced and SDH. |
stream_index | int | None | True | — | FFprobe stream index or explicit indexes to replace, not the order in a filtered list. |
character_count | int | None | True | — | Measured visible characters or graphical images requested by the plan; never substitute guessed counts. |
image_count | int | None | True | — | Measured visible characters or graphical images requested by the plan; never substitute guessed counts. |
duration_seconds | float | None | True | — | Measured duration in seconds, not a promised processing time. |
credits | int | None | True | — | Credits quoted for this source. |
EffectiveMetadata
Source-derived contract. Keep required fields and guards when adapting the recipe; nullable values are distinct from missing required fields.
| Field | Type | Required | Declaration / default | Meaning |
|---|---|---|---|---|
language | str | False | Field(default='und', max_length=32) | Subtitle language or normal/Forced/SDH/Commentary classification; technical language codes remain unchanged. |
classification | tuple[Disposition, ...] | None | False | Field(default=None, max_length=16) | Subtitle language or normal/Forced/SDH/Commentary classification; technical language codes remain unchanged. |
ExportOptions
Source-derived contract. Keep required fields and guards when adapting the recipe; nullable values are distinct from missing required fields.
FileObservation
Source-derived contract. Keep required fields and guards when adapting the recipe; nullable values are distinct from missing required fields.
| Field | Type | Required | Declaration / default | Meaning |
|---|---|---|---|---|
role | Literal['primary', 'index', 'data'] | False | 'primary' | Physical-file role, observed fingerprint or stream descriptor used for guarded checks. |
size_bytes | StrictInt | True | Field(ge=0) | Actual file/transfer size or measured byte progress. |
last_modified_ms | StrictInt | True | — | Observed filesystem modification time in milliseconds. |
sampled_fingerprint | str | None | False | Field(default=None, max_length=128) | Physical-file role, observed fingerprint or stream descriptor used for guarded checks. |
OperationBaseResponse
Source-derived contract. Keep required fields and guards when adapting the recipe; nullable values are distinct from missing required fields.
execution_state is pending/running/finished. outcome is null until finished, then succeeded/partially_succeeded/failed/canceled. display_status is the state or terminal outcome. Counts summarize the enabled contents; state_version and event_sequence order observations. Every operation has committed_at and charged_credits; transient plans have no charge. media is open in this response declaration; the parser records below describe the consumed nested fields.
| Field | Type | Required | Declaration / default | Meaning |
|---|---|---|---|---|
operation_id | str | True | — | ID of the committed operation; retain it before leaving or retrying preparation. |
project_id | str | None | False | None | ID of the durable project, returned when creating or listing projects. |
kind | str | True | — | Endpoint-specific asset kind, check scope, readiness or placement selector; follow that endpoint’s contract. |
target_language | str | None | False | None | Target language code for generated or translated subtitles. |
execution_state | Literal['pending', 'running', 'finished'] | True | — | Canonical lifecycle field: execution, terminal outcome, display or monotonic revision/sequence. |
outcome | Literal['succeeded', 'partially_succeeded', 'failed', 'canceled'] | None | True | — | Canonical lifecycle field: execution, terminal outcome, display or monotonic revision/sequence. |
display_status | Literal['pending', 'running', 'succeeded', 'partially_succeeded', 'failed', 'canceled'] | True | — | Canonical lifecycle field: execution, terminal outcome, display or monotonic revision/sequence. |
state_version | int | True | — | Canonical lifecycle field: execution, terminal outcome, display or monotonic revision/sequence. |
event_sequence | int | True | — | Canonical lifecycle field: execution, terminal outcome, display or monotonic revision/sequence. |
phase_counts | WorkflowPhaseCounts | True | — | Nested workflow and count projections; see the named schema rather than treating them as a status string. |
content_counts | OperationLifecycleContentCountsResponse | True | — | Nested workflow and count projections; see the named schema rather than treating them as a status string. |
preparation_counts | OperationPreparationCountsResponse | True | — | Nested workflow and count projections; see the named schema rather than treating them as a status string. |
allowed_actions | list[Literal['abort']] | True | — | Actions currently permitted by the canonical state, not a promise for later requests. |
started_at | str | None | False | None | Recorded server timestamp; a nullable value means the event has not occurred or is unavailable. |
finished_at | str | None | False | None | Recorded server timestamp; a nullable value means the event has not occurred or is unavailable. |
updated_at | str | None | False | None | Recorded server timestamp; a nullable value means the event has not occurred or is unavailable. |
created_at | str | None | False | None | Recorded server timestamp; a nullable value means the event has not occurred or is unavailable. |
committed_at | str | True | — | Required server timestamp recorded when the operation was committed. |
charged_credits | int | True | — | Credits deducted when the work started. |
charged_at | str | None | False | None | Recorded server timestamp; a nullable value means the event has not occurred or is unavailable. |
refunded_credits | int | True | — | Credits returned later for eligible stages or sources. |
used_credits | int | True | — | Charged credits minus refunded credits, never below zero. |
workflow | OperationWorkflowSummaryResponse | False | Field(default_factory=OperationWorkflowSummaryResponse) | Nested workflow and count projections; see the named schema rather than treating them as a status string. |
OperationContent
Source-derived contract. Keep required fields and guards when adapting the recipe; nullable values are distinct from missing required fields.
Nested source item as normalized by the CLI parser. source_ref contains project media_id and asset_id. asset_input.selection carries server-issued AssetSelection guards unchanged. preparation is described below; flow can be null. progress is version 4, not a completion percentage. Optional/null annotations in these parser records describe normalized values, not an exhaustive HTTP validation model.
| Field | Type | Required | Declaration / default | Meaning |
|---|---|---|---|---|
source_ref | SourceRef | True | — | Stable pair of project media ID and selected asset ID; runtime content IDs are different. |
enabled | bool | True | — | Source inclusion or explicit language override in the current plan. |
type | ContentType | True | — | Source category text, audio or graphical; it determines the requested metrics and stages. |
stream_class | str | True | — | Normal, or any combination of Commentary, Forced and SDH. |
codec_type | str | None | True | — | Actual stream codec or subtitle classification, independently of import recognition. |
codec_name | str | None | True | — | Actual stream codec or subtitle classification, independently of import recognition. |
stream_index | int | None | True | — | FFprobe stream index or explicit indexes to replace, not the order in a filtered list. |
filename | str | None | True | — | Prepared filename, including its real extension, used to select storage format. |
language | str | None | True | — | Subtitle language or normal/Forced/SDH/Commentary classification; technical language codes remain unchanged. |
language_override | str | None | True | — | Source inclusion or explicit language override in the current plan. |
workflow_kind | str | None | True | — | Selected stage workflow and its planning explanation; null when no workflow is selected. |
workflow_reason | str | None | True | — | Selected stage workflow and its planning explanation; null when no workflow is selected. |
input_snapshot_id | str | None | True | — | Producing/result asset and immutable snapshot lineage; preserve these identities across export. |
asset_input | dict[str, Any] | True | — | Server-issued input contract; preserve its selection guards and asset identity. |
id | str | True | — | Identifier of the returned resource. |
status | str | True | — | Status filter or new status, as appropriate to the method; archived projects retain saved results. |
preparation | ContentPreparation | True | — | Canonical attempt snapshot, including state, attempt guard and allowed actions. |
flow | ContentFlow | None | True | — | Nullable canonical flow state: status, step, execution_count, failure_code, failure_class and runnable_at. |
failure_code | str | None | True | — | Nullable machine-readable failure code; map it to localized user text. |
progress_updated_at | str | None | True | — | Nullable timestamp of the latest accepted progress update. |
progress | ContentProgress | True | — | Progress version 4 with phase_plan, current phase/step/measurement, phases and revision. It is not a legacy percent value. |
OperationLifecycleContentCountsResponse
Source-derived contract. Keep required fields and guards when adapting the recipe; nullable values are distinct from missing required fields.
| Field | Type | Required | Declaration / default | Meaning |
|---|---|---|---|---|
total | int | True | — | Local progress phase and measured item/byte completion; callbacks are synchronous. |
pending | int | True | — | Number of sources in this named lifecycle or preparation state; counts are not percentages. |
uploading | int | True | — | Number of sources in this named lifecycle or preparation state; counts are not percentages. |
processing | int | True | — | Number of sources in this named lifecycle or preparation state; counts are not percentages. |
completed | int | True | — | Measured units completed, from 0 through total. A measurement cannot exceed its total. |
failed | int | True | — | Number of sources in this named lifecycle or preparation state; counts are not percentages. |
skipped | int | True | — | Number of sources in this named lifecycle or preparation state; counts are not percentages. |
terminal | int | True | — | Number of sources in this named lifecycle or preparation state; counts are not percentages. |
OperationMedia
Source-derived contract. Keep required fields and guards when adapting the recipe; nullable values are distinct from missing required fields.
Nested operation media. id is the runtime media ID, while project_media_id is its durable project destination. contents is a JSON array on the wire and a tuple in this CLI parser record. Disabled items must not be supplied.
| Field | Type | Required | Declaration / default | Meaning |
|---|---|---|---|---|
id | str | True | — | Identifier of the returned resource. |
project_media_id | str | True | — | Operation/project media relationship and the recorded relative media path. |
path | str | True | — | Local root, path or POSIX relative path. Scan helpers exclude symlinks; keep paths inside the chosen root. |
enabled | bool | True | — | Source inclusion or explicit language override in the current plan. |
contents | tuple[OperationContent, ...] | True | — | Nested source items or per-source estimate rows, according to the enclosing record. |
OperationPreparationCountsResponse
Source-derived contract. Keep required fields and guards when adapting the recipe; nullable values are distinct from missing required fields.
| Field | Type | Required | Declaration / default | Meaning |
|---|---|---|---|---|
awaiting_client | int | True | — | Number of sources in this named lifecycle or preparation state; counts are not percentages. |
preparing | int | True | — | Number of sources in this named lifecycle or preparation state; counts are not percentages. |
hashing | int | True | — | Number of sources in this named lifecycle or preparation state; counts are not percentages. |
uploading | int | True | — | Number of sources in this named lifecycle or preparation state; counts are not percentages. |
awaiting_retry | int | True | — | Number of sources in this named lifecycle or preparation state; counts are not percentages. |
ready | int | True | — | Number of sources in this named lifecycle or preparation state; counts are not percentages. |
abandoned | int | True | — | Number of sources in this named lifecycle or preparation state; counts are not percentages. |
not_required | int | True | — | Number of sources in this named lifecycle or preparation state; counts are not percentages. |
OperationResultExportResponse
Source-derived contract. Keep required fields and guards when adapting the recipe; nullable values are distinct from missing required fields.
| Field | Type | Required | Declaration / default | Meaning |
|---|---|---|---|---|
artifact_id | str | True | — | ID of an immutable successful operation stage returned by the result list. |
snapshot_id | str | True | — | Producing/result asset and immutable snapshot lineage; preserve these identities across export. |
content_id | str | True | — | One source item inside an operation, not a project-media or artifact ID. |
output_target | OutputTarget | True | — | external_srt, external_vtt, external_ass or embedded; None uses the endpoint/account default. |
capture | CapturedExport | True | — | Frozen export metadata, backend-suggested relative filename or actual serialized subtitle text. |
suggested_path | str | True | — | Frozen export metadata, backend-suggested relative filename or actual serialized subtitle text. |
mime_type | str | True | — | Detected MIME type; this alone does not establish codec support. |
text_content | str | True | — | Frozen export metadata, backend-suggested relative filename or actual serialized subtitle text. |
media_path | str | True | — | Operation/project media relationship and the recorded relative media path. |
language | str | None | False | None | Subtitle language or normal/Forced/SDH/Commentary classification; technical language codes remain unchanged. |
stream_index | int | None | False | None | FFprobe stream index or explicit indexes to replace, not the order in a filtered list. |
stream_class | str | None | False | None | Normal, or any combination of Commentary, Forced and SDH. |
OperationWorkflowSummaryResponse
Source-derived contract. Keep required fields and guards when adapting the recipe; nullable values are distinct from missing required fields.
| Field | Type | Required | Declaration / default | Meaning |
|---|---|---|---|---|
requested | WorkflowStageFlagsResponse | False | Field(default_factory=WorkflowStageFlagsResponse) | Nested stage flags: audio_transcription, ocr_transcription and translation. Distinguish the requested plan from stages still needed after settlement skips unstarted stages. |
needed | WorkflowStageFlagsResponse | False | Field(default_factory=WorkflowStageFlagsResponse) | Nested stage flags: audio_transcription, ocr_transcription and translation. Distinguish the requested plan from stages still needed after settlement skips unstarted stages. |
skipped | WorkflowStageFlagsResponse | False | Field(default_factory=WorkflowStageFlagsResponse) | Number of sources in this named lifecycle or preparation state; counts are not percentages. |
ProgressMeasurement
Source-derived contract. Keep required fields and guards when adapting the recipe; nullable values are distinct from missing required fields.
| Field | Type | Required | Declaration / default | Meaning |
|---|---|---|---|---|
completed | Annotated[int, Field(ge=0, le=2 ** 63 - 1)] | True | — | Measured units completed, from 0 through total. A measurement cannot exceed its total. |
total | Annotated[int, Field(gt=0, le=2 ** 63 - 1)] | True | — | Local progress phase and measured item/byte completion; callbacks are synchronous. |
unit | ProgressUnit | True | — | Measurement unit from ProgressUnit, bytes, items, chunks or milliseconds; use the declared enum values. |
ProgressMeasurementSnapshot
Source-derived contract. Keep required fields and guards when adapting the recipe; nullable values are distinct from missing required fields.
| Field | Type | Required | Declaration / default | Meaning |
|---|---|---|---|---|
completed | int | True | — | Measured units completed, from 0 through total. A measurement cannot exceed its total. |
total | int | True | — | Local progress phase and measured item/byte completion; callbacks are synchronous. |
unit | str | True | — | Measurement unit from ProgressUnit, bytes, items, chunks or milliseconds; use the declared enum values. |
percent | float | True | Field(ge=0, le=100) | Local progress phase and measured item/byte completion; callbacks are synchronous. |
ProgressPhase
Source-derived contract. Keep required fields and guards when adapting the recipe; nullable values are distinct from missing required fields.
{
"PREPARATION": "preparation",
"UPLOADING": "uploading",
"TRANSCRIPTION": "transcription",
"TRANSLATION": "translation"
}ProgressPhaseSnapshot
Source-derived contract. Keep required fields and guards when adapting the recipe; nullable values are distinct from missing required fields.
| Field | Type | Required | Declaration / default | Meaning |
|---|---|---|---|---|
status | ProgressStatus | False | ProgressStatus.PENDING | Status filter or new status, as appropriate to the method; archived projects retain saved results. |
current_step | ProgressStep | None | False | None | Nullable active phase or step. A terminal snapshot can have no active phase/step. |
measurement | ProgressMeasurementSnapshot | None | False | None | Nullable completed/total/unit measurement for actual work, with percent only in snapshots. |
active_work_units | int | False | Field(default=0, ge=0) | Number of work units currently active in this step, phase or snapshot. |
steps | dict[ProgressStep, ProgressStepSnapshot] | True | — | Nested per-phase or per-step records keyed by the corresponding enum value; inspect their status and measurements. |
ProgressSnapshotV4
Source-derived contract. Keep required fields and guards when adapting the recipe; nullable values are distinct from missing required fields.
| Field | Type | Required | Declaration / default | Meaning |
|---|---|---|---|---|
version | Literal[4] | False | PROGRESS_SCHEMA_VERSION | Progress schema version, currently 4; reject unsupported versions rather than guessing their structure. |
revision | int | False | Field(default=0, ge=0) | Increasing canonical progress revision; reconcile stale events with HTTP state. |
status | ProgressStatus | False | ProgressStatus.PENDING | Status filter or new status, as appropriate to the method; archived projects retain saved results. |
phase_plan | list[ProgressPhase] | True | — | Ordered phases in the admitted workflow; absent stages are not implied work. |
counts | WorkflowPhaseCounts | True | — | Nested workflow phase counts: total, resolved, completed, skipped and failed. |
current_phase | ProgressPhase | None | False | None | Nullable active phase or step. A terminal snapshot can have no active phase/step. |
current_step | ProgressStep | None | False | None | Nullable active phase or step. A terminal snapshot can have no active phase/step. |
measurement | ProgressMeasurementSnapshot | None | False | None | Nullable completed/total/unit measurement for actual work, with percent only in snapshots. |
active_work_units | int | False | Field(default=0, ge=0) | Number of work units currently active in this step, phase or snapshot. |
phases | dict[ProgressPhase, ProgressPhaseSnapshot] | True | — | Nested per-phase or per-step records keyed by the corresponding enum value; inspect their status and measurements. |
ProgressStatus
Source-derived contract. Keep required fields and guards when adapting the recipe; nullable values are distinct from missing required fields.
{
"PENDING": "pending",
"RUNNING": "running",
"COMPLETED": "completed",
"SKIPPED": "skipped",
"FAILED": "failed"
}ProgressStep
Source-derived contract. Keep required fields and guards when adapting the recipe; nullable values are distinct from missing required fields.
{
"EXTRACTING_STREAM": "extracting_stream",
"HASHING_SOURCE": "hashing_source",
"UPLOADING_SOURCE": "uploading_source",
"DOWNLOADING_SOURCE": "downloading_source",
"STARTING_RUNTIME": "starting_runtime",
"RESOLVING_MODEL": "resolving_model",
"LOADING_TOKENIZER": "loading_tokenizer",
"LOADING_MODEL": "loading_model",
"LOADING_INPUT": "loading_input",
"RUNNING_INFERENCE": "running_inference",
"ALIGNING_TIMESTAMPS": "aligning_timestamps",
"EXTRACTING_SUBTITLE_TRACK": "extracting_subtitle_track",
"RUNNING_OCR": "running_ocr",
"PARSING_OCR_OUTPUT": "parsing_ocr_output",
"FINALIZING_RESULT": "finalizing_result"
}ProgressStepSnapshot
Source-derived contract. Keep required fields and guards when adapting the recipe; nullable values are distinct from missing required fields.
| Field | Type | Required | Declaration / default | Meaning |
|---|---|---|---|---|
status | ProgressStatus | False | ProgressStatus.PENDING | Status filter or new status, as appropriate to the method; archived projects retain saved results. |
measurement | ProgressMeasurementSnapshot | None | False | None | Nullable completed/total/unit measurement for actual work, with percent only in snapshots. |
active_work_units | int | False | Field(default=0, ge=0) | Number of work units currently active in this step, phase or snapshot. |
started_at | datetime | None | False | None | Recorded server timestamp; a nullable value means the event has not occurred or is unavailable. |
ProgressUnit
Source-derived contract. Keep required fields and guards when adapting the recipe; nullable values are distinct from missing required fields.
{
"BYTES": "bytes",
"ITEMS": "items",
"CHUNKS": "chunks",
"MILLISECONDS": "milliseconds"
}ProgressUpdateV4
Source-derived contract. Keep required fields and guards when adapting the recipe; nullable values are distinct from missing required fields.
| Field | Type | Required | Declaration / default | Meaning |
|---|---|---|---|---|
version | Literal[4] | False | PROGRESS_SCHEMA_VERSION | Progress schema version, currently 4; reject unsupported versions rather than guessing their structure. |
phase | ProgressPhase | True | — | Local progress phase and measured item/byte completion; callbacks are synchronous. |
step | ProgressStep | True | — | Machine-readable execution step; use the enclosing flow/progress type and its enumerated values. |
status | ProgressStatus | True | — | Status filter or new status, as appropriate to the method; archived projects retain saved results. |
work_unit_id | Annotated[str, Field(min_length=1, max_length=255)] | True | — | Identity of this measured work unit; preserve it across increasing progress updates. |
sequence | Annotated[int, Field(ge=0, le=2 ** 63 - 1)] | True | — | Increasing update sequence within one work unit; stale updates must not replace newer state. |
measurement | ProgressMeasurement | None | False | None | Nullable completed/total/unit measurement for actual work, with percent only in snapshots. |
ProjectOperationCommitRequest
Source-derived contract. Keep required fields and guards when adapting the recipe; nullable values are distinct from missing required fields.
| Field | Type | Required | Declaration / default | Meaning |
|---|---|---|---|---|
media_ids | list[Annotated[str, Field(max_length=64)]] | True | Field(min_length=1, max_length=OPERATION_MEDIA_MAX_COUNT) | Backend-ready inventory records or selected project-media IDs; obtain IDs from current responses. |
target_language | str | True | Field(min_length=1, max_length=32) | Target language code for generated or translated subtitles. |
content_overrides | list[ProjectOperationContentOverride] | False | Field(default_factory=list, max_length=OPERATION_MEDIA_MAX_COUNT * 4) | Overrides keyed by stable source_ref: enable a source or explicitly override its source language. |
metrics | list[ProjectOperationMetricEntry] | False | Field(default_factory=list, max_length=OPERATION_MEDIA_MAX_COUNT * 4) | Only source metrics requested by the current plan; derive them locally. Audio duration is already in probed inventory. |
source_selections | list[AssetSelection] | True | Field(max_length=OPERATION_MEDIA_MAX_COUNT * 4) | Guarded selections from the estimated plan, plus canonical source_language; preserve snapshots and observations. |
ProjectOperationCommitResponse
Source-derived contract. Keep required fields and guards when adapting the recipe; nullable values are distinct from missing required fields.
| Field | Type | Required | Declaration / default | Meaning |
|---|---|---|---|---|
operation | dict[str, Any] | True | — | Plan/estimate/commit object or guarded source mapping. These dict[str, Any] payloads are open; the recipe validates its used fields. |
commit | dict[str, Any] | True | — | Plan/estimate/commit object or guarded source mapping. These dict[str, Any] payloads are open; the recipe validates its used fields. |
source_ref_map | dict[str, dict[str, str]] | True | — | Plan/estimate/commit object or guarded source mapping. These dict[str, Any] payloads are open; the recipe validates its used fields. |
ProjectOperationContentOverride
Source-derived contract. Keep required fields and guards when adapting the recipe; nullable values are distinct from missing required fields.
| Field | Type | Required | Declaration / default | Meaning |
|---|---|---|---|---|
source_ref | ProjectOperationSourceRef | True | — | Stable pair of project media ID and selected asset ID; runtime content IDs are different. |
enabled | bool | None | False | None | Source inclusion or explicit language override in the current plan. |
language_override | str | None | False | Field(default=None, max_length=32) | Source inclusion or explicit language override in the current plan. |
ProjectOperationMetricEntry
Source-derived contract. Keep required fields and guards when adapting the recipe; nullable values are distinct from missing required fields.
| Field | Type | Required | Declaration / default | Meaning |
|---|---|---|---|---|
source_ref | ProjectOperationSourceRef | True | — | Stable pair of project media ID and selected asset ID; runtime content IDs are different. |
duration_seconds | float | int | None | False | None | Measured duration in seconds, not a promised processing time. |
image_count | int | None | False | None | Measured visible characters or graphical images requested by the plan; never substitute guessed counts. |
ProjectOperationPlanContentResponse
Source-derived contract. Keep required fields and guards when adapting the recipe; nullable values are distinct from missing required fields.
| Field | Type | Required | Declaration / default | Meaning |
|---|---|---|---|---|
source_ref | ProjectOperationSourceRef | True | — | Stable pair of project media ID and selected asset ID; runtime content IDs are different. |
source_asset_id | str | None | True | — | Producing/result asset and immutable snapshot lineage; preserve these identities across export. |
enabled | bool | True | — | Source inclusion or explicit language override in the current plan. |
sparse_normal | bool | True | — | Suggests checking an automatic Normal text subtitle with sparse known cues for the media duration. |
language | str | True | — | Subtitle language or normal/Forced/SDH/Commentary classification; technical language codes remain unchanged. |
language_mode | str | None | True | — | Source-language evidence used by the planner; language codes remain canonical. |
language_source | str | None | True | — | Source-language evidence used by the planner; language codes remain canonical. |
language_declared | str | None | True | — | Source-language evidence used by the planner; language codes remain canonical. |
language_declared_source | str | None | True | — | Source-language evidence used by the planner; language codes remain canonical. |
language_guess | str | None | True | — | Source-language evidence used by the planner; language codes remain canonical. |
language_guess_source | str | None | True | — | Source-language evidence used by the planner; language codes remain canonical. |
language_override | str | None | True | — | Source inclusion or explicit language override in the current plan. |
language_guess_status | str | None | True | — | Readiness of source-language detection before committing. |
language_guess_confidence | float | None | True | — | Confidence of the source-language guess. |
language_profile | dict[str, Any] | None | True | — | Source-language profile supplied with the language evidence. |
type | str | None | True | — | Source category text, audio or graphical; it determines the requested metrics and stages. |
stream_type | str | None | True | — | Actual stream codec or subtitle classification, independently of import recognition. |
stream_class | str | None | True | — | Normal, or any combination of Commentary, Forced and SDH. |
codec_type | str | None | True | — | Actual stream codec or subtitle classification, independently of import recognition. |
codec_name | str | None | True | — | Actual stream codec or subtitle classification, independently of import recognition. |
filename | str | None | True | — | Prepared filename, including its real extension, used to select storage format. |
input_snapshot_id | str | None | True | — | Producing/result asset and immutable snapshot lineage; preserve these identities across export. |
stream_index | int | None | True | — | FFprobe stream index or explicit indexes to replace, not the order in a filtered list. |
asset_input | dict[str, Any] | None | True | — | Server-issued input contract; preserve its selection guards and asset identity. |
workflow_kind | str | True | — | Selected stage workflow and its planning explanation; null when no workflow is selected. |
workflow_reason | str | True | — | Selected stage workflow and its planning explanation; null when no workflow is selected. |
needs_audio_transcription | bool | True | — | Whether this source requires the named processing stage. |
needs_ocr_transcription | bool | True | — | Whether this source requires the named processing stage. |
needs_translation | bool | True | — | Whether this source requires the named processing stage. |
translation_decision | str | True | — | Whether the plan requires translation or skips it. |
audio_transcription_engine | str | None | True | — | Server-selected processing route, model or selection evidence for this stage. |
audio_transcription_app | str | None | True | — | Server-selected processing route, model or selection evidence for this stage. |
audio_transcription_model | str | None | True | — | Server-selected processing route, model or selection evidence for this stage. |
audio_transcription_model_mode | str | None | True | — | Server-selected processing route, model or selection evidence for this stage. |
audio_transcription_route_reason | str | None | True | — | Server-selected processing route, model or selection evidence for this stage. |
audio_transcription_route_rule | str | None | True | — | Server-selected processing route, model or selection evidence for this stage. |
ocr_engine | str | None | True | — | Server-selected processing route, model or selection evidence for this stage. |
ocr_model | str | None | True | — | Server-selected processing route, model or selection evidence for this stage. |
translation_provider | str | None | True | — | Server-selected processing route, model or selection evidence for this stage. |
translation_model | str | None | True | — | Server-selected processing route, model or selection evidence for this stage. |
translation_model_mode | str | None | True | — | Server-selected processing route, model or selection evidence for this stage. |
translation_route_reason | str | None | True | — | Server-selected processing route, model or selection evidence for this stage. |
translation_route_rule | str | None | True | — | Server-selected processing route, model or selection evidence for this stage. |
estimated_character_count | int | None | True | — | Estimated source workload measured for the selected source. |
estimated_cue_count | int | None | True | — | Estimated number of visible subtitle cues in the selected snapshot. |
estimated_image_count | int | None | True | — | Estimated source workload measured for the selected source. |
estimated_duration_seconds | int | None | True | — | Estimated source workload measured for the selected source. |
estimated_credits | int | None | True | — | Estimated credits reserved for this source or named processing stage. |
estimated_audio_transcription_credits | int | None | True | — | Estimated credits reserved for this source or named processing stage. |
estimated_ocr_transcription_credits | int | None | True | — | Estimated credits reserved for this source or named processing stage. |
estimated_translation_credits | int | None | True | — | Estimated credits reserved for this source or named processing stage. |
ProjectOperationPlanSlotResponse
Source-derived contract. Keep required fields and guards when adapting the recipe; nullable values are distinct from missing required fields.
| Field | Type | Required | Declaration / default | Meaning |
|---|---|---|---|---|
slot | str | True | — | Result classification: normal, forced, sdh, commentary or a combination. |
source_asset_id | str | True | — | Recommended source asset for this result slot, computed before user overrides. |
available | bool | True | — | Whether reliable text already exists in the target language for this slot. |
ProjectOperationPlanMediaResponse
Source-derived contract. Keep required fields and guards when adapting the recipe; nullable values are distinct from missing required fields.
| Field | Type | Required | Declaration / default | Meaning |
|---|---|---|---|---|
project_media_id | str | True | — | Operation/project media relationship and the recorded relative media path. |
path | str | True | — | Local root, path or POSIX relative path. Scan helpers exclude symlinks; keep paths inside the chosen root. |
probe_data | dict[str, Any] | None | True | — | Actual FFprobe container/stream evidence; opaque dictionaries retain the probe’s fields. |
contents | list[ProjectOperationPlanContentResponse] | True | — | Nested source items or per-source estimate rows, according to the enclosing record. |
slots | list[ProjectOperationPlanSlotResponse] | True | — | Result slots with a candidate source, their recommendation and availability. |
ProjectOperationPlanPayload
Source-derived contract. Keep required fields and guards when adapting the recipe; nullable values are distinct from missing required fields.
| Field | Type | Required | Declaration / default | Meaning |
|---|---|---|---|---|
target_language | str | True | — | Target language code for generated or translated subtitles. |
media | list[ProjectOperationPlanMediaResponse] | True | — | Inventory record of the item's file, as for replace_project_media; omit it for a subtitle item. |
ProjectOperationPlanEstimateRequest
Source-derived contract. Keep required fields and guards when adapting the recipe; nullable values are distinct from missing required fields.
| Field | Type | Required | Declaration / default | Meaning |
|---|---|---|---|---|
media_ids | list[Annotated[str, Field(max_length=64)]] | True | Field(min_length=1, max_length=OPERATION_MEDIA_MAX_COUNT) | Backend-ready inventory records or selected project-media IDs; obtain IDs from current responses. |
target_language | str | True | Field(min_length=1, max_length=32) | Target language code for generated or translated subtitles. |
content_overrides | list[ProjectOperationContentOverride] | False | Field(default_factory=list, max_length=OPERATION_MEDIA_MAX_COUNT * 4) | Overrides keyed by stable source_ref: enable a source or explicitly override its source language. |
metrics | list[ProjectOperationMetricEntry] | False | Field(default_factory=list, max_length=OPERATION_MEDIA_MAX_COUNT * 4) | Only source metrics requested by the current plan; derive them locally. Audio duration is already in probed inventory. |
ProjectOperationPlanEstimateResponse
Source-derived contract. Keep required fields and guards when adapting the recipe; nullable values are distinct from missing required fields.
| Field | Type | Required | Declaration / default | Meaning |
|---|---|---|---|---|
plan | ProjectOperationPlanPayload | True | — | Non-persisted plan with source references and projected work; durable operation IDs are created at commit. |
estimate | dict[str, Any] | True | — | Plan/estimate/commit object or guarded source mapping. These dict[str, Any] payloads are open; the recipe validates its used fields. |
ProjectOperationPlanRequest
Source-derived contract. Keep required fields and guards when adapting the recipe; nullable values are distinct from missing required fields.
| Field | Type | Required | Declaration / default | Meaning |
|---|---|---|---|---|
media_ids | list[Annotated[str, Field(max_length=64)]] | True | Field(min_length=1, max_length=OPERATION_MEDIA_MAX_COUNT) | Backend-ready inventory records or selected project-media IDs; obtain IDs from current responses. |
target_language | str | True | Field(min_length=1, max_length=32) | Target language code for generated or translated subtitles. |
content_overrides | list[ProjectOperationContentOverride] | False | Field(default_factory=list, max_length=OPERATION_MEDIA_MAX_COUNT * 4) | Overrides keyed by stable source_ref: enable a source or explicitly override its source language. |
ProjectOperationPlanResponse
Source-derived contract. Keep required fields and guards when adapting the recipe; nullable values are distinct from missing required fields.
| Field | Type | Required | Declaration / default | Meaning |
|---|---|---|---|---|
plan | ProjectOperationPlanPayload | True | — | Non-persisted plan with source references and projected work; durable operation IDs are created at commit. |
ProjectOperationResultListResponse
Source-derived contract. Keep required fields and guards when adapting the recipe; nullable values are distinct from missing required fields.
| Field | Type | Required | Declaration / default | Meaning |
|---|---|---|---|---|
results | list[ProjectOperationResultResponse] | False | Field(default_factory=list) | Successful immutable stage records, including stages retained after another stage fails. |
total | int | False | 0 | Local progress phase and measured item/byte completion; callbacks are synchronous. |
ProjectOperationResultResponse
Source-derived contract. Keep required fields and guards when adapting the recipe; nullable values are distinct from missing required fields.
Each row is a successful immutable stage, including intermediate transcription/ocr and final translation. A partially failed operation can still have these rows. Export the chosen artifact_id; editing requires a separate editable asset copy.
| Field | Type | Required | Declaration / default | Meaning |
|---|---|---|---|---|
artifact_id | str | True | — | ID of an immutable successful operation stage returned by the result list. |
stage | Literal['transcription', 'ocr', 'translation'] | True | — | Producing transcription, OCR or translation stage. |
result_asset_id | str | True | — | Producing/result asset and immutable snapshot lineage; preserve these identities across export. |
snapshot_id | str | True | — | Producing/result asset and immutable snapshot lineage; preserve these identities across export. |
generating_artifact_id | str | True | — | Producing/result asset and immutable snapshot lineage; preserve these identities across export. |
source_asset_id | str | True | — | Producing/result asset and immutable snapshot lineage; preserve these identities across export. |
source_asset_number | int | None | False | None | The source's number within its media item; exports add it to names that would otherwise clash (clip.en.3.srt). |
source_language | str | True | — | Canonical source language captured with the guarded selection. |
target_language | str | None | False | None | Target language code for generated or translated subtitles. |
input_snapshot_id | str | None | False | None | Producing/result asset and immutable snapshot lineage; preserve these identities across export. |
content_id | str | True | — | One source item inside an operation, not a project-media or artifact ID. |
operation_media_id | str | True | — | Operation/project media relationship and the recorded relative media path. |
project_media_id | str | None | False | None | Operation/project media relationship and the recorded relative media path. |
media_path | str | True | — | Operation/project media relationship and the recorded relative media path. |
media_name_number | int | None | False | None | Number that tells same-named items of a file project apart (shown as clip.mp4 · 2); None for the oldest entry or a unique name. |
export_stem | str | True | — | Export file name without format (S01/clip.en), before clashes within one destination are numbered. |
language | str | None | False | None | Subtitle language or normal/Forced/SDH/Commentary classification; technical language codes remain unchanged. |
stream_index | int | None | False | None | FFprobe stream index or explicit indexes to replace, not the order in a filtered list. |
stream_type | str | None | False | None | Actual stream codec or subtitle classification, independently of import recognition. |
stream_class | str | None | False | None | Normal, or any combination of Commentary, Forced and SDH. |
codec_name | str | None | False | None | Actual stream codec or subtitle classification, independently of import recognition. |
result_created_at | str | True | — | Saved result creation time or number of subtitle cues. |
cue_count | int | False | 0 | Saved result creation time or number of subtitle cues. |
ProjectOperationSourceRef
Source-derived contract. Keep required fields and guards when adapting the recipe; nullable values are distinct from missing required fields.
| Field | Type | Required | Declaration / default | Meaning |
|---|---|---|---|---|
media_id | str | True | Field(min_length=1, max_length=64) | Media ID in this route: a project-media ID for project routes, an operation-media ID for upload/preparation routes. |
asset_id | str | True | Field(min_length=1, max_length=64) | ID of the selected subtitle/audio asset owned by its media. |
SourceObservation
Source-derived contract. Keep required fields and guards when adapting the recipe; nullable values are distinct from missing required fields.
| Field | Type | Required | Declaration / default | Meaning |
|---|---|---|---|---|
files | tuple[FileObservation, ...] | True | Field(min_length=1, max_length=2) | Complete directory snapshot, file list or observation evidence required by this endpoint; build it from local files. |
stream_index | StrictInt | None | False | None | FFprobe stream index or explicit indexes to replace, not the order in a filtered list. |
stream_descriptor | dict[Annotated[str, Field(max_length=128)], JsonValue] | False | Field(default_factory=dict, max_length=128) | Physical-file role, observed fingerprint or stream descriptor used for guarded checks. |
SourceRef
Source-derived contract. Keep required fields and guards when adapting the recipe; nullable values are distinct from missing required fields.
| Field | Type | Required | Declaration / default | Meaning |
|---|---|---|---|---|
media_id | str | True | — | Media ID in this route: a project-media ID for project routes, an operation-media ID for upload/preparation routes. |
asset_id | str | True | — | ID of the selected subtitle/audio asset owned by its media. |
UploadTarget
Source-derived contract. Keep required fields and guards when adapting the recipe; nullable values are distinct from missing required fields.
Normalized target record: expires_at is a datetime here and an ISO timestamp in HTTP JSON. The response additionally carries upload_id and operation/media/content identity plus nullable sidecar with the same target shape. headers is an opaque string mapping, not an API-token destination. Preserve the issued method and headers, renew expired targets, and complete only the matching attempt/upload/hash.
| Field | Type | Required | Declaration / default | Meaning |
|---|---|---|---|---|
upload_url | str | True | — | URL from the API; relative URLs resolve against the gateway. Upload URLs receive no SubFT token. |
method | str | True | — | HTTP method; preserve the backend-issued method for direct upload. |
headers | Mapping[str, str] | True | — | HTTP headers. Pass the upload target headers unchanged; ordinary request headers override constructor headers. |
expires_at | datetime | True | — | Expiry of the signed target; renew it before attempting an expired upload. |
WorkflowPhaseCounts
Source-derived contract. Keep required fields and guards when adapting the recipe; nullable values are distinct from missing required fields.
| Field | Type | Required | Declaration / default | Meaning |
|---|---|---|---|---|
total_phases | int | False | Field(default=0, ge=0) | Number of workflow phases with this outcome. Resolved includes completed, skipped and failed phases. |
resolved_phases | int | False | Field(default=0, ge=0) | Number of workflow phases with this outcome. Resolved includes completed, skipped and failed phases. |
completed_phases | int | False | Field(default=0, ge=0) | Number of workflow phases with this outcome. Resolved includes completed, skipped and failed phases. |
skipped_phases | int | False | Field(default=0, ge=0) | Number of workflow phases with this outcome. Resolved includes completed, skipped and failed phases. |
failed_phases | int | False | Field(default=0, ge=0) | Number of workflow phases with this outcome. Resolved includes completed, skipped and failed phases. |
WorkflowStageFlagsResponse
Source-derived contract. Keep required fields and guards when adapting the recipe; nullable values are distinct from missing required fields.
| Field | Type | Required | Declaration / default | Meaning |
|---|---|---|---|---|
audio_transcription | bool | False | False | Per-stage flags or counts. requested describes planned work; needed describes work remaining after settlement skips unstarted stages, according to the nested field type. |
ocr_transcription | bool | False | False | Per-stage flags or counts. requested describes planned work; needed describes work remaining after settlement skips unstarted stages, according to the nested field type. |
translation | bool | False | False | Per-stage flags or counts. requested describes planned work; needed describes work remaining after settlement skips unstarted stages, according to the nested field type. |