On this page
On this page
Plugin SDK reference
Plugin runtime media helpers
Speech, media understanding, generation, web search, and the low-level media utilities. Part of the Plugin runtime helpers reference.
FFmpeg command discovery
Official plugin sources use resolveFfmpegBin from
the private openclaw/plugin-sdk/media-ffmpeg runtime. It resolves the same
trusted system paths as the media runtime and throws an installation hint when
FFmpeg is unavailable. This narrow entry point keeps media generation and agent
runtimes out of source audio worker startup. It has a JavaScript-only host export;
its declarations are excluded from the package. Third-party plugins retain the
existing resolveFfmpegBin export from openclaw/plugin-sdk/media-runtime.
The official plugin publication builder emits media-runtime for this private
import, including worker entries, so published plugins keep working on supported
hosts that predate media-ffmpeg. Both paths use the host's FFmpeg resolver.
Realtime voice playback
Official audio workers use createRealtimeVoiceOutputActivityTracker and
isRealtimeVoiceAudioAudible from the private
openclaw/plugin-sdk/realtime-voice-playback runtime to avoid loading voice
session and agent runtimes from source. The publication builder emits the
existing openclaw/plugin-sdk/realtime-voice host import for these helpers,
including worker entries, to preserve supported hosts. The source facade has a
JavaScript-only host export; its declarations are excluded from the package.
Media and generation namespaces
api.runtime.tts
Text-to-speech synthesis.
Uses core tts configuration and provider selection. Returns PCM audio buffer + sample rate. textToSpeechStream is also available for streaming synthesis.
buildSystemPromptHintAsync(config, agentId?, options?) prepares the TTS prompt hint through the state owner and returns Promise<string | undefined>. It is optional on older host interfaces; require an upgrade when absent. See the async prompt preparation recipe.
api.runtime.mediaUnderstanding
Image, audio, and video analysis.
Returns { text: undefined } when no output is produced (e.g. skipped input).
describeImageFileWithModel(...) describes an already-known image through a specific provider/model, bypassing the default active-model resolution that describeImageFile(...) uses.
api.runtime.imageGeneration
Image generation.
api.runtime.videoGeneration
Video generation, mirroring the image generation shape.
api.runtime.musicGeneration
Music generation, mirroring the image generation shape.
api.runtime.webSearch
Web search.
Search callers may supply a synchronous assertCurrent callback with signal
to retain their authority through provider preparation. Guarded HTTP requests
check it after transport preparation and before each request or redirect.
A registered search provider using another transport must call the execution
context's assertCurrent before each external side effect, after awaited
preparation. The callback belongs to the caller and expires when the search
finishes; providers must not replace it or treat its absence as permission.
Host callers can also pass modelSelection: { provider, model, authProfileId? }.
This is selection data, not an authorization grant. Model-backed search providers
preserve a matching provider's model/profile through their native transport;
unrelated search providers keep their own configured selection. An explicit
matching credential prevents automatic fallback to another search provider.
The agent tool carries this context separately from model-authored arguments.
api.runtime.media
Low-level media utilities.
QR helpers are exported by openclaw/plugin-sdk/media-runtime: