Official SDK

Voice AI for Ghana,
in three lines of code

Add multilingual chat, speech-to-text, text-to-speech, and translation for Twi, Fante, Ewe and English to any web app. No API key, no build step.

0 dependencies ~3KB gzipped UMD / ESM / <script> No API key

Install

Drop in a single script tag — that's it.

index.html
<script src="https://ai.cedar-pro.services/sdk/cedar-ai.js"></script>

Or import it as a module:

app.js
import CedarAI from 'https://ai.cedar-pro.services/sdk/cedar-ai.js';

Quick start

Create a client and start a conversation in any Ghanaian language.

chat.js
const ai = new CedarAI();

// Chat — reply in Twi
const res = await ai.chat('Good morning, how are you?', { lang: 'tw' });
console.log(res.content);  // → Maakye! Wo ho te sɛn?
No API key needed. The default baseURL is https://ai.cedar-pro.services. Pass { baseURL } to point at your own deployment.

Streaming

Stream tokens as they arrive for a live, typewriter feel.

stream.js
await ai.chat('Tell me about Ghana', {
  stream: true,
  onChunk: (c) => process.stdout.write(c.content),
  onDone:  (r) => console.log('\ndone:', r.content.length, 'chars'),
});

Voice & translation

Speech-to-text, text-to-speech, and translation in a few calls.

voice.js
// 🎤 Speech-to-text (Twi audio → text)
const { text } = await ai.asr(audioBlob, { lang: 'tw' });

// 🔊 Text-to-speech (returns a playable clip)
const speech = await ai.tts('Akwaaba', { lang: 'tw' });
speech.play();

// 🌍 Translation
const { translatedText } = await ai.translate('Welcome', {
  sourceLang: 'en', targetLang: 'tw',
});

Method reference

chat(input, opts)

Send a message or message array. Returns { content, usage }, or streams via onChunk.

opts: lang, model, stream, maxTokens, temperature
asr(audio, opts)

Speech-to-text from an audio Blob/File. Returns { text, detectedLanguage }.

opts: lang, filename
tts(text, opts)

Text-to-speech. Returns { blob, url, play() }.

opts: lang
translate(text, opts)

Translate text. Returns { translatedText, sourceLang, targetLang }.

opts: sourceLang, targetLang
batchTranslate(texts, opts)

Translate an array of strings in one request.

opts: sourceLang, targetLang
getLanguages()

List supported languages and their codes.

→ [{ code, name }]

Language codes

CodeLanguageVoice
enEnglishLive
twTwi (Akan)Live
fatFanteLive
eeEwe (Eʋegbe)Live
gaaGa (Gã)Coming soon
dagDagbaniComing soon