@japro/luma-sdk
v0.1.5
Published
Luma API SDK
Readme
Luma SDK
TypeScript SDK for the Luma agentic platform used by Mentingo.
This SDK wraps Luma's public API for multi-agent draft creation, ingestion, chat, and generated course retrieval.
Installation
pnpm add @japro/luma-sdk
# or
npm install @japro/luma-sdk
# or
yarn add @japro/luma-sdkQuick Start
import { createLumaClient } from "@japro/luma-sdk";
const client = createLumaClient({
baseURL: "https://your-luma-api.example.com",
apiKey: process.env.LUMA_API_KEY,
});Client Options
baseURL?: string- Luma API base URL.apiKey?: string- API key sent asX-API-Key.httpsAgent?: Agent- custom Node.js HTTPS agent.allowInsecureTls?: boolean- iftrue, creates an HTTPS agent withrejectUnauthorized: false(use only in local/dev environments).
Core API
1) Create a draft
const draft = await client.createDraft({
integrationId: "course-123",
draftName: "Cybersecurity Fundamentals",
courseLanguage: "en", // e.g. "pl", "en", etc.
});
console.log(draft.draftId);2) Ingest a file into a draft
const file = new File(["file-content"], "source.txt", { type: "text/plain" });
const ingestResult = await client.ingestDraftFile({
integrationId: "course-123",
file,
});
console.log(ingestResult.success, ingestResult.jobId);3) Chat with the draft context
const response = await client.chat({
integrationId: "course-123",
message: "Build a 5-module beginner learning path",
});
console.log(response.data);4) Read draft artifacts
const status = await client.getDraft({ integrationId: "course-123" });
const files = await client.getDraftFiles({ integrationId: "course-123" });
const messages = await client.getDraftMessages({ integrationId: "course-123" });
const course = await client.getGeneratedCourse({ integrationId: "course-123" });
const assets = await client.getAssets({ integrationId: "course-123" });5) Delete ingested documents
await client.deleteIngestedDocument({
integrationId: "course-123",
documentId: "doc-uuid",
});6) Delete a draft
await client.deleteDraft({ integrationId: "course-123" });HTTP Endpoints
POST /api/public/v1/draftGET /api/public/v1/draft/{integration_id}DELETE /api/public/v1/draft/{integration_id}POST /api/public/v1/draft/ingest/{integration_id}DELETE /api/public/v1/draft/ingest/{integration_id}/{document_id}GET /api/public/v1/draft/files/{integration_id}GET /api/public/v1/draft/messages/{integration_id}GET /api/public/v1/draft/generated-course/{integration_id}POST /api/public/v1/ai/chat/{integration_id}GET /api/public/v1/ai/assets/{integration_id}
Exports
createLumaClient(opts)LumaClient- All SDK types from
src/types.ts
Development
pnpm install
pnpm build
pnpm lintRegenerate API client from OpenAPI schema
pnpm generate:clientThis uses src/api/api-schema-public.json to regenerate src/api/generated-api.ts.
Notes
- The SDK is built with
tsupand ships both ESM and CJS outputs. - API calls are authenticated with the
X-API-Keyheader. chat(...)returns the underlying HTTP response from the generated API client.- Keep API keys out of source control and prefer environment variables.
