Powered Projects

NPM-Youtube Automation

Automate YouTube workflows powered by NPMAI.

View Project
Github Repo

NPM-Edu-AI-Helper

AI assistant for educational support using NPMAI.

View Project
Github Repo

NPM-LEGAL-AI

Legal document automation powered by NPMAI.

View Project
Github Repo

NPM-AutoCode-AI

Code generation and automation using NPMAI.

View Project
Github Repo

NPM Journalist

Complain govt without any fear :- No identity required to complain to any govt official

View Project
Github Repo

NPMAI ChatBot

Voice-powered AI applications via NPMAI.

View Project
Github Repo

NPM News

AI-powered news insights.

With A.I
Visit App
Github Repo
Without A.I
Visit App
Github Repo

NPM-RAG-API-Framework

Develop RAG Agents with all media type including YT Videos in just 5 lines of code and without installing more than one library npmai and without using local resource in FREE and unlimited small scale production services.

Visit Docs
Github Repo

NPM Data AI

Financial analyst powered by NPMAI.

Visit App
Github Repo

NPM Debate A.I

Infinite Debate Arena

Visit App
Github Repo

Chief Developer & Maintainer of npmai Ecosystem

NPMAI on PyPI

Python package for easy LLM integration. 6k+ installations.

6,514+

Install via PyPI | Stats: Pepy.tech

Usage & Code Examples

### Python ###

# Install if not already pip install npmai # Basic usage from npmai import Ollama llm = Ollama( model="llama3.2", temperature=0.5 ) prompts = "Hello, tell me a short summary of NPMAI" result = llm.invoke(prompts) print(result)

### Java ###

import java.net.URI; import java.net.http.*; public class Main { public static void main(String[] args) throws Exception { var client = HttpClient.newHttpClient(); String json = "{\"prompt\": \"Hello world\", \"model\": \"llama3.2\", \"temperature\": 0.3}"; var request = HttpRequest.newBuilder() .uri(URI.create("https://npmai-api.onrender.com/llm")) .header("Content-Type", "application/json") .POST(HttpRequest.BodyPublishers.ofString(json)) .build(); var response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } }

### C++ ###

#include #include #include int main() { CURL* curl = curl_easy_init(); if(curl) { struct curl_slist *headers = NULL; headers = curl_slist_append(headers, "Content-Type: application/json"); nlohmann::json j; j["prompt"] = "Hello world"; j["model"] = "llama3.2"; j["temperature"] = 0.3; std::string request_body = j.dump(); curl_easy_setopt(curl, CURLOPT_URL, "https://npmai-api.onrender.com/llm"); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, request_body.c_str()); curl_easy_perform(curl); curl_easy_cleanup(curl); } return 0; }

### C ###

#include #include int main() { CURL *curl = curl_easy_init(); if(curl) { struct curl_slist *headers = NULL; headers = curl_slist_append(headers, "Content-Type: application/json"); const char *json = "{\"prompt\": \"Hello world\", \"model\": \"llama3.2\", \"temperature\": 0.3}"; curl_easy_setopt(curl, CURLOPT_URL, "https://npmai-api.onrender.com/llm"); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, json); curl_easy_perform(curl); curl_easy_cleanup(curl); } return 0; }

API Access

Use NPMAI without installing the package via our Render API:

https://npm-api.onrender.com/llm

Use NPMAI Huggingface endpoint to use LLMs:

Llama3.2

https://sonuramashish22028704-npmai.hf.space/llm

Examples using different langauges:- Java
import java.net.URI;
import java.net.http.*;

public class HFClient {
public static void main(String[] args) throws Exception {
var client = HttpClient.newHttpClient();
String json = "{\"prompt\": \"Hello world\", \"temperature\": 0.3}";

var request = HttpRequest.newBuilder()
.uri(URI.create("https://sonuramashish22028704-npmai.hf.space/llm"))
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(json))
.build();

var response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
} }

