Skip to content

pulsedataengineer/remoteai

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

⚑ RemoteAI SDK

One SDK. Every AI Provider.

A unified wrapper that connects OpenAI, Anthropic Claude, Google Gemini, Groq, Mistral & more β€” with smart auto-routing, cost tracking, and fallback chains. Built by PulseDataEngineer.


πŸš€ Install

npm install remoteai

πŸ”‘ Get Your API Key

Get a free API key (100 req/mo) at β†’ https://pulsedataengineer.com/RemoteAI


πŸ“¦ Quick Start

import RemoteAI from "remoteai";

const ai = new RemoteAI({
  apiKey: "rai_your_key_here",
});

// Simple prompt
const res = await ai.ask("Explain gradient descent in 2 sentences.");
console.log(res.text);
console.log(res.meta);
// β†’ { provider: "groq", model: "llama3-70b", cost: "$0.0002", latency: "118ms" }

πŸ”€ Routing Strategies

// Auto (default) β€” RemoteAI picks the best provider
const auto = await ai.ask("Your prompt", { strategy: "auto" });

// Cheapest available provider
const cheap = await ai.ask("Your prompt", { strategy: "cheapest" });

// Fastest (lowest latency)
const fast = await ai.ask("Your prompt", { strategy: "fastest" });

// Best quality
const best = await ai.ask("Complex analysis...", { strategy: "quality" });

πŸ’¬ Multi-turn Chat

const res = await ai.chat([
  { role: "system",    content: "You are a concise data analyst." },
  { role: "user",      content: "What are the top 3 KPIs for SaaS?" },
]);

console.log(res.text);

πŸ“Š Cost & Session Tracking

await ai.ask("First query...");
await ai.ask("Second query...");
await ai.ask("Third query...");

console.log(ai.sessionCost());    // "$0.0034"
console.log(ai.sessionTokens());  // 1420

console.log(ai.breakdown());
// [
//   { provider: "groq",    calls: 2, tokens: 820, cost: "$0.0007" },
//   { provider: "gemini",  calls: 1, tokens: 600, cost: "$0.0027" }
// ]

ai.resetSession(); // Start fresh tracking

πŸ“ˆ Check Usage & Limits

const usage = await ai.usage();

console.log(usage.plan);               // "starter"
console.log(usage.totalRequests);      // 247
console.log(usage.monthlyLimit);       // 1000
console.log(usage.remainingRequests);  // 753

πŸ’° Pricing

Plan Price Requests/mo Providers
Free $0 100 Groq
Starter $9/mo 1,000 Groq + Gemini
Pro $29/mo Unlimited All 8+ providers

🌐 Supported Providers

  • ⚑ Groq (Llama) β€” fastest, free tier
  • πŸ”΅ Google Gemini Flash / Pro
  • 🟣 Anthropic Claude (Haiku, Sonnet, Opus)
  • 🟒 OpenAI GPT-4o / GPT-4o-mini
  • 🟠 Mistral AI
  • πŸ”΄ Together AI
  • πŸ”· Azure OpenAI
  • 🟑 Cohere

🌍 Use From Any Language (REST API)

The npm package is a JavaScript convenience wrapper. Any language can call RemoteAI directly via the REST API.

🐍 Python / Jupyter Notebook

import requests

response = requests.post(
    "https://pulsedataengineer.com/functions/remoteAIGateway",
    json={
        "action":       "generate",
        "remoteai_key": "rai_your_key_here",
        "prompt":       "Explain gradient descent simply.",
        "strategy":     "auto",   # auto | cheapest | fastest | quality
    }
)

data = response.json()
print(data["text"])   # AI response
print(data["meta"])   # provider, model, cost, latency, tokens saved

🌐 cURL / REST

curl -X POST https://pulsedataengineer.com/functions/remoteAIGateway \
  -H "Content-Type: application/json" \
  -d '{
    "action":       "generate",
    "remoteai_key": "rai_your_key_here",
    "prompt":       "What is RAG in AI?",
    "strategy":     "cheapest"
  }'

🟦 JavaScript (fetch β€” no npm needed)

const response = await fetch("https://pulsedataengineer.com/functions/remoteAIGateway", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    action:       "generate",
    remoteai_key: "rai_your_key_here",
    prompt:       "Summarize this article...",
    strategy:     "fastest",
  })
});

const data = await response.json();
console.log(data.text);
console.log(data.meta);

♦️ R Language

library(httr)
library(jsonlite)

response <- POST(
  "https://pulsedataengineer.com/functions/remoteAIGateway",
  content_type_json(),
  body = toJSON(list(
    action       = "generate",
    remoteai_key = "rai_your_key_here",
    prompt       = "Explain linear regression.",
    strategy     = "auto"
  ), auto_unbox = TRUE)
)

data <- content(response, as = "parsed")
cat(data$text)

πŸ“‘ API Response Format

Every request returns:

{
  "text": "The AI response...",
  "meta": {
    "provider":        "groq",
    "model":           "llama3-70b",
    "latencyMs":       118,
    "inputTokens":     42,
    "outputTokens":    95,
    "estimatedCostUsd": 0.0002
  }
}

πŸ“‹ Available Actions

Action Description
generate Single prompt β†’ AI response
register Get a free API key
usage Check your usage & limits

πŸ“„ License

MIT Β© PulseDataEngineer


Built with ❀️ by the PulseDataEngineer · TechPulse team · info@pulsedataengineer.com

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors