Video Generation API (BETA)
Generate short videos from text prompts or images. Supports text-to-video, image-to-video, and reference-to-video modes across multiple providers.
Quick Start
import RundotGameAPI from '@series-inc/rundot-game-sdk/api'
const result = await RundotGameAPI.videoGen.generate({
provider: 'seedance-2.0',
mode: 'text-to-video',
prompt: 'A dragon flying over a medieval castle at sunset, cinematic',
durationSeconds: 8,
aspectRatio: '16:9',
})
console.log(result.videoUrl)
console.log(result.durationSeconds)Providers
The platform serves video models from a runtime registry — new models become available without an SDK release. The models available at time of writing:
seedance-2.5
High-quality generation with reference support, audio generation, draft preview, 4–30s
seedance-2.0
High-quality generation with reference support, audio generation, 4–15s
seedance-2.0-fast
Faster generation at slightly lower quality, same capabilities as 2.0. 480p/720p only
seedance-2.0-v2-fast
Seedance 2.0 enterprise/v2 fast tier, same parameters as seedance-2.0-fast. 480p/720p only
kling-3.0-standard
Multi-prompt storytelling, negative prompts, configurable shot types, 3–15s
The SDK's VideoGenProvider type accepts any string so a registry addition type-checks before the next SDK release; the four ids above remain as autocomplete hints.
No current provider supports cameraFixed, and passing it is rejected with VIDEO_GEN_INVALID_PARAMS — remove it rather than relying on it being ignored. negativePrompt is accepted by Kling and silently dropped by Seedance, which declares no such field.
Text-to-Video
Generate video entirely from a text prompt.
Image-to-Video
Animate a static image into a video. Provide a start image, and optionally an end image for guided transitions.
Reference-to-Video (Seedance only)
Use image, video, or audio references to guide generation while creating new content.
Multi-Prompt (Kling only)
Script multiple scenes within a single generation by providing timed prompt segments.
Async Job Recovery
Video generation runs as an async job. Use getCompletedJobs() to drain results after disconnects. Pass clientRef for correlation; it is not echoed as a top-level field on job events, so read it back via job.params.clientRef.
Tracking and cancelling a running job
Subscribe with onJobStarted() to learn the jobId of a generation as soon as it kicks off, then pass that jobId to cancel() to stop it.
cancel(jobId: string): Promise<void>
Cancel an in-flight video generation job by its jobId. The jobId comes from an onJobStarted event.
jobId
string
Identifier of the running job to cancel (from onJobStarted)
onJobStarted(callback): { unsubscribe: () => void }
Subscribe to a notification fired when a generation job starts. The callback receives a VideoGenJobStartedEvent, which carries the jobId you pass to cancel(). Returns a subscription; call unsubscribe() to stop receiving events.
callback
(event: VideoGenJobStartedEvent) => void
Invoked with the job-started event when a generation begins
VideoGenJobStartedEvent
jobId
string
Identifier of the job that started; pass to cancel()
Configuration
rundot/videoGen.config.json
videoGen is default-bounded: your game can call it without any config file, but undeclared usage runs under default platform safety caps (~$500/game/day and ~$10/user/day). Creating rundot/videoGen.config.json — which rundot deploy does automatically the first time it detects the service in your bundle — replaces those defaults with your own policy: the auto-created permissive {} removes the caps entirely, or you can author allowlists and caps to tighten instead. An explicit { "disabled": true } turns the service off.
Place your config at rundot/videoGen.config.json. The file contains the settings directly (no wrapping key — the filename implies it):
Commit
rundot/to your repo; it's project config, not a build artifact, and it's env-agnostic.game.config.prod.jsonis a separate file for local CLI metadata; this config does not go there.
Common fields:
disabled
boolean
Turns the service off; every call fails with AI_POLICY_DENIED.
allowedModels
string[]
Allowlist of permitted identifiers (see note below). When set, an unlisted identifier is rejected. Omit to allow any.
dailyCreditCap
number
Approximate per-game daily credit ceiling.
perUserDailyCreditCap
number
Approximate per-user daily credit ceiling.
For videoGen, allowedModels entries match the request's provider (e.g. seedance-2.0, seedance-2.0-fast, seedance-2.0-v2-fast, kling-3.0-standard), not a model id. Putting a raw model id in the list silently fails to match every request and blocks all calls — list the provider values instead.
The two credit caps are approximate safety ceilings, not exact meters: the server reserves budget from a cost estimate before each call and reconciles the real cost afterward, so the effective ceiling can drift slightly around the configured value.
Policy resolves from your game's published (public) release — the same config your live players run against.
API Reference
videoGen.generate(params)
Promise<VideoGenResult>
Generate video
videoGen.getCompletedJobs()
Promise<VideoGenJobEvent[]>
Drain completed async job results
videoGen.cancel(jobId)
Promise<void>
Cancel an in-flight generation job
videoGen.onJobStarted(callback)
{ unsubscribe: () => void }
Subscribe to job-started notifications (delivers the jobId)
Common Parameters (all modes)
provider
VideoGenProvider
Required: a video model id from the platform registry (any string; the four known ids autocomplete). Unknown ids are rejected by the server with VIDEO_GEN_INVALID_PARAMS
mode
VideoGenMode
Required: 'text-to-video', 'image-to-video', or 'reference-to-video'
prompt
string
Text description of the video content
requestOrigin
string
Optional origin tag attached to the request
clientRef
string
Opaque correlation ID. Not echoed as a top-level field on job events; read it back via job.params.clientRef on the VideoGenJobEvent returned by getCompletedJobs()
draft
boolean
Optional: request fast low-resolution (480p) draft preview on supported models (e.g. seedance-2.5). Bills at the draft rate and returns a draftId for subsequent 1080p completion
Seedance Parameters
aspectRatio
VideoGenAspectRatio
'21:9', '16:9', '4:3', '1:1', '3:4', or '9:16'
resolution
VideoGenResolution
'480p', '720p', or '1080p'
durationSeconds
number
Video length in whole seconds. The accepted range is a property of the model, not the SDK — read durationRange for your provider/mode from GET /v1/videogen/models. Omit to let the provider pick its own default
generateAudio
boolean
Generate synchronized audio track. Defaults to true — pass false explicitly for silent output
startImageUrl
string
Start frame image (image-to-video mode)
endImageUrl
string
End frame image (image-to-video mode)
imageReferences
string[]
Style/content reference images (reference-to-video mode, max 9)
videoReferences
string[]
Motion reference videos (reference-to-video mode, max 3)
audioReferences
string[]
Audio references for voice cloning (reference-to-video mode, max 3, see constraints below)
Kling Parameters
aspectRatio
'16:9' | '9:16' | '1:1'
Output aspect ratio
durationSeconds
3 | 4 | ... | 15
Video length in whole seconds; accepts only integers 3 through 15 (no decimals)
generateAudio
boolean
Generate synchronized audio track
negativePrompt
string
What to avoid in the video
cfgScale
number
Classifier-free guidance scale
shotType
'customize' | 'intelligent'
Camera shot control
multiPrompt
KlingMultiPromptElement[]
Timed prompt segments
startImageUrl
string
Start frame image (image-to-video mode)
endImageUrl
string
End frame image (image-to-video mode)
KlingMultiPromptElement
Each element of a Kling multiPrompt array describes one timed scene segment.
prompt
string
Required: text description for this segment
durationSeconds
number
Optional segment length in seconds. A plain number (not the discrete integer union used by the top-level durationSeconds)
VideoGenResult
generationId
string
Unique ID for the generated video
videoUrl
string
URL to the video file
posterUrl
string | undefined
URL to a poster/thumbnail frame
durationSeconds
number | undefined
The requested duration. Absent when the caller named none — the provider chose it and reports none back
width
number | undefined
Video width in pixels. Absent: current providers do not report frame dimensions
height
number | undefined
Video height in pixels. Absent: current providers do not report frame dimensions
provider
VideoGenProvider
Provider that generated the video
mode
VideoGenMode
Mode used for generation
prompt
string
The prompt used
seed
number | undefined
The seed the provider reported (Seedance). Absent for providers that report none (Kling)
draftId
string | undefined
Identifier for draft generations, used to complete/upgrade drafts within 7 days
VideoGenJobEvent
jobId
string
Job identifier
status
'completed' | 'failed'
Job outcome
params
VideoGenParams
Original request parameters
result
VideoGenResult | undefined
Result if completed
error
string | object | undefined
Failure info if failed. May be a plain message string or an object with code, message, detail, providerType, errorDetail
errorDetail
ProviderErrorDetail | undefined
Structured provider rejection detail if the provider supplied one (see below)
ProviderErrorDetail
When the video provider rejects a request with a structured reason (rather than failing transiently), it is surfaced as errorDetail on failed job events, and as err.errorDetail on the RundotApiError rejection of generate(). All fields are best-effort and optional.
loc
(string | number)[] | undefined
Path to the offending request field, e.g. ["body", "image_urls"]
type
string | undefined
Provider error type, e.g. 'content_policy_violation'
reason
string | undefined
Provider-internal reason code, e.g. 'partner_validation_failed'
msg
string | undefined
Provider's verbatim human-readable message
Handling a failed job by rejection type:
Best Practices
Use
seedance-2.0-fastduring development for faster iteration, then switch toseedance-2.0for production quality.For image-to-video, provide high-quality source images: the output quality is bounded by the input.
Kling's
multiPromptis ideal for cutscenes with distinct beats: give each segment a clear visual description.Use
clientReffor all generation calls to enable recovery after disconnects.Call
getCompletedJobs()on reconnect to retrieve results from any in-flight generations.
Reference Constraints (Seedance)
reference-to-video mode enforces these limits on reference inputs:
imageReferences
9
-
-
videoReferences
3
-
-
audioReferences
3
3–5 seconds each
<= 15 seconds total
Audio references must be re-encoded to exact-second boundaries. Stream-copied audio (e.g. from a basic trim) will be rejected. Use files.transform({ op: 'audioTrim', ... }) to produce correctly-encoded clips:
Limits
Seedance duration: whole-second integers 4 through 15. Kling duration: whole-second integers 3 through 15. Decimals (e.g. 7.5) are rejected at the type level.
reference-to-videomode is only available with Seedance providers.multiPromptandnegativePromptare only available with Kling.Subject to per-creator rate-limit tiers: see Rate Limits.
Last updated