const API_KEY = 'your_api_key_here';
const BASE_URL = 'https://platform.algebras.ai/api/v1';
'Content-Type': 'application/json',
// Get supported languages
async function getLanguages() {
const response = await fetch(`${BASE_URL}/translation/languages`, {
const data = await response.json();
console.error('Error fetching languages:', error);
async function translateText(text, targetLanguage, sourceLanguage = 'auto') {
const response = await fetch(`${BASE_URL}/translation/translate`, {
const data = await response.json();
console.error('Error translating text:', error);
const languages = await getLanguages();
console.log('Supported languages:', languages);
const translated = await translateText('Hello, world!', 'de');
console.log('Translated text:', translated);
console.error('Error in API operations:', error);