OpenAICloudflare Developer PlatformMay 7, 2026, 12:00 AM

Stream - Introducing Stream Bindings for Workers

A condensed section focused on the key takeaways first.

Original Post

Quick Digest

Summary

A condensed section focused on the key takeaways first.

openaienmodel: gpt-5-mini-2025-08-07

Stream - Introducing Stream Bindings for Workers

Key Points

  • Upload and manage videos from Workers
  • Generate signed playback tokens without keys
  • Supports AI-generated video pipelines

Summary

Cloudflare Stream now provides a Workers binding (env.STREAM) that lets you upload videos, provision direct uploads, manage metadata, and generate signed playback tokens directly from a Worker — without making authenticated REST API calls. This tightens integration between Stream and Workers, enabling programmatic video pipelines, AI-generated video ingestion, and inference workflows.

Key Points

  • Add the Stream binding to your wrangler config (wrangler.jsonc or wrangler.toml) to expose env.STREAM to your Worker.
  • Upload videos or direct upload links from a URL: await env.STREAM.upload(videoUrl) — returns video ID, playback and manifest URLs.
  • Generate signed playback tokens server-side: await env.STREAM.video(videoId).generateToken() (no signing key management required).
  • Read and update video properties: await env.STREAM.video(videoId).details() and .update({ meta: { ... } }).
  • Integrate with AI: upload assets returned from env.AI.run(...).result.video directly to Stream from a Worker.
  • Use cases: programmatic pipelines, tighter app integrations, generative-AI and inference workloads.

Getting started (practical)

  1. Add the stream binding to wrangler.jsonc or wrangler.toml (example: [stream] binding = "STREAM").
  2. Call the main APIs from your Worker: env.STREAM.upload(...), .video(id).generateToken(), .video(id).details(), .video(id).update(...).
  3. Refer to the Cloudflare "Bind to Workers API" docs for the full API surface and examples.

Keep Worker code minimal by using the binding to avoid extra REST auth and key management.

Full Translation

Translations

A translation section that keeps the flow of the original article.

openaijamodel: gpt-5-mini-2025-08-07

Stream — Workers向け Stream バインディングの紹介

変更履歴 — Cloudflare の新しい更新と改善。RSSを購読 | RSSフィードを表示 ← すべての記事に戻る

Workers向け Stream バインディングの紹介

公開日: 2026年5月7日

カテゴリ: Stream

新しい Workers 用の Stream バインディングを使って、Stream のビデオライブラリと直接やりとりできるようになりました。これにより、Worker から認証された API コールを行うことなく、Stream へのコンテンツアップロード、直接アップロードの発行、ビデオ管理、署名付き URL の生成が可能になります。Stream と Workers をより密接に統合することで、より多くのプログラム的パイプライン、緊密な統合、生成 AI や推論ワークロードのサポートが可能になります。

次の場合に Stream バインディングを使用してください:

  • URL からビデオをアップロードする、またはエンドユーザー向けに基本的な直接アップロードリンクを作成する
  • 署名鍵を管理せずに再生用の署名トークンを生成する
  • ビデオのメタデータ、キャプション、ダウンロード、ウォーターマークを管理する
  • Workers 内だけでビデオパイプラインを構築する

はじめ方: Wrangler 設定に Stream バインディングを追加

wrangler.jsonc

{
  " $schema " : "./node_modules/wrangler/config-schema.json" ,
  " stream " : {
    " binding " : "STREAM"
  }
}

wrangler.toml

[ stream ]
binding = "STREAM"

AI でビデオを生成して Stream に直接アップロードする、または既存ファイルの URL を送る

JavaScript

const aiResponse = await env . AI . run ( "google/veo-3.1" , {
  prompt : "A dog walking next to a river" ,
  duration : "10s" ,
  aspect_ratio : "16:9" ,
  resolution : "1080p" ,
  generate_audio : true ,
}, {
  gateway : { id : "experiments" },
} ) ;
// Veo will return a URL of the generated asset.
const videoUrl = aiResponse . result . video ;
// Alternative option: a video of the Austin Office mobile
// const videoUrl = 'https://pub-d9fcbc1abcd244c1821f38b99017347f.r2.dev/aus-mobile.mp4';
// Upload to Stream by providing a URL
const streamVideo = await env . STREAM . upload ( videoUrl ) ;
// The streamVideo response will include the video ID, playback and manifest
// URLs, and other information, just like the REST API.

TypeScript

const aiResponse = await env . AI . run ( 'google/veo-3.1' , {
  prompt : 'A dog walking next to a river' ,
  duration : '10s' ,
  aspect_ratio : '16:9' ,
  resolution : '1080p' ,
  generate_audio : true ,
}, {
  gateway : { id : 'experiments' },
} ) ;
// Veo will return a URL of the generated asset.
const videoUrl = aiResponse . result . video ;
// Alternative option: a video of the Austin Office mobile
// const videoUrl = 'https://pub-d9fcbc1abcd244c1821f38b99017347f.r2.dev/aus-mobile.mp4';
// Upload to Stream by providing a URL
const streamVideo = await env . STREAM . upload ( videoUrl ) ;
// The streamVideo response will include the video ID, playback and manifest
// URLs, and other information, just like the REST API.

署名付き URL を署名鍵や API コールなしで生成する

JavaScript

const video_id = "ce800be43a9772f4bb02f35b860fb516" ;
const token = await env . STREAM . video ( video_id ) . generateToken () ;
// Use the "token" in an iframe embed code, manifest URL, or thumbnail:
const embedUrl = `https://customer-igynxd2rwhmuoxw8.cloudflarestream.com/${ token }/iframe` ;

TypeScript

const video_id = 'ce800be43a9772f4bb02f35b860fb516' ;
const token = await env . STREAM . video ( video_id ) . generateToken () ;
// Use the "token" in an iframe embed code, manifest URL, or thumbnail:
const embedUrl = `https://customer-igynxd2rwhmuoxw8.cloudflarestream.com/${ token }/iframe` ;

ビデオプロパティの取得と設定

JavaScript

const video_id = "46c8b7f480d410840758c1cb14a72e47" ;
const result = await env . STREAM . video ( video_id ) . details () ;
await env . STREAM . video ( video_id ) . update ( {
  meta : { name : "sample video" },
} ) ;

TypeScript

const video_id = '46c8b7f480d410840758c1cb14a72e47' ;
const result = await env . STREAM . video ( video_id ) . details () ;
await env . STREAM . video ( video_id ) . update ( { meta : { name : 'sample video' } } ) ;

セットアップ手順と完全な API リファレンスについては、Bind to Workers API を参照してください。

Agent で始める

  • Cloudflare Stream(env.STREAM)のバインディングを追加します。
  • watch ページでは、Stream バインディングを使用して ID に基づく情報を取得し、video.meta.name をページタイトルとして利用できます。

© 2026 Cloudflare, Inc. プライバシーポリシー 利用規約