feat: dubbing support in the SDK and CLI (+ free-trial awareness) - #16
Merged
Conversation
…lpers Follows the SoundResult pattern of calling _download_to/_adownload_to instead of re-inlining the httpx request and status check.
Sapient docs evalsWaiting for the staging docs URL before running evals. Sapient will start the selected PR evals automatically when GitHub reports a successful docs deployment for this PR. This usually happens within 15 minutes. Commit: |
- README: pass an explicit timeout=3600 in the dubbing sample and explain that the SDK's 600s default wait is far shorter than the dubbing pipeline can take, and that a client-side timeout does not cancel or refund the task. - sonilo-cli README: document the dubbing --timeout default and that a timed-out wait is resumable with `sonilo tasks wait <task-id>`. - sonilo-cli tests: cover the omitted --languages path (no `languages` field sent) and assert the stderr text of the non-https exit-1 case. - tests/test_dubbing.py: move a stray mid-file import to the header.
…does Add TrialExhaustedError (a PaymentRequiredError subclass) for the 402 whose body carries code: "trial_exhausted", so callers can tell "you have never paid us" apart from a funded wallet that ran dry without matching on message text. Type account.services() as AccountServices/TrialQuota TypedDicts — the trial quota was reachable at runtime but invisible to type checkers and undocumented — and document the three 402 codes. sonilo account now prints a one-line trial summary on stderr (stdout stays pure JSON), and the CLI's error handler no longer drops the API's error code. Bumps sonilo to 0.7.0 and sonilo-cli to 0.3.0.
The dubbing backend polls its pipeline for up to 7200s. Giving up at 3600s still abandons jobs that are running fine, leaving a caller charged for videos they never receive. Match the backend exactly so the client gives up only once the backend has.
sonilo-video-kit pinned sonilo<0.6, so every editable install of the workspace broke the moment sonilo went to 0.6.0 — CI could not even reach the test step. Widening to <1.0 matches what the JS video-kit already does (>=0.5.1 <1.0.0) and stops this recurring on the next minor bump. Bumped to 0.1.3 so the published package carries the working range too.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Exposes the newly-shipped
POST /v1/dubbingendpoint. Note this branch also carries a second, unrelated feature — see part 2.1. Dubbing
client.dubbing.submit()/.generate()on bothSoniloandAsyncSonilo.DubbingResultdataclass: results arrive asoutputs, a map of language code to dubbed.mp4URL. This envelope is unlike every other endpoint's, so it does not reuseSoundResult.save(language, path)fetches one;save_all(directory)fetches every one, plusasave/asave_all.video_urlis checked forhttps://locally — the dubbing pipeline fetches the source itself and rejects plain http with a 422.sonilo dubbingCLI command. Because a dubbing task returns one video per language,--outputis a filename template:--output clip.mp4writesclip.es.mp4andclip.fr.mp4— the same transform--stemalready uses.--timeoutdefaults to 7200 seconds, matching the backend's own ceiling — it polls its pipeline for up to 7200s, so any shorter client-side wait abandons jobs that are still succeeding and leaves the caller charged for videos they never receive.context7.json: dubbing has zero free runs (it billsduration × languages), so the previous "free runs on every endpoint" / "1 each for the video endpoints" wording told users the most expensive endpoint in the product was free to try.Bumps
soniloto 0.6.0 andsonilo-clito 0.2.0.2. Free-trial awareness
One commit from concurrent work that landed on this branch: surfacing the free trial before it runs out, and naming it when it does.
Test plan
python -m pytest tests -q(192 passed) andpython -m pytest sonilo-cli/tests -q(39 passed), run separately — running both directories in one invocation hits a pre-existing test-package name collision that predates this branch.Dubbing coverage: form encoding, the https guard, the exactly-one-input guard, unknown-code pass-through, the parser, the save helpers, sync + async
generate()polling, the--outputtemplate transform,--languagesparsing, and one-file-per-language writing.