OpenRouter Audio is an OpenClaw skill that provides:
- audio transcription (
transcribe) - text-to-speech generation (
generate)
The implementation is a TypeScript CLI bundled into a JavaScript runtime artifact plus a small bash launcher. This skill was developed as part of the app.simpleclaw.ru project.
src/openrouter-audio.ts- CLI source implementationscripts/build.mjs- build JS skill artifactsscripts/build-bin.mjs- optional native binary buildSKILL.md- skill metadata and concise operator-facing notesbuild/openrouter-audio/- generated distribution artifacts
- Node.js 20+
- bun 1.3+
- OpenRouter API key in environment:
export OPENROUTER_API_KEY="your-api-key"npm run buildProduces:
build/openrouter-audio/openrouter-audio.jsbuild/openrouter-audio/openrouter-audio.shbuild/openrouter-audio/SKILL.md
openrouter-audio.sh is a bash wrapper that runs node openrouter-audio.js.
npm run build:binProduces:
build/openrouter-audio/openrouter-audio-bin
Important: this binary is platform-specific (current OS + CPU architecture).
build/openrouter-audio/openrouter-audio.sh --helpbuild/openrouter-audio/openrouter-audio.sh transcribe <audio_file> [--format FORMAT] [--model MODEL] [--prompt PROMPT]Audio-input models currently listed by OpenRouter:
These identifiers are embedded in the CLI help/model list for transcribe.
google/gemini-2.0-flash-001google/gemini-2.0-flash-lite-001google/gemini-2.5-flashgoogle/gemini-2.5-flash-litegoogle/gemini-2.5-flash-lite-preview-09-2025google/gemini-2.5-progoogle/gemini-2.5-pro-previewgoogle/gemini-2.5-pro-preview-05-06google/gemini-3-flash-previewgoogle/gemini-3-pro-previewgoogle/gemini-3.1-flash-lite-previewgoogle/gemini-3.1-pro-previewgoogle/gemini-3.1-pro-preview-customtoolsmistralai/voxtral-small-24b-2507openai/gpt-4o-audio-previewopenai/gpt-audioopenai/gpt-audio-miniopenrouter/auto
Example:
build/openrouter-audio/openrouter-audio.sh transcribe ./samples/meeting.mp3 --prompt "Summarize key decisions" --model openrouter/autobuild/openrouter-audio/openrouter-audio.sh generate <text> [--voice VOICE] [--format FORMAT] [--model MODEL] [--prompt PROMPT] [--out PATH] [--dry-run]Audio-output models currently listed by OpenRouter:
These identifiers are embedded in the CLI help/model list for generate.
openai/gpt-4o-audio-previewopenai/gpt-audioopenai/gpt-audio-mini
Examples:
# default format mp3, streaming is implicit
build/openrouter-audio/openrouter-audio.sh generate "Hello from OpenClaw"
# explicit format and voice
build/openrouter-audio/openrouter-audio.sh generate "Welcome" --voice nova --format wav
# explicit output path
build/openrouter-audio/openrouter-audio.sh generate "Welcome" --out ./artifacts/welcome.mp3
# override the default generation prompt
build/openrouter-audio/openrouter-audio.sh generate "Welcome" --prompt "Speak with a calm and clear narration style."
# dry-run: no API call, only planned output path
build/openrouter-audio/openrouter-audio.sh generate "Test" --dry-run- API key source:
OPENROUTER_API_KEYonly - Model override:
--modelis supported for bothtranscribeandgenerate - Transcribe format:
--formatoverrides auto-detection from file extension - Default transcribe model:
openrouter/auto - Default generate model:
openai/gpt-audio-mini - Default generate voice:
alloy - Default generate format:
mp3 - Generate API request format is always
pcm16for compatibility; local conversion is applied formp3,ogg, andwav - Generate requests always use
stream: true - Generate default prompt text:
Generate audio that speaks exactly the user's content. - Generated audio output location (when
--outis not provided):stateDir/workspace-$OPENCLAW_PROFILE/tmpifOPENCLAW_PROFILEis set and that workspace directory existsstateDir/workspace/tmpifOPENCLAW_PROFILEis not set and that workspace directory existsstateDir = $OPENCLAW_STATE_DIRwhen set, otherwise~/.openclaw- system temporary directory (
tmp) as fallback
- If a workspace directory is selected,
<WORKSPACE_DIR>/tmpis created automatically when missing - If generate returns multiple audio payloads and
--outis used, additional files are created with numeric suffixes (-2,-3, ...) generateoutput: JSON withpaths,transcript,formatgenerate --dry-run: skips API call and returns planned output path(s)
- wav, mp3, aiff, aac, ogg, flac, m4a, pcm16, pcm24
- wav, mp3, ogg, pcm16
- alloy, echo, fable, onyx, nova, shimmer
Set env var and rerun:
export OPENROUTER_API_KEY="your-api-key"Note: generate --dry-run does not require the API key.
- Verify model/voice/format combination
- Check upstream API response/body for provider-side issues
Install Node.js 20+ or run with a machine where Node is available.
npm run build
build/openrouter-audio/openrouter-audio.sh --help
build/openrouter-audio/openrouter-audio.sh generate "smoke" --dry-runRun CLI tests:
npm run test:clior:
npm testWhat is covered by automated tests:
- help and usage output
- unknown command handling
- argument validation for
transcribeandgenerate generate --dry-runJSON contract (paths,transcript,format)--outpath resolution behavior- validation errors for unsupported voice
- API key and missing-file failure paths for
transcribe