Ruby SDK
Build video on FastPix from Ruby: a ruby video SDK
The official FastPix SDK for Ruby. Typed end-to-end, async-aware, retry-safe. Encodes a source URL into a playback ID in one call, provisions LL-HLS live streams, verifies webhooks with one helper, and ships with a migration path from the closest API peer (see comparison).
Trusted by product teams shipping video at scale







Install
One install, one client, one call
Add the gem, point the client at your API key, and you're talking to FastPix — strongly-typed, no scaffolding.
Install the package
bash · terminal
gem install fastpixRuntime
Ruby 3.0+, Rails 6.1+.
Type safety
Sorbet RBI files bundled; T::Struct request bodies.
IDE support
RubyMine, VS Code with Ruby LSP.
Initialize the client
Ruby · app.rb
require "fastpix"
fp = FastPix::Client.new(api_key: ENV.fetch("FASTPIX_API_KEY"))Common operations
From upload to playback in 4 calls
Encode, wait, stream, upload. The four most common flows, typed end-to-end.
1. Encode a source URL into a playback ID
asset = fp.assets.create(
inputs: [{ url: "https://your-cdn.com/source.mp4" }],
playback_policy: :public,
)
puts asset.playback_id # "abc123"2. Wait until the asset is ready
# Poll until the asset is ready, or listen for the asset.ready webhook.
ready = fp.assets.wait_until_ready(
asset.id,
poll_interval_seconds: 2,
timeout_seconds: 300,
)3. Provision a low-latency live stream
stream = fp.live.create(
latency_mode: :low, # LL-HLS
reconnect_window_seconds: 60,
playback_policy: :public,
)
# stream.stream_key -> push to rtmp://global-live.fastpix.com/live4. Resumable chunked upload
# Resumable chunked upload from a background job
FastPix::Upload.chunked(
endpoint: asset_upload_url, # returned by fp.assets.create_upload
path: Rails.root.join("tmp", "source.mp4"),
chunk_size_mb: 8,
on_progress: ->(pct) { Rails.logger.info("#{pct}%") },
)Security, compliance, and partnerships
Webhook signature verification
One helper, every event typed
Every webhook FastPix sends is signed. The SDK verifies the signature and returns a fully-typed event payload. Switch on event.type and reach the typed payload directly.
# config/routes.rb: post "/webhooks/fastpix", to: "webhooks#fastpix"
class WebhooksController < ApplicationController
skip_before_action :verify_authenticity_token, only: :fastpix
def fastpix
event = FastPix::Webhooks.verify!(
payload: request.raw_post,
signature: request.headers["FastPix-Signature"],
secret: ENV.fetch("FASTPIX_WEBHOOK_SECRET"),
)
case event.type
when "asset.ready"
# event.data is a typed struct
end
head :ok
end
endConcurrency model
Built for the Ruby runtime
Thread-safe; one FastPix::Client per process is the recommended pattern. The internal HTTP client uses keep-alive connections with a default pool size of 8. Inside Sidekiq or GoodJob workers, FastPix::Client can be shared across worker threads safely.
Type safety + IDE support
Sorbet RBI files ship in the gem. Request bodies are T::Structs with required-field enforcement at runtime even when Sorbet is not enabled. Webhook event payloads are typed structs; a missing required field surfaces as a clear ValidationError, not a NoMethodError downstream.
Migration
Swap the client, keep the shape
FastPix exposes primitives that mirror the closest API peer. The Ruby SDK keeps the call shapes recognizable so the migration is a one-file swap, not a rewrite. FastPix vs Mux side-by-side.
# Before: require "mux_ruby"
# FastPix:
require "fastpix"
fp = FastPix::Client.new(api_key: ENV.fetch("FASTPIX_API_KEY"))
# Before: result = assets_api.create_asset(create_asset_request)
# FastPix:
asset = fp.assets.create(
inputs: [{ url: url }],
playback_policy: :public,
)
# Before: result.data.playback_ids.first.id
# FastPix:
asset.playback_idBulk migration tooling at /compare/mux and the docs migration guide handles asset re-ingest and playback-ID remap.
FAQ
Ruby SDK FAQ
What does the Ruby SDK ship with out of the box?
All API surfaces (assets, live streams, playback policies, webhooks, simulcast, analytics query) plus the resumable chunked upload helper, webhook signature verification, automatic retries with exponential backoff, and configurable timeout / base URL / HTTP client. Type definitions are bundled.Is the Ruby SDK production-ready?
Yes. The client is used in production by FastPix customers shipping video on the Ruby runtime. The retry policy, connection pool defaults, and timeout shape are tuned against the same workload patterns that produce the numbers on the /performance page.How do I authenticate against the FastPix API from Ruby?
Set the FASTPIX_API_KEY environment variable and pass it to the client constructor. The SDK adds the Bearer header on every request. For server-side runtimes, fetching the API key from your secret store at startup and constructing the client once at module load is the recommended pattern.Where do I get an API key?
Sign up at the FastPix dashboard. The free trial provisions a key with no credit card; the trial plan covers 10 videos plus 100K streaming minutes plus AI samples. See /pricing for the full plan structure.
Read it, run it, ship it.
Every SDK, player, and integration lives on GitHub. Star the repos, file an issue, or open a PR — we build alongside the developers who use us.
Continue exploring
Where the Ruby SDK plugs in
Video on Demand
Encode + store + deliver via this SDK.
Video on DemandLive Streaming
Provision LL-HLS streams from Ruby.
Live StreamingIn-Video AI
Captions, NER, summary, moderation API surfaces.
In-Video AIVideo Data
56-dim per-session QoE query API.
Video DataAll developer docs
Other SDKs + API reference + webhooks.
Developer docsPricing
SKU-by-SKU rates.
Pricing