# OMNI media API

This service implements the exact job contract consumed by
`orchestrator/media.py`:

- `POST /v1/jobs` with `Idempotency-Key` and `X-Model-Lease`
- `GET /v1/jobs/{job_id}`
- `GET /v1/jobs/{job_id}/events` with `Last-Event-ID` replay
- `POST /v1/jobs/{job_id}/cancel`

It accepts only a live capability-matching lease from `omni_manager`. H3 and
Hunyuan endpoints must be configured explicitly and must implement the same
bounded downstream job/SSE contract. The service never downloads or launches a
model, follows no redirect, and defaults to loopback. Compose endpoints are
limited to single-label container hosts/private addresses and no service port
is published to the host.

`OMNI_MEDIA_AUTO_START=1` is rejected rather than silently doing something
different. Optional model lifecycle hooks belong to `omni_manager`, where their
complete target URLs are fixed by the operator and launch remains disabled by
default.

Only validated artifact references leave the gateway. Data URLs, base64
payloads, unbounded event streams, oversized responses, and malformed terminal
events fail the job. A lock-protected terminal transition guarantees exactly
one of `job.completed`, `job.failed`, or `job.cancelled`.
