Skip to content

feat (provider/gateway): add SSE support for video generation with heartbeat keep-alive#12729

Merged
shaper merged 3 commits intomainfrom
feat_provider/gateway_add_SSE_support_for_video_generation_with_heartbeat_keep-alive
Feb 20, 2026
Merged

feat (provider/gateway): add SSE support for video generation with heartbeat keep-alive#12729
shaper merged 3 commits intomainfrom
feat_provider/gateway_add_SSE_support_for_video_generation_with_heartbeat_keep-alive

Conversation

@shaper
Copy link
Copy Markdown
Collaborator

@shaper shaper commented Feb 20, 2026

Background

Video generation requests can take a long time to complete, and HTTP connections may timeout during processing. Server-Sent Events (SSE) with heartbeat keep-alive messages provide a way to maintain the connection while the video is being generated.

Changes

Added SSE support for video generation in the gateway provider with heartbeat keep-alive functionality. The implementation:

  • Sets accept: 'text/event-stream' header in video generation requests
  • Parses SSE events using parseJsonEventStream with a discriminated union schema for result and error events
  • Properly handles SSE error events by throwing APICallError with structured error data

Manual Verification

Ran example video scripts against a gateway server supporting SSE format response.

Checklist

  • Tests have been added / updated (for bug fixes / features)
  • Documentation has been added / updated (for bug fixes / features)
  • A patch changeset for relevant packages has been added (for bug fixes / features - run pnpm changeset in the project root)
  • I have reviewed this pull request (self-review)

Future Work

Related Issues

Copy link
Copy Markdown
Collaborator Author

shaper commented Feb 20, 2026

This stack of pull requests is managed by Graphite. Learn more about stacking.

@tigent tigent bot added ai/gateway feature New feature or request provider/gateway Issues related to the @ai-sdk/gateway provider labels Feb 20, 2026
@shaper shaper force-pushed the feat_provider/gateway_add_SSE_support_for_video_generation_with_heartbeat_keep-alive branch from 100ca98 to d2e2dbf Compare February 20, 2026 04:17
@shaper shaper requested a review from R-Taneja February 20, 2026 05:37
@shaper shaper marked this pull request as ready for review February 20, 2026 05:37
@shaper shaper requested a review from mclenhard February 20, 2026 05:38
Copy link
Copy Markdown
Collaborator

@gr2m gr2m left a comment

Choose a reason for hiding this comment

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

elegant 👍🏼

@shaper shaper merged commit 73b7e09 into main Feb 20, 2026
21 checks passed
@shaper shaper deleted the feat_provider/gateway_add_SSE_support_for_video_generation_with_heartbeat_keep-alive branch February 20, 2026 16:38
@gr2m gr2m added ai/provider related to a provider package. Must be assigned together with at least one `provider/*` label and removed ai/gateway labels Mar 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai/provider related to a provider package. Must be assigned together with at least one `provider/*` label feature New feature or request provider/gateway Issues related to the @ai-sdk/gateway provider

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants