Jasika AI — India's own Tutor/Teacher AI
Jasika AI is an advanced virtual learning tutor and educator from MSM Classes (Maa Saraswati Mentors) and MSMEdu. Built with dynamic region-based prompt adjustment, automatic document scanning, RAG embeddings search, and advanced Workers AI capabilities.
🌍 Context Injected Routing
Worker auto-extracts visitor timezone, region, and language. It injects a real-time clock references and custom educational rules, feeding them as context instructions to the backend LLM seamlessly.
🤖 Smart Auto Router
Exposed at /api/v2/auto, this endpoint runs a lightweight classifier to detect request intent (drawing, translations, general conversation) and maps it dynamically.
🎨 V2 Image Engine
Generate images via Stable Diffusion models. Supports customizable aspect ratios (16:9, 9:16, 1:1, etc.), SVG vector graphics generation, background transparency, and binary/base64 outputs.
📄 Multi-Format File Extractor
Send documents (PDF, CSV, JSON, TXT) directly through the standard chat completions request. The parser processes files at edge speeds using native streams and provides text embeddings for RAG.
About Jasika AI — India's own Tutor/Teacher AI
Developed by MSM Education, Jasika AI is a customized virtual learning agent tailored for Indian classrooms. It is trained to assist students in understanding core school subjects (such as CBSE boards, NCERT/ICSE curriculum, and state syllabi) and extracurricular modules (piano, zumba, coding, dance, drawing).
Operating at the edge via Cloudflare Workers, Jasika AI provides instant answers, processes complex files (extracting text from PDFs and CSVs), and automatically adjusts replies based on the visiting user's region, timezone, and local time. This makes the tutor highly personalized, real-time, and accessible in Hinglish, Hindi, English, Sanskrit, and all major Indian languages.
High-Level Design (HLD) Diagram
Represents the macroscopic request processing pipeline from clients to backend LLM models hosted in FastAPI through Cloudflare AI Gateway.
Low-Level Design (LLD) Sequential Flow
nstrates the step-by-step logic execution for a complete request lifetime within the worker lifecycle.
Classifies intent automatically and routes to chat completions, image generation, translation, sentiment, or entity recognition seamlessly.
Dynamic prompt-enhanced image generation. Supports various aspect ratios, SVG code export, transparency, and base64 payloads.
Streaming chat completion with geolocation injection, real-time timezone adaptation, and supportive educational tutor rules.
Legacy and backward-compatible chat endpoint. Parses attached files (PDF, CSV, JSON, TXT) automatically.
Upload course material or files to KV storage. The content is parsed and indexed immediately for retrieval-augmented workflows.
curl -X POST https://ai.msmclass.in/api/v2/chat/completions \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-H "cf-timezone: America/New_York" \
-H "cf-region: Ohio" \
-H "cf-language: en-IN" \
-d '{
"model": "jasika",
"stream": true,
"messages": [
{
"role": "user",
"content": "Hello Jasika, what is photosynthesis?"
}
]
}'
// JavaScript Fetch Example for Auto Routing
const response = await fetch('https://ai.msmclass.in/api/v2/chat/completions', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json',
'cf-timezone': 'America/New_York',
'cf-region': 'Ohio',
'cf-language': 'en-IN'
},
body: JSON.stringify({
model: 'jasika',
stream: false,
messages: [
{ role: 'user', content: 'Hello Jasika, what is photosynthesis?' }
]
})
});
const data = await response.json();
console.log(data.choices[0].message.content);
import requests
url = "https://ai.msmclass.in/api/v2/chat/completions"
headers = {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json",
"cf-timezone": "America/New_York",
"cf-region": "Ohio",
"cf-language": "en-IN"
}
payload = {
"model": "jasika",
"messages": [
{"role": "user", "content": "Hello Jasika, what is photosynthesis?"}
]
}
response = requests.post(url, json=payload, headers=headers)
print(response.json()['choices'][0]['message']['content'])
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class JasikaClient {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
String jsonPayload = """
{
"model": "jasika",
"stream": false,
"messages": [
{"role": "user", "content": "Hello Jasika, what is photosynthesis?"}
]
}
""";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://ai.msmclass.in/api/v2/chat/completions"))
.header("Authorization", "Bearer YOUR_TOKEN")
.header("Content-Type", "application/json")
.header("cf-timezone", "America/New_York")
.header("cf-region", "Ohio")
.header("cf-language", "en-IN")
.POST(HttpRequest.BodyPublishers.ofString(jsonPayload))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}
package main
import (
"bytes"
"fmt"
"io"
"net/http"
)
func main() {
url := "https://ai.msmclass.in/api/v2/chat/completions"
payload := []byte("{"model": "jasika", "stream": false, "messages": [{"role": "user", "content": "Hello Jasika, what is photosynthesis?"}]}")
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(payload))
req.Header.Set("Authorization", "Bearer YOUR_TOKEN")
req.Header.Set("Content-Type", "application/json")
req.Header.Set("cf-timezone", "America/New_York")
req.Header.Set("cf-region", "Ohio")
req.Header.Set("cf-language", "en-IN")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://ai.msmclass.in/api/v2/chat/completions');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
$payload = [
'model' => 'jasika',
'stream' => false,
'messages' => [
['role' => 'user', 'content' => 'Hello Jasika, what is photosynthesis?']
]
];
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer YOUR_TOKEN',
'Content-Type: application/json',
'cf-timezone: America/New_York',
'cf-region: Ohio',
'cf-language: en-IN'
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
?>
require 'net/http'
require 'uri'
require 'json'
uri = URI.parse("https://ai.msmclass.in/api/v2/chat/completions")
request = Net::HTTP::Post.new(uri)
request["Authorization"] = "Bearer YOUR_TOKEN"
request["Content-Type"] = "application/json"
request["cf-timezone"] = "America/New_York"
request["cf-region"] = "Ohio"
request["cf-language"] = "en-IN"
request.body = JSON.dump({
"model" => "jasika",
"stream" => false,
"messages" => [
{ "role" => "user", "content" => "Hello Jasika, what is photosynthesis?" }
]
})
req_options = {
use_ssl: uri.scheme == "https",
}
response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|
http.request(request)
end
puts response.body
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "Bearer YOUR_TOKEN");
client.DefaultRequestHeaders.Add("cf-timezone", "America/New_York");
client.DefaultRequestHeaders.Add("cf-region", "Ohio");
client.DefaultRequestHeaders.Add("cf-language", "en-IN");
var json = @"{
""model"": ""jasika"",
""stream"": false,
""messages"": [
{""role"": ""user"", ""content"": ""Hello Jasika, what is photosynthesis?""}
]
}";
var content = new StringContent(json, Encoding.UTF8, "application/json");
var response = await client.PostAsync("https://ai.msmclass.in/api/v2/chat/completions", content);
var responseString = await response.Content.ReadAsStringAsync();
Console.WriteLine(responseString);
}
}