@argmax/local-server
Node.js wrapper for managing Argmax Local Server on macOS
Overview
A Node.js wrapper for the Argmax Local Server binary that provides:
- Process management - Start, stop, and monitor the server
- REST API client - Interface with server endpoints
- WebSocket transcription - Real-time speech-to-text
- CLI tool - Command-line interface for server management
Installation
npm install @argmax/local-server
Getting the Argmax Local Server Binary
Get the Argmax Local Server binary from Argmax.
For support, contact support@argmaxinc.com.
Development CLI Wrapper
For development purposes, this package includes a create-dev-cli.sh script that creates a signed CLI wrapper. This is useful when you need to run the Argmax Local Server binary through a wrapper for development or testing.
Creating the Development CLI
./node_modules/@argmaxinc/local-server/dist/create-dev-cli.sh <TEAM_ID>
This will create a dev_cli binary that can be used as a launch wrapper:
npx @argmax/local-server start --launch-wrapper ./dev_cli --binary /path/to/argmax-local-server
Note: This script is intended for development use only and requires:
- macOS with Xcode command line tools installed
- Valid Apple Developer code signing certificate
- Team ID for code signing
Quick Start
Basic Usage
import { ArgmaxLocalServer } from '@argmax/local-server';
const server = new ArgmaxLocalServer({
binaryPath: '/path/to/argmax-local-server',
apiKey: 'your-api-key'
});
await server.startProcess();
await server.init({
apiKey: 'your-api-key',
model: 'tiny.en'
});
await server.waitForReady();
const status = await server.status();
console.log('Server status:', status);
await server.shutdown();
await server.stopProcess();
Real-time Transcription
const transcriber = server.createTranscriber({ source: 'microphone' });
transcriber.on('transcription', (result) => {
if (result.isFinal) {
console.log(`[FINAL] ${result.transcript}`);
} else {
console.log(`[INTERIM] ${result.transcript}`);
}
});
await transcriber.connect({
keywords: ['Argmax', 'AI', 'transcription'],
});
CLI Usage
npx @argmax/local-server start --binary /path/to/argmax-local-server
npx @argmax/local-server start --launch-wrapper /path/to/wrapper --binary /path/to/argmax-local-server
npx @argmax/local-server status
npx @argmax/local-server init --api-key your-key --model tiny.en
npx @argmax/local-server transcribe --api-key your-key
API Reference
ArgmaxLocalServer
Main class for server management.
constructor(config: ArgmaxLocalServerConfig)
Methods:
startProcess() - Start the server process
stopProcess() - Stop the server process
status() - Get server status
init(config) - Initialize server with model
waitForReady(timeout?) - Wait for server to be ready
reset() - Reset server state
shutdown() - Shutdown server
createTranscriber(options?) - Create WebSocket transcriber
Configuration
interface ArgmaxLocalServerConfig {
binaryPath: string;
launchWrapper?: string | string[];
host?: string;
port?: number;
apiKey?: string;
autoRestart?: boolean;
verbose?: boolean;
args?: string[];
}
Environment Variables
ARGMAX_SERVER_PATH=/path/to/argmax-local-server
ARGMAX_API_KEY=your-api-key
Deepgram SDK Integration
You can use the Deepgram SDK to connect to your local Argmax server instead of Deepgram's cloud service:
const { createClient, LiveTranscriptionEvents } = require("@deepgram/sdk");
const deepgram = createClient(process.env.ARGMAX_API_KEY, {
global: {
websocket: {
options: {
url: "ws://localhost:50060"
}
}
}
});
const connection = deepgram.listen.live({
model: "any model here",
language: "en",
smart_format: true,
interim_results: true,
encoding: 'linear16',
channels: 1,
sampleRate: 48000
});
connection.on(LiveTranscriptionEvents.Open, () => {
console.log("Connection opened.");
});
connection.on(LiveTranscriptionEvents.Transcript, (data) => {
console.log(data.channel.alternatives[0].transcript);
});
This allows you to keep your existing Deepgram SDK code while routing requests to your local Argmax server.
Note: For testing purposes, you can start the server with --any-token to allow any token value.
Testing
npm install
npm test
ARGMAX_SERVER_PATH=/path/to/binary npm test
License
MIT
Support
For questions and support, contact support@argmaxinc.com.