@motion-intelligence/sdk
v1.1.0
Published
Official Node.js SDK for the Motion Intelligence inference API
Maintainers
Readme
@motion-intelligence/sdk (Node.js / TypeScript)
Official JS/TS SDK for the Motion Intelligence inference API — the Node
counterpart of the motion-intelligence PyPI package. Submit a job against
any deployed or built-in model, poll for the result, and get the produced
artifacts back with full TypeScript types.
Installation
npm install @motion-intelligence/sdkRequirements: Node.js ≥ 18.0.0
Quick start
import { MotionClient } from "@motion-intelligence/sdk";
const client = new MotionClient({ apiKey: process.env.MOTION_API_KEY! });
const { jobId } = await client.submitJob({
modelName: "jay/pose-estimation", // model_code — see listModels()
video: "/path/to/clip.mp4",
params: { fps: 24 }, // any extra fields the model declares
});
const job = await client.waitForJob(jobId);
console.log(job.artifacts); // [{ code, tier, contentType, url }, ...]Or in one call:
const job = await client.process({
modelName: "jay/pose-estimation",
video: "/path/to/clip.mp4",
});API
listModels()— the public catalog, grouped by category.getModelParams(modelCode)— a model's declared input params (name, type, default, constraints).submitJob(options)— submit a job, returns{ jobId, ... }immediately.getJob(jobId)— fetch a single job's current status/result.listJobs(limit?, offset?)— paginated list of your jobs.waitForJob(jobId, options?)— poll untilcompletedorfailed.process(submitOptions, waitOptions?)—submitJob+waitForJobcombined.
Authentication
Pass your API key directly, or set MOTION_API_KEY and read it yourself:
new MotionClient({ apiKey: process.env.MOTION_API_KEY! });Errors
All errors extend MotionError and can be told apart with instanceof:
MotionAuthError, MotionNotFoundError, MotionRateLimitError,
MotionServerError, MotionAPIError (generic 4xx), MotionJobFailedError,
MotionTimeoutError.
License
MIT
