Skip to content

hello2himel/takla-onubad

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Takla Bangla → Bengali Converter

A fully client-side linguistic repair engine that converts chaotic phonetic Bangla ("Takla Bangla") into grammatically correct Bengali script.

Features

Ultra-Minimal UI - Flat, monochrome, Google Translate-inspired
Free AI Models - Trinity Large 400B, Solar Pro 3, more (all free!)
Auto Dark Mode - Switches with system preference
Zero Backend - Runs entirely in your browser
User-Owned API Keys - Your keys never leave your device
OpenRouter Integration - Access 100+ AI models through one API
Real-Time Streaming - See translations as they're generated
Monospace Design - JetBrains Mono font, clean typography
Lightning Fast - Only 22KB bundle, loads instantly

Quick Start

1. Get an OpenRouter API Key

  1. Visit OpenRouter.ai
  2. Sign up for an account
  3. Generate an API key
  4. Add credits to your account

2. Run Locally

Simply open index.html in any modern browser. That's it!

Or use a local server:

# Python
python -m http.server 8000

# Node.js
npx serve .

# PHP
php -S localhost:8000

Visit http://localhost:8000

3. Deploy to Production

This app is pure static HTML/CSS/JS and works on any static hosting:

Vercel

vercel --prod

Netlify

Drag and drop the folder into app.netlify.com/drop

Cloudflare Pages

npx wrangler pages publish .

GitHub Pages

  1. Push to a GitHub repo
  2. Settings → Pages → Deploy from main branch

Usage

Basic Translation

  1. Enter your OpenRouter API key
  2. Type phonetic Bangla in English letters:
    ami tore onk vlobashi
    kmon acho tumi?
    
  3. Click "Translate →"
  4. Get corrected Bengali:
    আমি তোকে অনেক ভালোবাসি
    কেমন আছো তুমি?
    

Advanced Settings

  • Temperature: Control creativity (0.0 = deterministic, 0.5 = creative)
  • Streaming: Enable/disable real-time output
  • Safety Filter: Toggle content filtering

Supported Models

Free Models (Default):

  • arcee-ai/trinity-large-preview - Trinity Large 400B (DEFAULT)
  • upstage/solar-pro-3 - Solar Pro 3 102B
  • liquid/lfm-2.5-1.2b-thinking - LFM 1.2B Thinking
  • liquid/lfm-2.5-1.2b-instruct - LFM 1.2B Instruct
  • google/gemini-2.0-flash-exp:free - Gemini 2.0 Flash

Paid Models:

  • anthropic/claude-3.5-sonnet - Claude 3.5 Sonnet
  • openai/gpt-4o - GPT-4o

You can manually enter any OpenRouter model ID in custom mode.

Architecture

User Browser
    ↓
OpenRouter API (https://openrouter.ai/api/v1)
    ↓
[Claude / GPT / Gemini / 100+ other models]

No proprietary backend. No data collection. No tracking.

Security

⚠️ Important: Client-side apps cannot fully protect API keys.

Mitigation:

  • Keys stored in localStorage (device-only)
  • Never sent to any server except OpenRouter
  • Set spending limits on your OpenRouter account
  • Use disposable keys for public demos

Performance

  • First token: < 1.2s (with streaming)
  • Full translation: < 4s average
  • Bundle size: ~22KB uncompressed, ~8KB gzipped
  • Works offline after first load (with cached SDK)

Browser Support

  • Chrome/Edge: ✅ Full support
  • Firefox: ✅ Full support
  • Safari: ✅ Full support (iOS 14+)
  • Opera: ✅ Full support

Requires: ES6 modules, Fetch API, localStorage

Customization

Change System Prompt

Edit SYSTEM_PROMPT in app.js:

const SYSTEM_PROMPT = `Your custom instructions here...`;

Adjust Safety Filters

Edit UNSAFE_PATTERNS in app.js:

const UNSAFE_PATTERNS = [
    /your-regex-here/i,
];

Modify Styling

Edit styles.css - all styles use CSS variables for easy theming:

:root {
    --primary: #2563eb;
    --secondary: #64748b;
    /* ... */
}

Cost Estimation

Typical usage:

  • Short message (50 chars): ~$0.0001
  • Paragraph (500 chars): ~$0.001
  • Long text (5000 chars): ~$0.01

Actual costs vary by model. Claude Sonnet is recommended for quality/cost balance.

Troubleshooting

"Invalid API Key"

  • Double-check your OpenRouter key
  • Ensure you've added credits to your account
  • Try testing the key in OpenRouter's playground first

"Rate limit exceeded"

  • Wait 60 seconds
  • Switch to a different model
  • Check your OpenRouter dashboard for limits

"No content received"

  • Check your internet connection
  • Try a different model
  • Verify the model ID is correct

Streaming not working

  • Ensure your browser supports ReadableStream
  • Try disabling streaming in Advanced Settings
  • Check browser console for errors

Development

No build step required! Just edit the files:

  • index.html - Structure
  • styles.css - Styling
  • app.js - Logic

Changes are reflected immediately on refresh.

File Structure

takla-bangla/
├── index.html          # Main HTML
├── styles.css          # All styles
├── app.js             # Application logic
└── README.md          # This file

API Reference

OpenRouter Endpoint

POST https://openrouter.ai/api/v1/chat/completions

Headers:
  Content-Type: application/json
  Authorization: Bearer YOUR_KEY

Body:
  {
    "model": "anthropic/claude-3.5-sonnet",
    "messages": [...],
    "temperature": 0.2,
    "stream": true
  }

See OpenRouter docs for full API reference.

License

MIT License - Use freely in any project

Contributing

This is a reference implementation. Fork and customize as needed!

Support

  • OpenRouter Issues: openrouter.ai/docs
  • General Questions: Check browser console for errors

Changelog

v1.0.0 (Current)

  • Initial release
  • Full OpenRouter integration
  • Streaming support
  • Safety filtering
  • Cost estimation

Built with ❤️ for the Bangla-speaking community

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors