Powered by Pollinations AI

The universal
answer engine.

Maths, science, code, history, grammar and more — solved step-by-step. Free forever. No API key needed.

0/5000
🖼️
Drop an image or click to browse
PNG · JPG · WEBP · Typed text reads best
preview
Starting… 0%
Solution
Contents

Vortex Solver API

A free, key-less, browser-native AI solver for any subject. Drop one <script> tag on your page and you have a full reasoning engine. View on GitHub ↗

Introduction Overview

Vortex Solver is a lightweight JavaScript library that connects to Pollinations AI — a completely free, no-key-required AI API — to solve problems across 10 subject domains. It also bundles Tesseract.js OCR so it can read problems from images.

It runs 100% in the browser. No server, no account, no payment ever needed.

Free forever — Vortex Solver uses Pollinations AI which has no usage limits or API keys. Your users will never hit a paywall.

Installation

Download vortex-core.js from GitHub and place it next to your HTML file.

html
<!-- Step 1: Add the script tag -->
<script src="vortex-core.js"></script>

<!-- Step 2: Use it -->
<script>
  const vortex = new VortexSolver();
</script>

Or clone the full repo which includes the solver + this frontend:

bash
git clone https://github.com/StuffzEZ/Vortex-Solver.git
cd Vortex-Solver
# Open index.html in a browser — no build step needed

Quick Start

javascript
const vortex = new VortexSolver();

// Optional: track progress
vortex.onProgress = (msg, pct) => {
  console.log(`${pct}% — ${msg}`);
};

// Solve from text (auto-detects subject)
const result = await vortex.solve("Solve 3x² − 5x + 2 = 0");
console.log(result.answer);  // "x = 1 or x = 2/3"

// Solve with explicit template
const r2 = await vortex.solve("What caused WWI?", "history");

// Solve from image
const file = document.getElementById("upload").files[0];
const r3 = await vortex.solveFromImage(file, "math");

// Render result into a container
vortex.renderInto(document.getElementById("output"), result);

Methods

Method Arguments Returns Description
solve(text, templateId?) string, string? Promise<Result> Solve a text problem. templateId defaults to "auto".
solveFromImage(blob, templateId?) File|Blob, string? Promise<Result> Runs Tesseract OCR on the image then solves.
renderInto(el, result) HTMLElement, Result void Injects a styled solution card into el.
getTemplates() Object Returns the full template registry object.

Properties: Set vortex.onProgress to a (msg: string, pct: number) => void callback before calling solve. vortex.version returns the semver string.

Result Object

Every solve method returns a Promise resolving to this shape:

