Repository navigation
cmd: default video create to Avatar 6 Turbo - #595
Conversation
video create now asks for the heygen-avatar-6-turbo engine when an avatar or image body names none. A body that names an engine, sets expressiveness, or asks for a resolution other than 1080p is sent as written. If the API does not accept the request with the default engine, the CLI sends it once more as written, so the API's own default applies. Batches are unchanged. Co-Authored-By: Claude Fable 5.2 <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
miguel-heygen
left a comment
There was a problem hiding this comment.
The behaviour is right. One thing has to change before this ships: heygen video create --help still names the old default.
Checked at f9e892e, ran on Linux with Go 1.26.11
- A named engine is never replaced.
takesDefaultEnginereturns false onceengineis in the body, and the "engine named" cases inTestVideoCreateDefaultEngineandTestVideoCreateNoSecondAttemptpin it. When I removed that check, both tests failed. - Only
type: avatarandtype: imageget the default. The studio case pins this. When I made every type take the default,TestVideoCreateDefaultEnginefailed. - The second attempt happens only on the create call. It fires only on 400/402/403/404 and sends the body exactly as written.
video batches createitems are left alone. go test ./cmd/heygen/ ./internal/client/passes at this head.
Blocking: the help text is wrong
--help prints the generated description at gen/video.go:120: "Choose Avatar III, IV or V with engine (Avatar IV by default)". With this PR, a CLI user who names no engine gets heygen-avatar-6-turbo, so the help now names the wrong default. Only SKILL.md describes the new behaviour. gen/ is generated from the API spec, and for the API itself the spec is still correct. So the fix belongs in the CLI, next to applyDefaultEngine.
- Add a line to the
video createcommand'sLong, the wayauth.go:61builds its ownLong. Say what the default is, when it does not apply (a named engine,expressiveness, or a resolution other than 1080p), and that the CLI resends without it if the API refuses. - Add a test that checks
--helpfor that line.
Nit
The resend warning (FallbackNotice) is written to c.warn, which is os.Stderr (client.go:163). The tests read result.Stderr, so they never see it, and nothing would catch the warning disappearing. Routing warn through the command's error writer, or checking the warning in one client test, would cover it.
The generated description names the API default. Add a paragraph to the command help for the CLI default, when it is not applied, and the resend. Send client warnings to the command's error writer so they follow it. Co-Authored-By: Claude Fable 5.2 <[email protected]>
miguel-heygen
left a comment
There was a problem hiding this comment.
Re-review at 40d84a1. The blocker from my earlier review is fixed, and so is the nit.
Help text (blocking before): fixed. The real heygen video create --help output now has a line below the API's own description. It says that when the request names no engine, the CLI sends heygen-avatar-6-turbo. It says the default is skipped when the request sets engine, expressiveness, or a resolution other than 1080p. It also says the CLI resends the request as written if the API refuses. That matches takesDefaultEngine and executeWithFallback. Only video create gets the line.
TestVideoCreateHelpStatesDefaultEnginechecks it, and also checks thatvideo list --helpdoes not carry it.- When I dropped
defaultEngineHelpfrombuilder.go, that test failed.
Resend warning (nit before): fixed. The client now writes warnings to the command's error writer (WithWarnOutput(cmd.ErrOrStderr())). The refused-default test now checks the exact warning.
- When I removed that option, the test failed.
Checked again at this head: a named engine is never replaced, and only avatar and image bodies get the default. go test -count=3 ./cmd/heygen/ ./internal/client/ passes three times in a row on Linux with Go 1.26.11.
Description
heygen video createnow rendersavatarandimagevideos on Avatar 6 Turbo when the body names noengine. The API default is unchanged; the CLI sets the engine on the request, the same way the hosted MCP server already does.engine, noexpressiveness, andresolutionomitted or1080p. Anything else is sent as written."engine":{"type":"avatar_iv"}.heygen video batches createis unchanged. Batch items are created after the call returns, so there is no refusal to fall back from.Omitting
resolutionnow gives 1080p (Avatar 6 Turbo's default) where it gave 720p before, for callers whose plan allows it.The second attempt lives in the executor (
Invocation.FallbackBody) so it wraps only the create call on both the plain and--waitpaths, never a status poll.gen/is untouched.Testing
make testandgolangci-lint run ./...(v2.11.4) pass.cmd/heygen/default_engine_test.go: which bodies get the default, the resend as written on 400/402/403/404, both attempts refused, no resend on 401/5xx or when the caller named the engine, batches sent as written."resolution":"720p"was sent as written and returned 720p.resolution_not_allowed), the same body without it is accepted at 720p, including under oneIdempotency-Key.Authored by Rames (api-platform).
🤖 Generated with Claude Code