feat(cli): tag HeyGen API calls with X-HeyGen-Client-Source#2368
Merged
Conversation
Send `X-HeyGen-Client-Source: hyperframes` from buildAuthHeaders on every HeyGen API call (both OAuth and API-key), so backend billing meta can isolate hyperframes CLI usage. The single buildAuthHeaders chokepoint covers the core CLI + cloud client. Mirrors the media-use tagging; the OAuth-only X-HeyGen-Source cli free-gate header is unchanged.
miguel-heygen
added a commit
that referenced
this pull request
Jul 14, 2026
…Source (#2391) The agent-driven video recipes (heygen video create) went out untagged, so media-use avatar / image-to-video usage landed as generic cli traffic and wasn't attributable to media-use. Add --headers "X-HeyGen-Client-Source: media-use" to the generating recipes (persistent flag, allowlisted by the CLI) so those videos carry client_source in master_video_table meta and show up in the API dashboards alongside the TTS path (#2365) and CLI (#2368).
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.
What
The hyperframes CLI now sends
X-HeyGen-Client-Source: hyperframeson every HeyGen API request, from the singlebuildAuthHeaders()chokepoint (both OAuth and API-key auth).Why
The CLI's HeyGen traffic is currently indistinguishable from any other first-party client, so CLI usage can't be attributed. This is the CLI analog of the media-use tagging in #2365 — it declares the CLI as the request origin so the backend can isolate hyperframes CLI usage in billing meta.
How
HEYGEN_CLIENT_SOURCE_HEADER/HEYGEN_CLIENT_SOURCE = "hyperframes"constants.buildAuthHeaders()— this is the single point all core CLI + cloud HeyGen calls route through, so one edit covers them.X-HeyGen-Source: clifree-gate header is unchanged.hyperframes(a tool) goes inclient_source, notclient_origin— that field is reserved for the driving agent (claude_code/codex/…) and its allowlist would drop a non-agent value.Test plan
client.test.ts: bothbuildAuthHeadersbranches now assertX-HeyGen-Client-Source: hyperframes.vitest run src/auth/client.test.ts→ 17/17 pass.Pairs with
Backend persistence in heygen-com/experiment-framework#41968 — its
_KNOWN_CLIENT_SOURCESallowlist already includeshyperframes, so no additional backend change is needed for this PR.