No More API Tokens: Stream Bindings Land in Workers!
Hey there, it's Shiichan! Today I've got great news for everyone who works with video.
Cloudflare ChangelogWhat was announced?
From the Cloudflare Changelog: new Stream bindings for Workers have arrived! With these, you can interact with your Stream video library directly from a Worker, no authenticated API calls needed. Uploading videos, provisioning direct uploads, managing videos, and generating signed URLs are all covered.
The story so far
Until now, driving Stream from Workers meant setting up an API token and calling the authenticated REST API. Managing tokens and hand-assembling HTTP requests was quietly tedious. With the binding, you just call it from env.STREAM, and that hassle disappears.
What changes
Here are the highlights:
- Upload videos from URLs, or create basic direct upload links for end users
- Generate signed playback tokens without managing signing keys
- Manage video metadata, captions, downloads, and watermarks
- Build video pipelines entirely within a Worker
It also plays nicely with generative AI and inference workloads, bringing Stream and Workers much closer together.
Dive Deep
First, add the binding to your Wrangler configuration.
{
"stream": {
"binding": "STREAM"
}
}
Then just call it from your Worker. To upload by passing a URL, it looks like this.
const streamVideo = await env.STREAM.upload(videoUrl);
The original post even shows passing a video URL generated by google/veo-3.1 straight into upload(), so AI generation to Stream ingestion all connects inside a single Worker, which is pretty cool.
Signed tokens come from env.STREAM.video(video_id).generateToken(), and I love that you never touch the signing key. You can read video properties with .details() and change them with .update().
For setup steps and the full API reference, check Bind to Workers API, and the Stream docs are worth a look too.
Wrap-up
- Stream bindings let you touch Stream directly from Workers
- Upload, manage, and generate signed URLs without API tokens or authenticated HTTP requests
- Methods like
env.STREAM.upload(),video().generateToken(),details(), andupdate()are available - Not having to manage signing keys is a quietly nice win
This one is perfect for anyone who wants to build video pipelines on Workers, or pipe generative AI output into Stream!