Every official ALOC client library is generated directly from our canonical OpenAPI 3.1 specification and published automatically on every contract release. Whether you are building a FastAPI backend, wiring a LangChain Socratic tutor, or shipping a Next.js assessment platform, you get full IDE autocompletion across L1 questions, L2 curriculum metadata, L3 step-by-step explanations, and L4 vector similarity without writing HTTP boilerplate.
aloc-sdk)Designed for Python 3.9+ backends (FastAPI, Django, Flask), LangChain and LlamaIndex educational agents, Jupyter notebooks, and psychometric research pipelines. Every response deserializes into validated Pydantic v2 models while attaching your X-API-Key automatically through AlocClient.
pip install aloc-sdk # or with uv / poetry uv add aloc-sdk
Initialize AlocClient with your key directly, or omit api_key so the client reads ALOC_API_KEY from your environment. By default, every query returns verified historical past questions unless you explicitly opt into synthetic or all provenance.
from aloc_sdk import AlocClient, GenerateAssessmentRequest
# Reads ALOC_API_KEY automatically when api_key is omitted
client = AlocClient(api_key="aloc_live_...")
# 1. L1 + L2: Query curriculum-mapped questions (1–3 credits)
questions = client.questions.list_questions(
subject="mathematics",
exam_type="jamb",
year=2022,
limit=10,
)
for item in questions.data:
print(item.text, "->", item.correct_answer, "| Topic:", item.metadata.topic)
# 2. Assessments: Assemble a syllabus-balanced 40-question paper (5 credits)
paper = client.assessments.generate_assessment(
generate_assessment_request=GenerateAssessmentRequest(
subject="mathematics",
examType="jamb",
preset="jamb_standard_40",
seed="mock_cohort_2026_a",
shuffleOptions=True,
)
)
# 3. L3: Fetch step-by-step worked solution & common mistakes (10 credits, Developer+)
worked = client.explanations.explain_question(id=questions.data[0].id)
print(worked.data.explanation)
# 4. L4: Retrieve conceptually similar questions via pgvector (10 credits, Growth+)
similar = client.intelligence.find_similar_questions(id=questions.data[0].id, limit=5)@massteck/aloc-sdk)Built on native fetch with zero heavyweight runtime dependencies, our TypeScript client runs identically across Node.js 18+, Next.js Server Actions, Cloudflare Workers, Vercel Edge, and React Native backends.
npm install @massteck/aloc-sdk # or yarn add @massteck/aloc-sdk
import {
AssessmentsApi,
Configuration,
ExplanationsApi,
QuestionsApi,
} from "@massteck/aloc-sdk";
const config = new Configuration({
apiKey: process.env.ALOC_API_KEY || "aloc_live_...",
});
const questionsApi = new QuestionsApi(config);
const assessmentsApi = new AssessmentsApi(config);
const explanationsApi = new ExplanationsApi(config);
// Fetch L1 + L2 enriched questions
const { data, meta } = await questionsApi.listQuestions({
subject: "chemistry",
examType: "waec",
year: 2023,
limit: 10,
});
// Assemble a balanced examination session
const paper = await assessmentsApi.generateAssessment({
generateAssessmentRequest: {
subject: "chemistry",
examType: "waec",
preset: "waec_standard_50",
shuffleOptions: true,
},
});
// Request L3 step-by-step AI explanation
const explanation = await explanationsApi.explainQuestion({
id: data[0].id,
});Both SDKs mirror ALOC's progressive four-layer architecture. Subscription plans govern which layers and per-minute rate limits are unlocked, while universal non-expiring add-on packs extend your credit balance on any tier.
| Layer | Python (`AlocClient`) | TypeScript Class | Credits | Tier |
|---|---|---|---|---|
| L1 | client.questions | QuestionsApi | 1 cr | Free+ |
| L1 | client.assessments | AssessmentsApi | 5 cr | Free+ |
| L2 | client.metadata / subjects | MetadataApi / SubjectsApi | 3 cr | Developer+ |
| L3 | client.explanations | ExplanationsApi | 10 cr | Developer+ |
| L4 | client.intelligence | IntelligenceApi | 10 cr | Growth+ / Scale+ |