Rev AI Node SDK
raw JSON → 3.8.5 verified Sat Apr 25 auth: no javascript
Official Node.js SDK for the Rev AI speech-to-text API, enabling automatic speech recognition with features like async transcription, custom vocabulary, speaker diarization, language selection, summarization, and translation. Current stable version is 3.8.5, released under a regular cadence. Key differentiators include support for multiple input types (local files, URLs, audio streams), human transcription option, global deployment configuration, and full TypeScript typings. The SDK wraps Rev AI's REST API for job submission and retrieval.
Common errors
error SyntaxError: Cannot use import statement outside a module ↓
cause Using ES import syntax in a CommonJS project without ESM enabled.
fix
Set
"type": "module" in package.json, or use dynamic import: const { RevAiApiClient } = await import('revai-node-sdk'). error TypeError: RevAiApiClient is not a constructor ↓
cause Using default import instead of named import.
fix
Use
import { RevAiApiClient } from 'revai-node-sdk' instead of import RevAiApiClient from 'revai-node-sdk'. error Error: "deploymentConfig" is required but not specified ↓
cause Client initialized without a deployment configuration.
fix
Provide
deploymentConfig: RevAiApiDeploymentConfigMap.get(RevAiApiDeployment.US) or other deployment. error Error: No account found with the given access token ↓
cause Access token is invalid, expired, or missing.
fix
Check the access token on your Rev AI settings page and ensure it is correctly passed to the client.
Warnings
breaking In v3, the client constructor no longer accepts only a token string; it requires an object with `token` and optional `deploymentConfig`. ↓
fix Change `new RevAiApiClient(token)` to `new RevAiApiClient({ token })`. Provide deployment config if needed.
deprecated The method `getTranscriptText` returns raw text; use `getTranscriptObject` for structured data. ↓
fix Use `getTranscriptObject(jobId)` and access structured fields.
gotcha SubmitJobLocalFile expects the file path as first argument; do not pass a stream or Buffer directly. ↓
fix Use `submitJobAudioData(stream, filename)` for streams.
gotcha The `source_config` object in job options must contain a `url` key for remote files; omitting it causes silent failure. ↓
fix Always include `source_config: { url: '...' }` when using `submitJob` with a URL.
deprecated Node 8, 10 are no longer tested; support was dropped in v3.5.0. ↓
fix Use Node 12 or later, preferably 16 or 18.
Install
npm install revai-node-sdk yarn add revai-node-sdk pnpm add revai-node-sdk Imports
- RevAiApiClient wrong
const { RevAiApiClient } = require('revai-node-sdk')correctimport { RevAiApiClient } from 'revai-node-sdk' - RevAiApiDeploymentConfigMap wrong
import RevAiApiDeploymentConfigMap from 'revai-node-sdk'correctimport { RevAiApiDeploymentConfigMap } from 'revai-node-sdk' - RevAiApiDeployment wrong
import * as RevAiApiDeployment from 'revai-node-sdk/RevAiApiDeployment'correctimport { RevAiApiDeployment } from 'revai-node-sdk'
Quickstart
import { RevAiApiClient, RevAiApiDeployment, RevAiApiDeploymentConfigMap } from 'revai-node-sdk';
const accessToken = process.env.REVAI_ACCESS_TOKEN ?? '';
const client = new RevAiApiClient({ token: accessToken, deploymentConfig: RevAiApiDeploymentConfigMap.get(RevAiApiDeployment.US) });
async function main() {
const account = await client.getAccount();
console.log('Account balance:', account.balance);
const job = await client.submitJobLocalFile('./audio.mp3', { language: 'en' });
console.log('Job ID:', job.id);
const transcript = await client.getTranscriptObject(job.id);
console.log('Transcript:', transcript.monologues[0].elements[0].value);
}
main().catch(console.error);