C++ #include #include int main() { CURL* curl = curl_easy_init(); if(curl) { struct curl_slist *headers = NULL; headers = curl_slist_append(headers, "Content-Type: application/json"); const char* data = "{\"prompt\": \"Hello world\", \"temperature\": 0.3}"; curl_easy_setopt(curl, CURLOPT_URL, "https://sonuramashish22028704-npmai.hf.space/llm"); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data); curl_easy_perform(curl); curl_easy_cleanup(curl); } return 0; }
C #include #include int main(void) { CURL *curl = curl_easy_init(); if(curl) { struct curl_slist *headers = NULL; headers = curl_slist_append(headers, "Content-Type: application/json"); curl_easy_setopt(curl, CURLOPT_URL, "https://sonuramashish22028704-npmai.hf.space/llm"); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "{\"prompt\": \"Hello world\", \"temperature\": 0.3}"); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); curl_easy_perform(curl); curl_easy_cleanup(curl); } return 0; }
Java-Script async function callHuggingFace() { const api_url = "https://sonuramashish22028704-npmai.hf.space/llm"; // Direct HF API link const payload = { prompt: "Hello world", temperature: 0.3 }; try { const response = await fetch(api_url, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(payload) }); const data = await response.json(); console.log(data.response); } catch (err) { console.error("Failed:", err); } }

gemma2:9b

https://sonuramashish22028704-vicuna7b.hf.space/gemma

Examples using different langauges:- Java import java.net.URI; import java.net.http.*; public class HFClient { public static void main(String[] args) throws Exception { var client = HttpClient.newHttpClient(); String json = "{\"prompt\": \"Hello world\", \"temperature\": 0.3}"; var request = HttpRequest.newBuilder() .uri(URI.create("https://sonuramashish22028704-vicuna7b.hf.space/gemma")) .header("Content-Type", "application/json") .POST(HttpRequest.BodyPublishers.ofString(json)) .build(); var response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } }
C++ #include #include int main() { CURL* curl = curl_easy_init(); if(curl) { struct curl_slist *headers = NULL; headers = curl_slist_append(headers, "Content-Type: application/json"); const char* data = "{\"prompt\": \"Hello world\", \"temperature\": 0.3}"; curl_easy_setopt(curl, CURLOPT_URL, "https://sonuramashish22028704-vicuna7b.hf.space/gemma"); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data); curl_easy_perform(curl); curl_easy_cleanup(curl); } return 0; }
C #include #include int main(void) { CURL *curl = curl_easy_init(); if(curl) { struct curl_slist *headers = NULL; headers = curl_slist_append(headers, "Content-Type: application/json"); curl_easy_setopt(curl, CURLOPT_URL, "https://sonuramashish22028704-vicuna7b.hf.space/gemma"); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "{\"prompt\": \"Hello world\", \"temperature\": 0.3}"); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); curl_easy_perform(curl); curl_easy_cleanup(curl); } return 0; }
Java-Script async function callHuggingFace() { const api_url = "https://sonuramashish22028704-vicuna7b.hf.space/gemma"; // Direct HF API link const payload = { prompt: "Hello world", temperature: 0.3 }; try { const response = await fetch(api_url, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(payload) }); const data = await response.json(); console.log(data.response); } catch (err) { console.error("Failed:", err); } }

codellama:7b-instruct

https://sonuramashish22028704-falcon7binstruct.hf.space/codellama

Examples using different langauges:- Java import java.net.URI; import java.net.http.*; public class HFClient { public static void main(String[] args) throws Exception { var client = HttpClient.newHttpClient(); String json = "{\"prompt\": \"Hello world\", \"temperature\": 0.3}"; var request = HttpRequest.newBuilder() .uri(URI.create("https://sonuramashish22028704-falcon7binstruct.hf.space/codellama")) .header("Content-Type", "application/json") .POST(HttpRequest.BodyPublishers.ofString(json)) .build(); var response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } }
C++ #include #include int main() { CURL* curl = curl_easy_init(); if(curl) { struct curl_slist *headers = NULL; headers = curl_slist_append(headers, "Content-Type: application/json"); const char* data = "{\"prompt\": \"Hello world\", \"temperature\": 0.3}"; curl_easy_setopt(curl, CURLOPT_URL, "https://sonuramashish22028704-falcon7binstruct.hf.space/codellama"); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data); curl_easy_perform(curl); curl_easy_cleanup(curl); } return 0; }
C #include #include int main(void) { CURL *curl = curl_easy_init(); if(curl) { struct curl_slist *headers = NULL; headers = curl_slist_append(headers, "Content-Type: application/json"); curl_easy_setopt(curl, CURLOPT_URL, "https://sonuramashish22028704-falcon7binstruct.hf.space/codellama"); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "{\"prompt\": \"Hello world\", \"temperature\": 0.3}"); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); curl_easy_perform(curl); curl_easy_cleanup(curl); } return 0; }
Java-Script async function callHuggingFace() { const api_url = "https://sonuramashish22028704-falcon7binstruct.hf.space/codellama"; // Direct HF API link const payload = { prompt: "Hello world", temperature: 0.3 }; try { const response = await fetch(api_url, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(payload) }); const data = await response.json(); console.log(data.response); } catch (err) { console.error("Failed:", err); } }

mistral:7b

https://sonuramashish22028704-mistral7b.hf.space/llm

Examples using different langauges:- Java import java.net.URI; import java.net.http.*; public class HFClient { public static void main(String[] args) throws Exception { var client = HttpClient.newHttpClient(); String json = "{\"prompt\": \"Hello world\", \"temperature\": 0.3}"; var request = HttpRequest.newBuilder() .uri(URI.create("https://sonuramashish22028704-mistral7b.hf.space/llm")) .header("Content-Type", "application/json") .POST(HttpRequest.BodyPublishers.ofString(json)) .build(); var response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } }
C++ #include #include int main() { CURL* curl = curl_easy_init(); if(curl) { struct curl_slist *headers = NULL; headers = curl_slist_append(headers, "Content-Type: application/json"); const char* data = "{\"prompt\": \"Hello world\", \"temperature\": 0.3}"; curl_easy_setopt(curl, CURLOPT_URL, "https://sonuramashish22028704-mistral7b.hf.space/llm"); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data); curl_easy_perform(curl); curl_easy_cleanup(curl); } return 0; }
C #include #include int main(void) { CURL *curl = curl_easy_init(); if(curl) { struct curl_slist *headers = NULL; headers = curl_slist_append(headers, "Content-Type: application/json"); curl_easy_setopt(curl, CURLOPT_URL, "https://sonuramashish22028704-mistral7b.hf.space/llm"); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "{\"prompt\": \"Hello world\", \"temperature\": 0.3}"); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); curl_easy_perform(curl); curl_easy_cleanup(curl); } return 0; }
Java-Script async function callHuggingFace() { const api_url = "https://sonuramashish22028704-mistral7b.hf.space/llm"; // Direct HF API link const payload = { prompt: "Hello world", temperature: 0.3 }; try { const response = await fetch(api_url, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(payload) }); const data = await response.json(); console.log(data.response); } catch (err) { console.error("Failed:", err); } }

qwen2.5-coder:7b

https://sonuramashish22028704-npmai.hf.space/qwen

Examples using different langauges:- Java import java.net.URI; import java.net.http.*; public class HFClient { public static void main(String[] args) throws Exception { var client = HttpClient.newHttpClient(); String json = "{\"prompt\": \"Hello world\", \"temperature\": 0.3}"; var request = HttpRequest.newBuilder() .uri(URI.create("https://sonuramashish22028704-npmai.hf.space/qwen")) .header("Content-Type", "application/json") .POST(HttpRequest.BodyPublishers.ofString(json)) .build(); var response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } }
C++ #include #include int main() { CURL* curl = curl_easy_init(); if(curl) { struct curl_slist *headers = NULL; headers = curl_slist_append(headers, "Content-Type: application/json"); const char* data = "{\"prompt\": \"Hello world\", \"temperature\": 0.3}"; curl_easy_setopt(curl, CURLOPT_URL, "https://sonuramashish22028704-npmai.hf.space/qwen"); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data); curl_easy_perform(curl); curl_easy_cleanup(curl); } return 0; }
C #include #include int main(void) { CURL *curl = curl_easy_init(); if(curl) { struct curl_slist *headers = NULL; headers = curl_slist_append(headers, "Content-Type: application/json"); curl_easy_setopt(curl, CURLOPT_URL, "https://sonuramashish22028704-npmai.hf.space/qwen"); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "{\"prompt\": \"Hello world\", \"temperature\": 0.3}"); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); curl_easy_perform(curl); curl_easy_cleanup(curl); } return 0; }
Java-Script async function callHuggingFace() { const api_url = "https://sonuramashish22028704-npmai.hf.space/qwen"; // Direct HF API link const payload = { prompt: "Hello world", temperature: 0.3 }; try { const response = await fetch(api_url, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(payload) }); const data = await response.json(); console.log(data.response); } catch (err) { console.error("Failed:", err); } }

phi3:medium

https://sonuramashish22028704-phi3medium.hf.space/llm

Examples using different langauges:- Java import java.net.URI; import java.net.http.*; public class HFClient { public static void main(String[] args) throws Exception { var client = HttpClient.newHttpClient(); String json = "{\"prompt\": \"Hello world\", \"temperature\": 0.3}"; var request = HttpRequest.newBuilder() .uri(URI.create("https://sonuramashish22028704-phi3medium.hf.space/llm")) .header("Content-Type", "application/json") .POST(HttpRequest.BodyPublishers.ofString(json)) .build(); var response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } }
C++ #include #include int main() { CURL* curl = curl_easy_init(); if(curl) { struct curl_slist *headers = NULL; headers = curl_slist_append(headers, "Content-Type: application/json"); const char* data = "{\"prompt\": \"Hello world\", \"temperature\": 0.3}"; curl_easy_setopt(curl, CURLOPT_URL, "https://sonuramashish22028704-phi3medium.hf.space/llm"); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data); curl_easy_perform(curl); curl_easy_cleanup(curl); } return 0; }
C #include #include int main(void) { CURL *curl = curl_easy_init(); if(curl) { struct curl_slist *headers = NULL; headers = curl_slist_append(headers, "Content-Type: application/json"); curl_easy_setopt(curl, CURLOPT_URL, "https://sonuramashish22028704-phi3medium.hf.space/llm"); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "{\"prompt\": \"Hello world\", \"temperature\": 0.3}"); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); curl_easy_perform(curl); curl_easy_cleanup(curl); } return 0; }
Java-Script async function callHuggingFace() { const api_url = "https://sonuramashish22028704-phi3medium.hf.space/llm"; // Direct HF API link const payload = { prompt: "Hello world", temperature: 0.3 }; try { const response = await fetch(api_url, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(payload) }); const data = await response.json(); console.log(data.response); } catch (err) { console.error("Failed:", err); } }

falcon:7b-instruct

https://sonuramashish22028704-falcon7binstruct.hf.space/llm

Examples using different langauges:- Java import java.net.URI; import java.net.http.*; public class HFClient { public static void main(String[] args) throws Exception { var client = HttpClient.newHttpClient(); String json = "{\"prompt\": \"Hello world\", \"temperature\": 0.3}"; var request = HttpRequest.newBuilder() .uri(URI.create("https://sonuramashish22028704-falcon7binstruct.hf.space/llm")) .header("Content-Type", "application/json") .POST(HttpRequest.BodyPublishers.ofString(json)) .build(); var response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } }
C++ #include #include int main() { CURL* curl = curl_easy_init(); if(curl) { struct curl_slist *headers = NULL; headers = curl_slist_append(headers, "Content-Type: application/json"); const char* data = "{\"prompt\": \"Hello world\", \"temperature\": 0.3}"; curl_easy_setopt(curl, CURLOPT_URL, "https://sonuramashish22028704-falcon7binstruct.hf.space/llm"); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data); curl_easy_perform(curl); curl_easy_cleanup(curl); } return 0; }
C #include #include int main(void) { CURL *curl = curl_easy_init(); if(curl) { struct curl_slist *headers = NULL; headers = curl_slist_append(headers, "Content-Type: application/json"); curl_easy_setopt(curl, CURLOPT_URL, "https://sonuramashish22028704-falcon7binstruct.hf.space/llm"); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "{\"prompt\": \"Hello world\", \"temperature\": 0.3}"); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); curl_easy_perform(curl); curl_easy_cleanup(curl); } return 0; }
Java-Script async function callHuggingFace() { const api_url = "https://sonuramashish22028704-falcon7binstruct.hf.space/llm"; // Direct HF API link const payload = { prompt: "Hello world", temperature: 0.3 }; try { const response = await fetch(api_url, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(payload) }); const data = await response.json(); console.log(data.response); } catch (err) { console.error("Failed:", err); } }

maxkb/baichuan2:13b-chat

https://sonuramashish22028704-internlm27b.hf.space/baichuan

Examples using different langauges:- Java import java.net.URI; import java.net.http.*; public class HFClient { public static void main(String[] args) throws Exception { var client = HttpClient.newHttpClient(); String json = "{\"prompt\": \"Hello world\", \"temperature\": 0.3}"; var request = HttpRequest.newBuilder() .uri(URI.create("https://sonuramashish22028704-internlm27b.hf.space/baichuan")) .header("Content-Type", "application/json") .POST(HttpRequest.BodyPublishers.ofString(json)) .build(); var response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } }
C++ #include #include int main() { CURL* curl = curl_easy_init(); if(curl) { struct curl_slist *headers = NULL; headers = curl_slist_append(headers, "Content-Type: application/json"); const char* data = "{\"prompt\": \"Hello world\", \"temperature\": 0.3}"; curl_easy_setopt(curl, CURLOPT_URL, "https://sonuramashish22028704-internlm27b.hf.space/baichuan"); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data); curl_easy_perform(curl); curl_easy_cleanup(curl); } return 0; }
C #include #include int main(void) { CURL *curl = curl_easy_init(); if(curl) { struct curl_slist *headers = NULL; headers = curl_slist_append(headers, "Content-Type: application/json"); curl_easy_setopt(curl, CURLOPT_URL, "https://sonuramashish22028704-internlm27b.hf.space/baichuan"); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "{\"prompt\": \"Hello world\", \"temperature\": 0.3}"); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); curl_easy_perform(curl); curl_easy_cleanup(curl); } return 0; }
Java-Script async function callHuggingFace() { const api_url = "https://sonuramashish22028704-internlm27b.hf.space/baichuan"; // Direct HF API link const payload = { prompt: "Hello world", temperature: 0.3 }; try { const response = await fetch(api_url, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(payload) }); const data = await response.json(); console.log(data.response); } catch (err) { console.error("Failed:", err); } }

internlm2:7b

https://sonuramashish22028704-internlm27b.hf.space/llm

Examples using different langauges:- Java import java.net.URI; import java.net.http.*; public class HFClient { public static void main(String[] args) throws Exception { var client = HttpClient.newHttpClient(); String json = "{\"prompt\": \"Hello world\", \"temperature\": 0.3}"; var request = HttpRequest.newBuilder() .uri(URI.create("https://sonuramashish22028704-internlm27b.hf.space/llm")) .header("Content-Type", "application/json") .POST(HttpRequest.BodyPublishers.ofString(json)) .build(); var response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } }
C++ #include #include int main() { CURL* curl = curl_easy_init(); if(curl) { struct curl_slist *headers = NULL; headers = curl_slist_append(headers, "Content-Type: application/json"); const char* data = "{\"prompt\": \"Hello world\", \"temperature\": 0.3}"; curl_easy_setopt(curl, CURLOPT_URL, "https://sonuramashish22028704-internlm27b.hf.space/llm"); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data); curl_easy_perform(curl); curl_easy_cleanup(curl); } return 0; }
C #include #include int main(void) { CURL *curl = curl_easy_init(); if(curl) { struct curl_slist *headers = NULL; headers = curl_slist_append(headers, "Content-Type: application/json"); curl_easy_setopt(curl, CURLOPT_URL, "https://sonuramashish22028704-internlm27b.hf.space/llm"); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "{\"prompt\": \"Hello world\", \"temperature\": 0.3}"); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); curl_easy_perform(curl); curl_easy_cleanup(curl); } return 0; }
Java-Script async function callHuggingFace() { const api_url = "https://sonuramashish22028704-internlm27b.hf.space/llm"; // Direct HF API link const payload = { prompt: "Hello world", temperature: 0.3 }; try { const response = await fetch(api_url, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(payload) }); const data = await response.json(); console.log(data.response); } catch (err) { console.error("Failed:", err); } }

vicuna:7b

https://sonuramashish22028704-vicuna7b.hf.space/llm

Examples using different langauges:- Java import java.net.URI; import java.net.http.*; public class HFClient { public static void main(String[] args) throws Exception { var client = HttpClient.newHttpClient(); String json = "{\"prompt\": \"Hello world\", \"temperature\": 0.3}"; var request = HttpRequest.newBuilder() .uri(URI.create("https://sonuramashish22028704-vicuna7b.hf.space/llm")) .header("Content-Type", "application/json") .POST(HttpRequest.BodyPublishers.ofString(json)) .build(); var response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } }
C++ #include #include int main() { CURL* curl = curl_easy_init(); if(curl) { struct curl_slist *headers = NULL; headers = curl_slist_append(headers, "Content-Type: application/json"); const char* data = "{\"prompt\": \"Hello world\", \"temperature\": 0.3}"; curl_easy_setopt(curl, CURLOPT_URL, "https://sonuramashish22028704-vicuna7b.hf.space/llm"); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data); curl_easy_perform(curl); curl_easy_cleanup(curl); } return 0; }
C #include #include int main(void) { CURL *curl = curl_easy_init(); if(curl) { struct curl_slist *headers = NULL; headers = curl_slist_append(headers, "Content-Type: application/json"); curl_easy_setopt(curl, CURLOPT_URL, "https://sonuramashish22028704-vicuna7b.hf.space/llm"); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "{\"prompt\": \"Hello world\", \"temperature\": 0.3}"); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); curl_easy_perform(curl); curl_easy_cleanup(curl); } return 0; }
Java-Script async function callHuggingFace() { const api_url = "https://sonuramashish22028704-vicuna7b.hf.space/llm"; // Direct HF API link const payload = { prompt: "Hello world", temperature: 0.3 }; try { const response = await fetch(api_url, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(payload) }); const data = await response.json(); console.log(data.response); } catch (err) { console.error("Failed:", err); } }

NPMAI RAG API FRAMEWORK

https://sonuramashish22028704-npmeduai.hf.space/ingestion

Examples using different languages:-

### Java ###

import java.net.http.*; import java.nio.file.Paths; public Map send() throws Exception { String HF_API = "https://sonuramashish22028704-npmeduai.hf.space/ingestion"; // Using a library like Apache HttpComponents or OkHttp is recommended for Multipart // Below is a conceptual OkHttp implementation OkHttpClient client = new OkHttpClient.Builder() .connectTimeout(600, TimeUnit.SECONDS) .build(); RequestBody requestBody = new MultipartBody.Builder() .setType(MultipartBody.FORM) .addFormDataPart("query", this.query) .addFormDataPart("DB_PATH", this.db_path) .addFormDataPart("temperature", String.valueOf(this.temperature)) .addFormDataPart("model", this.model) .addFormDataPart("file", "filename", RequestBody.create(new File(this.files), MediaType.parse("application/octet-stream"))) .build(); Request request = new Request.Builder().url(HF_API).post(requestBody).build(); try (Response response = client.newCall(request).execute()) { JSONObject json = new JSONObject(response.body().string()); return Map.of("response", json.get("response")); } }

### C++ ###

#include void send() { CURL *curl = curl_easy_init(); if(curl) { struct curl_httppost *formpost = NULL; struct curl_httppost *lastptr = NULL; curl_formadd(&formpost, &lastptr, CURLFORM_COPYNAME, "query", CURLFORM_COPYCONTENTS, query.c_str(), CURLFORM_END); curl_formadd(&formpost, &lastptr, CURLFORM_COPYNAME, "DB_PATH", CURLFORM_COPYCONTENTS, db_path.c_str(), CURLFORM_END); curl_formadd(&formpost, &lastptr, CURLFORM_COPYNAME, "file", CURLFORM_FILE, files.c_str(), CURLFORM_END); // ... add other fields ... curl_easy_setopt(curl, CURLOPT_URL, "https://sonuramashish22028704-npmeduai.hf.space/ingestion"); curl_easy_setopt(curl, CURLOPT_HTTPPOST, formpost); curl_easy_setopt(curl, CURLOPT_TIMEOUT, 600L); CURLcode res = curl_easy_perform(curl); curl_easy_cleanup(curl); curl_formfree(formpost); } }

### C ###

#include #include void send_request(const char* file_path, const char* query) { CURL *curl; CURLcode res; curl_mime *mime; curl_mimepart *part; curl = curl_easy_init(); if(curl) { mime = curl_mime_init(curl); // Text field part = curl_mime_addpart(mime); curl_mime_name(part, "query"); curl_mime_data(part, query, CURL_ZERO_TERMINATED); // File field part = curl_mime_addpart(mime); curl_mime_name(part, "file"); curl_mime_filedata(part, file_path); curl_easy_setopt(curl, CURLOPT_URL, "https://sonuramashish22028704-npmeduai.hf.space/ingestion"); curl_easy_setopt(curl, CURLOPT_MIMEPOST, mime); curl_easy_setopt(curl, CURLOPT_TIMEOUT, 600L); res = curl_easy_perform(curl); curl_easy_cleanup(curl); curl_mime_free(mime); } }

### Java-Script

async function send() { const HF_API = "https://sonuramashish22028704-npmeduai.hf.space"; // 1. Prepare Multipart Data const formData = new FormData(); formData.append("query", this.query); formData.append("DB_PATH", this.db_path); formData.append("temperature", this.temperature); formData.append("model", this.model); // For Node.js, use: formData.append("file", await fs.openAsBlob(this.files)); formData.append("file", this.files); // 2. Setup Timeout (600 seconds) const controller = new AbortController(); const timeoutId = setTimeout(() => controller.abort(), 600000); try { const res = await fetch(HF_API, { method: "POST", body: formData, signal: controller.signal // Note: DO NOT manually set 'Content-Type'; fetch does this automatically for FormData }); clearTimeout(timeoutId); // Clean up timer if (!res.ok) throw new Error(`HTTP error! status: ${res.status}`); const data = await res.json(); return { response: data.response }; } catch (error) { if (error.name === 'AbortError') { return { error: "Request timed out after 600 seconds" }; } return { error: error.message }; } }
Banner
Sonu Kumar

Hi, I'm Sonu Kumar! 🇮🇳🚀

14-year-old tech prodigy & changemaker from Nalanda, Bihar.

From rural school to TEDx, building open source platforms and fixing democracy—one line of code at a time.

🔥 Who Am I?

“Bihar Viral Boy” — Challenged Chief Minister & inspired millions at age 11.

TEDx Speaker (13) — Shared "Zid aur Junoon" journey on the global stage.

Open Source Innovator — Creating tools for education and democracy.

Self-taught Engineer — No formal CS background, just pure grit and internet.

✨ Tech Toolbox

Tech Icons

🌟 Major Projects & Repos

NPM-AutoCode-AI: A self healing PC Automation Agent
NPM-Debate-AI: 4 AI Models Infinite Debate Arena
npmai: Use Ollama without installation and setup,Develop RAG Agent without having load on PC and without writing bunhc of codes 400 lines of code in 5 lines.
NPM-Edu-AI Helper: Free large-file study tool for students.
NPM-Youtube-Automation: Fully automated video upload workflow.
NPM-Journalist: Help in achieving Ideal Democracy and solving people and your own problems with govt with ANNONYMITY
Blockchain Voting: Tamper-proof hardware-secure election system.
NPM Legal AI: Free legal intelligence toolkit.

💫 Achievements

427K+ Facebook Followers.

Allen Career Institute & DDPS School Kota 100% Scholarship.

Supported by Lok Sabha Speaker & MIT/Oxford circles. &By Senior Software,AI Engineer:-Lokesh Chaudhary sir (also a DDPS CS& Robotics Teacher,Mentor and Reasercher)

💬 Social Impact

Building a 100m+ youth movement. Blending rural activism with world-class tech to create ethical, free AI tools for "broke students."

🏗️ Mission & Goals

Democratize education, AI, & civic tech for everyone. Give rural students a global stage and affordable tools. Transform adversity into action.

Stats Streak

🧠 "Rural-Zero to Revolution"

“No matter where you start, you can be the change. I choose code, courage, and kindness. Let's build... together.”