Skip to content

cmd: default video create to Avatar 6 Turbo - #595

Merged
jrusso1020 merged 3 commits into
mainfrom
11-24-video_create_default_engine
Nov 24, 2026
Merged

jrusso1020 merged 3 commits into
mainfrom
11-24-video_create_default_engine

Conversation

@jrusso1020

Copy link
Copy Markdown
Collaborator

Description

heygen video create now renders avatar and image videos on Avatar 6 Turbo when the body names no engine. The API default is unchanged; the CLI sets the engine on the request, the same way the hosted MCP server already does.

  • The default applies only when the body leaves the choice open: no engine, no expressiveness, and resolution omitted or 1080p. Anything else is sent as written.
  • If the API does not accept the request on Avatar 6 Turbo (for example a plan without 1080p, or an avatar that engine cannot render), the CLI sends the body once more exactly as written, so the caller gets what they get today. A refused request creates nothing, so there is no duplicate. If both attempts are refused, the caller sees the answer to the body they wrote.
  • To pin an engine, set it: "engine":{"type":"avatar_iv"}.
  • heygen video batches create is unchanged. Batch items are created after the call returns, so there is no refusal to fall back from.

Omitting resolution now 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 --wait paths, never a status poll. gen/ is untouched.

Testing

  • make test and golangci-lint run ./... (v2.11.4) pass.
  • New tests in 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.
  • Built binary against the dev API with an API key: a body with no engine for an Avatar 6 only avatar returned a video at 1080p (the same body is refused without this change); a body with "resolution":"720p" was sent as written and returned 720p.
  • The two requests the resend makes were also checked directly against the dev API as a Free plan sign-in: the request with the engine is refused (resolution_not_allowed), the same body without it is accepted at 720p, including under one Idempotency-Key.

Authored by Rames (api-platform).

🤖 Generated with Claude Code

jrusso1020 and others added 2 commits November 24, 2026 05:24
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]>

@miguel-heygen miguel-heygen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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. takesDefaultEngine returns false once engine is in the body, and the "engine named" cases in TestVideoCreateDefaultEngine and TestVideoCreateNoSecondAttempt pin it. When I removed that check, both tests failed.
  • Only type: avatar and type: image get the default. The studio case pins this. When I made every type take the default, TestVideoCreateDefaultEngine failed.
  • 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 create items 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 create command's Long, the way auth.go:61 builds its own Long. 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 --help for 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 miguel-heygen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

  • TestVideoCreateHelpStatesDefaultEngine checks it, and also checks that video list --help does not carry it.
  • When I dropped defaultEngineHelp from builder.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.

@jrusso1020
jrusso1020 merged commit 79a79de into main Nov 24, 2026
11 checks passed
@jrusso1020
jrusso1020 deleted the 11-24-video_create_default_engine branch November 24, 2026 06:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants