LibreTranslate integration for ElizaOS agents. This plugin exposes a reusable service that calls a LibreTranslate instance, allowing agents to translate text between languages.
- Install dependencies and build:
bun install
bun run build- Configure environment variables (optional overrides):
LIBRE_TRANSLATE_BASE_URL– Defaults tohttps://libretranslate.com. Set this if you run a different LibreTranslate host.LIBRE_TRANSLATE_API_KEY– Optional API key if your instance requires authentication.LIBRE_TRANSLATE_REQUEST_TIMEOUT_MS– Optional timeout in milliseconds (default15000).
Register the plugin in your agent configuration and access the service at runtime:
import { LibreTranslateService } from '@elizaos/plugin-translate';
const translateService = runtime.getService(LibreTranslateService.serviceType) as LibreTranslateService | null;
if (!translateService) throw new Error('Translate service not available');
const result = await translateService.translate({
text: 'Hello world',
targetLanguage: 'es',
});bun run test– Run unit tests (uses mocked HTTP calls).bun run format– Format source files.bun run clean– Clean build artifacts.