Skip to content

feat(cli): tag HeyGen API calls with X-HeyGen-Client-Source#2368

Merged
miguel-heygen merged 1 commit into
mainfrom
cli-client-source
Jul 13, 2026
Merged

feat(cli): tag HeyGen API calls with X-HeyGen-Client-Source#2368
miguel-heygen merged 1 commit into
mainfrom
cli-client-source

Conversation

@miguel-heygen

Copy link
Copy Markdown
Collaborator

What

The hyperframes CLI now sends X-HeyGen-Client-Source: hyperframes on every HeyGen API request, from the single buildAuthHeaders() 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

  • New HEYGEN_CLIENT_SOURCE_HEADER / HEYGEN_CLIENT_SOURCE = "hyperframes" constants.
  • Added to both branches of buildAuthHeaders() — this is the single point all core CLI + cloud HeyGen calls route through, so one edit covers them.
  • Unconditional of auth type (an API-key CLI call is still hyperframes usage). The OAuth-only X-HeyGen-Source: cli free-gate header is unchanged.
  • Note: hyperframes (a tool) goes in client_source, not client_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: both buildAuthHeaders branches now assert X-HeyGen-Client-Source: hyperframes. vitest run src/auth/client.test.ts → 17/17 pass.
  • oxlint + oxfmt + fallow + typecheck clean (pre-commit).

Pairs with

Backend persistence in heygen-com/experiment-framework#41968 — its _KNOWN_CLIENT_SOURCES allowlist already includes hyperframes, so no additional backend change is needed for this PR.

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
miguel-heygen merged commit 746b6d5 into main Jul 13, 2026
42 checks passed
@miguel-heygen
miguel-heygen deleted the cli-client-source branch July 13, 2026 23:02
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).
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.

1 participant