npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

abenasdk

v0.1.1

Published

Enterprise Node.js SDK for Abena AI Services - ASR, TTS, Translation

Downloads

22

Readme

Abena AI Node.js SDK

NPM version License: Proprietary

The official enterprise-grade Node.js SDK for integrating Abena AI's powerful services into your applications. Access high-quality Text-to-Speech (TTS), accurate Automatic Speech Recognition (ASR), and Neural Machine Translation with a simple and intuitive async/await API.

Features

  • High-Quality TTS: Synthesize natural-sounding speech using intuitive voice names.
  • Accurate ASR: Transcribe audio from files, Buffers, or Streams.
  • Neural Translation: Translate text between hundreds of user-friendly language codes.
  • Robust & Secure: Built with production-grade validation and security.
  • Detailed Error Handling: Clear, specific exceptions for easy debugging in your application.
  • TypeScript Support: Fully typed for a modern development experience.

Installation

The package requires Node.js v14 or higher.

npm install @abena-ai-team/abenasdk

Quick Start

const { AbenasClient, FileError } = require('@abena-ai-team/abenasdk');
const fs = require('fs');

// Best practice: store your API key in an environment variable
// export ABENA_API_KEY="sk_your_api_key_here"
const client = new AbenasClient({
    apiKey: process.env.ABENA_API_KEY
});

async function main() {
    try {
        // Text-to-Speech (TTS)
        const audioBuffer = await client.tts.synthesize(
            'Hello from the Abena AI software development kit.',
            'akua'
        );
        fs.writeFileSync('speech_output.wav', audioBuffer);
        console.log("Audio saved to speech_output.wav");

        // Automatic Speech Recognition (ASR)
        const transcription = await client.asr.transcribe('speech_output.wav', 'en');
        console.log(`Transcription: ${transcription.text}`);

        // Translation
        const translation = await client.translator.translate({
            text: 'Hello from Abena AI!',
            source_language: 'en',
            target_language: 'fr'
        });
        console.log(`Translation: ${translation.translation}`);

    } catch (error) {
        console.error(`An error occurred: [${error.name}] ${error.message}`);
        if (error instanceof FileError) {
            console.error("Please ensure the input file exists.");
        }
    }
}

main();

API Reference

Client Initialization

The client can be configured for production or local development environments.

const { AbenasClient } = require('@abena-ai-team/abenasdk');

// For Production (default)
const client = new AbenasClient({ apiKey: 'YOUR_PROD_KEY' });

Text-to-Speech (client.tts)

synthesize(text, voice, outputFile)

Converts text to speech.

  • text (string): The text to synthesize. Max 500 characters.
  • voice (string): The voice name to use (e.g., 'akua', 'abena').
  • outputFile (string, optional): Path to save the .wav file. If omitted, a Buffer is returned.
// Get audio data as a Buffer
const audioBuffer = await client.tts.synthesize('Hello world', 'akua');

// Or save directly to a file
await client.tts.synthesize('Hello world', 'abena', 'output.wav');

Speech Recognition (client.asr)

transcribe(audioSource, language)

Transcribes an audio file to text.

  • audioSource (string | Buffer | Stream): The audio to transcribe. Can be a file path, a Buffer, or a Readable stream.
  • language (string): The language of the audio (e.g., 'en').
// From a file path
const result = await client.asr.transcribe('./audio.wav', 'en');
console.log(result.text);

// From a Buffer
const audioBuffer = fs.readFileSync('./audio.wav');
const resultFromBuffer = await client.asr.transcribe(audioBuffer, 'en');

Translation (client.translator)

translate({ text, source_language, target_language })

Translates text between languages.

  • text (string): The text to translate. Max 1000 characters.
  • source_language (string): The source language code (e.g., 'en').
  • target_language (string): The target language code (e.g., 'fr').
const result = await client.translator.translate({
    text: 'Welcome to the future of AI.',
    source_language: 'en',
    target_language: 'twi'
});
console.log(result.translation);

Error Handling

The SDK throws specific, custom errors to allow for robust error handling.

const { AbenasClient, APIError, ValidationError, FileError } = require('@abena-ai-team/abenasdk');
const client = new AbenasClient({ apiKey: '...' });

try {
    await client.asr.transcribe('non_existent_file.wav');
} catch (error) {
    if (error instanceof FileError) {
        console.error(`File Error: ${error.message}`);
    } else if (error instanceof ValidationError) {
        console.error(`Validation Error: ${error.message}`);
    } else if (error instanceof APIError) {
        console.error(`API Error: [Status ${error.status}] ${error.message}`);
        // The raw server response data is available if needed
        console.error('Server Response:', error.data);
    } else {
        console.error(`An unexpected error occurred: ${error.message}`);
    }
}

Documentation & Support


© 2025 Mobobi LLC. All rights reserved.