
Security News
npm ‘is’ Package Hijacked in Expanding Supply Chain Attack
The ongoing npm phishing campaign escalates as attackers hijack the popular 'is' package, embedding malware in multiple versions.
@aiola/sdk
Advanced tools
The official JavaScript/TypeScript SDK for the aiOla API, work seamlessly in both Node.js and browser environments.
npm install @aiola/sdk
# or
yarn add @aiola/sdk
import { AiolaClient } from '@aiola/sdk';
const client = new AiolaClient({
apiKey: AIOLA_API_KEY,
});
Create a client using an access token directly:
const client = new AiolaClient({
accessToken: YOUR_ACCESS_TOKEN,
});
Create a temporary access token from an API key:
const accessToken = await AiolaClient.grantToken(AIOLA_API_KEY);
const client = new AiolaClient({ accessToken });
This is useful for:
Direct the SDK to use your own endpoint by providing the baseUrl
option:
const client = new AiolaClient({
apiKey: AIOLA_API_KEY,
baseUrl: 'https://api.mycompany.aiola.ai',
});
import fs from 'node:fs';
import path from "path";
async function transcribeFile() {
const filePath = path.resolve(__dirname, "./audio.wav");
const file = fs.createReadStream(filePath);
const transcript = await client.stt.transcribeFile({
file: file,
language: "en"
});
console.log(transcript);
}
transcribeFile();
import { AiolaClient } from '@aiola/sdk';
import fs from 'node:fs';
const client = new AiolaClient({
apiKey: AIOLA_API_KEY,
});
const connection = await client.stt.stream({
lang_code: 'en',
});
connection.on('transcript', ({ transcript }) => {
console.log('Transcript:', transcript);
});
const audio = fs.createReadStream('./audio.wav');
audio.on('data', (chunk) => connection.send(chunk));
connection.connect();
import fs from 'node:fs';
async function createFile() {
const audio = await client.tts.synthesize({
text: 'Hello, how can I help you today?',
voice: 'jess',
language: 'en',
});
const fileStream = fs.createWriteStream('./audio.wav');
audio.pipe(fileStream);
}
createFile();
async function streamTts() {
const stream = await client.tts.stream({
text: 'Hello, how can I help you today?',
voice: 'jess',
language: 'en',
});
const audioChunks = [];
for await (const chunk of stream) {
audioChunks.push(chunk);
}
}
streamTts();
a ready-made web app that demonstrates how to use the SDK directly in a browser to stream microphone audio to aiOla Speech-to-Text and receive live transcripts.
cd examples/stt/browser-mic-stream
npm install
npm run dev
AudioWorklet
API to capture microphone audio, convert it to 16-bit PCM (16 kHz, mono), and send it through the WebSocket returned.FAQs
aiOla javascript sdk
The npm package @aiola/sdk receives a total of 235 weekly downloads. As such, @aiola/sdk popularity was classified as not popular.
We found that @aiola/sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The ongoing npm phishing campaign escalates as attackers hijack the popular 'is' package, embedding malware in multiple versions.
Security News
A critical flaw in the popular npm form-data package could allow HTTP parameter pollution, affecting millions of projects until patched versions are adopted.
Security News
Bun 1.2.19 introduces isolated installs for smoother monorepo workflows, along with performance boosts, new tooling, and key compatibility fixes.