

A powerful, lightweight, and offline voice command framework for Lethal Company modders.
This mod provides a simple yet flexible API that allows other mods to easily implement voice commands using the high-performance Vosk offline speech recognition engine.
This mod is a dependency or framework. On its own, it does nothing. Its purpose is to provide the underlying technology for other mods that want to use voice commands.
You only need to install this mod if another mod lists it as a requirement.
VoiceCommandsAPI. Alternatively, you can download it from the releases page and place the VoiceCommandsAPI.dll and vosk-model-small-en-us-0.15 folder into your BepInEx/plugins directory.Integrating voice commands into your mod is straightforward.
First, add VoiceCommandsAPI to your manifest.json dependencies:
{
"name": "YourCoolMod",
"version_number": "1.0.0",
"website_url": "",
"description": "My mod that uses voice commands!",
"dependencies": [
"BepInEx-BepInExPack-5.4.2100",
"DumbassStuff-VoiceCommandsAPI-1.0.0"
]
}
Next, add a reference to the VoiceCommandsAPI.dll in your C# project.
The API is accessed through the CommandManager singleton instance.
using VoiceCommandsAPI.API;
You can register commands in your plugin's Awake() method. There are two primary ways to register a command.
A) Registering an Exact Phrase
Use this for simple commands where the user must say the exact phrase. The matching is case-insensitive.
// In your plugin's Awake() method
// The phrase to listen for (will be converted to lowercase)
string commandPhrase = "open the blast doors";
// The action to execute when the phrase is recognized
Action commandAction = () => {
HangarShipDoor.Instance.PlayDoorAnimation(true);
MyLogger.LogInfo("Voice command 'open the blast doors' executed!");
};
// Register the command
CommandManager.Instance.RegisterCommand(commandPhrase, commandAction);
B) Registering a Pattern
Use this for more complex commands where you want to match a pattern or extract values from the speech. The handler receives the recognized text as a parameter.
// In your plugin's Awake() method
// 1. The matcher function: returns true if the text matches your pattern.
// In this example, we check if the command starts with "scan for ".
Func<string, bool> matcher = (text) => text.StartsWith("scan for ");
// 2. The handler function: contains the logic to execute.
// It receives the full recognized text.
Action<string> handler = (text) => {
// Extract the target from the recognized text
string target = text.Substring("scan for ".Length);
MyLogger.LogInfo($"Executing scan for target: {target}");
// Add your custom logic here, e.g., ping a specific scrap item
};
// Register the pattern
CommandManager.Instance.RegisterPattern(matcher, handler);
The CommandManager also exposes events for more advanced use cases, such as providing UI feedback.
// Get feedback on partially recognized text (e.g., for a "Listening..." UI)
CommandManager.Instance.OnPartialText += (text) => {
MyUI.ShowSubtitle(text);
};
// Know when any command is successfully matched and executed
CommandManager.Instance.OnCommandRecognized += (text) => {
MyUI.ShowSuccessPing();
};
// Know when speech was recognized but didn't match any command
CommandManager.Instance.OnCommandNotMatched += (text) => {
MyUI.ShowFailurePing();
};
The API safely hooks into the game's Dissonance audio pipeline to capture the local player's microphone input. This audio is resampled to the 16kHz format required by Vosk and processed in real-time. The results are then checked against registered commands from other mods.
This project would not be possible without the incredible Vosk-API. Please consider supporting their work. This readme was written by AI bc im lazy as fuck, sue me :)