Kwazi for developers
For schools, publishers and learning apps

Kwazi tutoring, taught from your sources.

Point Kwazi at your own notes, past papers and web pages. Learners snap or type a question and get grade-appropriate, step-by-step answers and focused lessons that follow your material and South Africa's CAPS curriculum.

Live widget running on a sample answer. Type anything or tap a step's “Break it down”.

How it works

Three steps. Your secret key stays on your server; the browser only ever gets a short-lived session token.

Create a key

Sign in at app.kwazi.kvra.co.za, open Me → Developer API and create a secret key (kwz_sk_…).

Register your sources

Send public https links to PDFs, web pages or text. Kwazi fetches each once and keeps a copy to teach from.

Ask, teach or embed

Call the API for answers and focused lessons, or mint a widget session and drop the chat widget into your page.

Packages

Four small packages with no runtime dependencies, all in one public repository.

Chat widget

npm · kwazi-widget

An animated, mobile-first <kwazi-chat> web component: photo questions, steps one at a time, “break it down”, check-yourself and confetti.

npm install kwazi-widget

<!-- or straight from a CDN -->
<script src="https://cdn.jsdelivr.net/npm/kwazi-widget@0.2/dist/kwazi-widget.js" defer></script>
<kwazi-chat session-endpoint="/api/kwazi-session"></kwazi-chat>

Node.js

npm · kwazi

Typed client for Node 18+ using the built-in fetch.

npm install kwazi

Python

Python 3.9+

Standard-library client for Python 3.9+.

pip install https://github.com/kvra-global/kwazi-sdk/releases/download/v0.2.1/kwazi-0.2.1-py3-none-any.whl

Gradle (Java, Kotlin)

Java 17+

Java 17+ client with no dependencies, for Android back ends and JVM services.

repositories { maven("https://jitpack.io") }
dependencies { implementation("com.github.kvra-global:kwazi-sdk:v0.2.1") }

Quickstart

Register a source, get a focused lesson, and mint a widget session. Set KWAZI_API_KEY first.

import { Kwazi } from "kwazi";

const kwazi = new Kwazi(); // reads KWAZI_API_KEY

const notes = await kwazi.sources.create({
  url: "https://your-school.example/grade-7/fractions.pdf",
  subject: "mathematics",
  grade: 7
});

const lesson = await kwazi.lessons.create({
  grade: 7, subject: "mathematics", topic: "Adding fractions", sourceIds: [notes.id]
});
console.log(lesson.steps.map((step) => step.title), lesson.finalAnswer);

// In your web server: a session for the chat widget
app.post("/api/kwazi-session", async (req, res) => {
  const session = await kwazi.widgetSessions.create({ sourceIds: [notes.id], grade: 7, subject: "mathematics" });
  res.json({ token: session.token });
});

API

Base URL https://api.kwazi.kvra.co.za. Full schema: openapi.json (OpenAPI 3.1, generated from the same contracts the API validates with).

CallAuthWhat it does
POST /v1/sourcessecret keyRegister a public https PDF (up to 6 MB), web page or text file. Kwazi fetches it once; failures are saved with a reason.
GET /v1/sourcessecret keyList your sources (up to 200 per account).
DELETE /v1/sources/{id}secret keyDelete a source and Kwazi's copy of it.
POST /v1/questionssecret keyAsk a typed question and/or attach up to three photos or PDFs, grounded in up to three sources.
POST /v1/lessonssecret keyA focused lesson on one topic: worked example, steps and a practice question.
GET /v1/usagesecret keyYour plan's limits and what this key has used today.
POST /v1/widget/sessionssecret keyMint a widget token (1 minute to 24 hours) that fixes the sources, grade and subject.
POST /v1/widget/questionswidget tokenUsed by the widget; open to any origin, no cookies.

Limits

Limits follow the plan of the account that owns the key. Widget sessions count against their key. Check where you stand any time with GET /v1/usage (kwazi.usage()). Over a limit you get HTTP 429 (or 409 for keys and sources) with a message you can show, and a Retry-After header for per-minute limits.

PlanKeysSourcesRequests a minute per keyQuestions a day per key
Free15105 (the account has 5 free questions in total)
Kwazi Learner3253060
Kwazi Family55030200
Enterprise10200601,000

Identical requests (same question, grade, subject and sources) are answered from a cache for a day, and lessons for a week, so popular lessons come back instantly. The x-kwazi-cache response header says hit or miss. Cached answers still count towards your limits.

Good to know