{ input: string, // original text (post-OCR if image) reasoning: string, // full step-by-step explanation answer: string, // concise final answer template: string, // template id that was used model: string, // AI model used (e.g. "openai") durationMs:number, // wall-clock solve time in ms error: string|null // null on success }
Error handling: The library never throws. On failure, result.error contains the message and result.answer will be an empty string. Always check result.error !== null.

Templates

Each template provides an optimised system prompt tuned for that subject. Pass the template id as the second argument to solve() or solveFromImage().

Use "auto" to let the library classify the subject automatically via a fast pre-solve AI call. This adds ~1–2 seconds but works across mixed-subject inputs.

javascript
// List all available template ids at runtime
const tpls = vortex.getTemplates();
Object.keys(tpls); // ["auto","math","science","code",...]

// Access template metadata
tpls.math.label;   // "Mathematics"
tpls.math.icon;    // "∑"
tpls.math.color;   // "#34d399"
tpls.math.exampleProblems; // string[]

Progress Events

Set vortex.onProgress before calling solve to receive live stage updates.

javascript
const vortex = new VortexSolver();

vortex.onProgress = (message, percent) => {
  // message: human-readable stage description
  // percent: 0–100 number
  myProgressBar.style.width = percent + "%";
  myStatusLabel.textContent = message;
};

await vortex.solve("What is integration by parts?", "math");
StageApprox %Message
Init2–5%Starting… / Starting OCR…
OCR5–40%Reading image… N%
Template detect~42%Detecting subject…
AI reasoning55–88%Solving with <subject> tutor…
Answer extract90%Extracting answer…
Done100%Done ✓

renderInto()

vortex.renderInto(container, result) injects a self-contained, styled solution card into any DOM element. It injects its own CSS once via a <style> tag with id __vortex_styles__ so it won't conflict with your page styles.

html
<div id="output"></div>

<script>
  const vortex = new VortexSolver();
  const result = await vortex.solve("Explain Newton's 2nd law", "science");
  vortex.renderInto(document.getElementById("output"), result);
</script>

The card displays: template badge, final answer prominently, and the full reasoning in a scrollable mono box.

Full Examples

Minimal page with a text input:

html
<!DOCTYPE html>
<html>
<head><script src="vortex-core.js"></script></head>
<body>
  <textarea id="q" placeholder="Ask anything…"></textarea>
  <button id="go">Solve</button>
  <div id="out"></div>

  <script>
    const v = new VortexSolver();
    const out = document.getElementById("out");

    document.getElementById("go").addEventListener("click", async () => {
      const q = document.getElementById("q").value;
      const result = await v.solve(q);
      v.renderInto(out, result);
    });
  </script>
</body>
</html>

Image upload with template selection:

javascript
const v = new VortexSolver();
v.onProgress = (msg, pct) => updateUI(msg, pct);

const file = document.getElementById("photo").files[0];
const result = await v.solveFromImage(file, "science");

if (result.error) {
  console.error("Solve failed:", result.error);
} else {
  console.log("Answer:", result.answer);
  console.log("Steps:",  result.reasoning);
}

Implementation Guide Tutorial

Follow these steps to embed Vortex Solver into any existing website or web app in under 5 minutes.

Step 1 — Download the library

bash
# Option A: clone the repo
git clone https://github.com/StuffzEZ/Vortex-Solver.git

# Option B: download just the core library
curl -O https://raw.githubusercontent.com/StuffzEZ/Vortex-Solver/main/vortex-core.js

Step 2 — Add to your HTML

Add the script before your closing </body> tag (or in <head> with defer):

html
<script src="vortex-core.js" defer></script>

Step 3 — Instantiate and wire up your UI

javascript
const vortex = new VortexSolver();

// Show a spinner or progress bar as it works
vortex.onProgress = (msg, pct) => {
  progressBar.style.width = pct + "%";
  statusEl.textContent = msg;
};

// Call solve() and use the result however you like
async function onSubmit() {
  const question = myInput.value;
  const template = mySelect.value;   // e.g. "math", "science"

  const result = await vortex.solve(question, template);

  if (result.error) {
    errorEl.textContent = result.error;
    return;
  }

  // Option A: render the built-in card
  vortex.renderInto(outputDiv, result);

  // Option B: use the data yourself
  answerEl.textContent    = result.answer;
  reasoningEl.textContent = result.reasoning;
}

Step 4 — (Optional) Build a template picker

javascript
const templates = vortex.getTemplates();
const select = document.getElementById("tplSelect");

Object.values(templates).forEach(tpl => {
  const opt = document.createElement("option");
  opt.value       = tpl.id;
  opt.textContent = tpl.icon + " " + tpl.label;
  select.appendChild(opt);
});
Tip: The library is fully synchronous to set up — only the solve() calls are async. You can safely call new VortexSolver() at page load.

Limitations & Notes

OCR accuracy: Tesseract works best with clear, high-contrast, typed text. Handwriting and complex diagrams (graphs, geometric figures) may not extract correctly. For handwritten maths, consider prompting the user to type the problem instead.

AI hallucination: Pollinations AI (and all LLMs) can make reasoning errors on complex or ambiguous problems. The "Retry" feature re-runs the solve with an explicit "double-check" instruction which often improves accuracy.

Rate limits: Pollinations AI has no hard rate limits for typical use but may slow on high traffic. The library automatically retries 3 times per model and falls back across 3 models.

Network: Requires internet access to reach Pollinations AI. An offline mode is not currently supported.