npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@primate-intelligence/sdk

v0.1.1

Published

Official TypeScript SDK for the Primate Vision API (Primate Intelligence). Video scene understanding: upload, analyze, stream.

Readme

@primate-intelligence/sdk

Official TypeScript SDK for the Primate Vision API by Primate Intelligence — video scene understanding: upload a video, ask a question, get a deterministic answer with confidence and clip timestamps.

Status: built in-repo from the OpenAPI spec (GET /v1/openapi.json). Not yet published to npm — install from the repo or via npm pack until the first public release.

Install

npm install @primate-intelligence/sdk

Requires Node 20+.

Quickstart

import Primate from '@primate-intelligence/sdk';

const client = new Primate(); // reads PRIMATE_API_KEY from the environment

// URL ingest → analyze → wait, in three lines
const video = await client.videos.create({ url: 'https://example.com/clip.mp4' });
const analysis = await client.analyses.createAndWait({
  video_id: video.id,
  prompt: 'Is there a person in this video?',
});
console.log(analysis.result?.answer, analysis.result?.confidence);

Get a free test key with no signup:

curl -X POST https://api.primateintelligence.ai/v1/sandbox

Features

  • Typed resources for the full /v1 surface: videos, analyses, streams, client_tokens, models, usage, errors, webhook_endpoints.
  • Automatic retries driven by the error registry retryable flags + Retry-After.
  • Auto idempotency keys (UUIDv4) on all create calls — safe to retry network failures.
  • createAndWait() — create an analysis and block until a terminal state (uses Prefer: wait server-side, then polls).
  • videos.upload() — create + presigned S3 PUT + complete, in one call.
  • Pagination iteratorsfor await (const v of client.videos.iter()) { … }.
  • Webhook verificationverifyWebhook() implements Standard Webhooks with constant-time compare + replay-window checks.
  • connectStream() (browser entrypoint @primate-intelligence/sdk/browser) — full WebRTC streaming handshake against /v1/streams.

Error handling

import Primate, { PrimateError } from '@primate-intelligence/sdk';

try {
  await client.analyses.create({ video_id: 'video_x', prompt: 'hi' });
} catch (err) {
  if (err instanceof PrimateError) {
    console.error(err.code, err.status, err.requestId, err.docsUrl);
    if (err.code === 'insufficient_credits') {
      const usage = await client.usage.retrieve();
      // → prompt the account owner to top up or enable auto-refill
    }
  }
}

Every error carries code, status, request_id, and a docs_url anchor into the error registry. Retryable codes are retried automatically before the error reaches you.

Webhooks

import { verifyWebhookRequest } from '@primate-intelligence/sdk';

app.post('/webhooks/primate', { config: { rawBody: true } }, (req, reply) => {
  verifyWebhookRequest({
    secret: process.env.PRIMATE_WEBHOOK_SECRET!, // whsec_…
    headers: req.headers,
    rawBody: req.rawBody,
  }); // throws on bad signature / stale timestamp
  // dedupe on the webhook-id header — delivery is at-least-once
  reply.code(204).send();
});

Browser streaming

import { connectStream } from '@primate-intelligence/sdk/browser';

// Your server mints { stream, client_token } — see docs/guides/security-model
const session = await connectStream({
  stream,
  clientToken,                       // pvct_… — NEVER a secret key in the browser
  mediaStream: await navigator.mediaDevices.getUserMedia({ video: true }),
  onResult: (r) => render(r.detections),
  onWarning: (remaining) => showCountdown(remaining),
});
// later: session.end();

Configuration

| Option | Env var | Default | |---|---|---| | apiKey | PRIMATE_API_KEY | — (required) | | baseUrl | PRIMATE_BASE_URL | https://api.primateintelligence.ai | | maxRetries | — | 3 | | timeoutMs | — | 60000 |

Regeneration

Types + retry tables are generated from the API's single sources of truth (npm run sdk:artifacts in the repo root). This SDK is structured so a Stainless-generated client can replace the internals without changing the public import surface.