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

@mmgt-cloud/ai-client

v1.1.0

Published

Provider-neutral TypeScript client for MMGT Cloud AI.

Readme

@mmgt-cloud/ai-client

Provider-neutral browser and backend client for MMGT Cloud AI. It supports OpenAI Responses, Anthropic Messages and an experimental managed Codex App Server connection without shipping any provider SDK to your application.

pnpm add @mmgt-cloud/ai-client
import { AIClient } from "@mmgt-cloud/ai-client";

const ai = new AIClient({
  baseUrl: "https://api.mmgt.cloud/ai",
  appId: import.meta.env.VITE_APP_ID,
  tokenProvider: () => session.accessToken,
});

const response = await ai.generate({
  connectionId: "connection-id-from-catalog",
  model: "model-id-from-catalog",
  input: [
    {
      role: "user",
      content: [{ type: "text", text: "Summarize this release." }],
    },
  ],
});

Use AIAppClient only on trusted backends with AI_APP_API_KEY. Never expose that key in a browser bundle. Model identifiers and reasoning levels are intentionally strings; discover supported values through catalog() rather than hard-coding provider catalogs.

Public API

  • catalog(signal?) returns the enabled models. Each model carries the connection ID required by generation requests.
  • upload(blob, signal?) and deleteFile(fileId, signal?) manage encrypted one-hour input files.
  • generate(request, signal?) performs a stateless non-streaming request.
  • stream(request, signal?) returns AsyncIterable<AIStreamEvent> with normalized text, reasoning-summary, usage, tool and terminal events.
  • runTools(request, registry, options?) executes declared function tools in your application and continues until completion over one sticky WebSocket connection.
  • AIClientError exposes normalized status, code, retryable and provider-safe details.

Streaming and cancellation

const controller = new AbortController();
for await (const event of ai.stream(
  {
    connectionId: "connection-id-from-catalog",
    model: "model-id-from-catalog",
    input: [
      {
        role: "user",
        content: [{ type: "text", text: "Explain the deployment." }],
      },
    ],
  },
  controller.signal,
)) {
  if (event.type === "output.text.delta") process.stdout.write(event.delta);
  if (event.type === "response.error") console.error(event.error);
}
// controller.abort() cancels the provider request and closes the socket.

Files and structured output

const file = await ai.upload(new Blob([report], { type: "text/markdown" }));
try {
  const result = await ai.generate({
    connectionId: "connection-id-from-catalog",
    model: "model-id-from-catalog",
    input: [
      {
        role: "user",
        content: [
          { type: "text", text: "Extract the release owner." },
          { type: "file", fileId: file.id },
        ],
      },
    ],
    outputSchema: {
      type: "object",
      properties: { owner: { type: "string" } },
      required: ["owner"],
      additionalProperties: false,
    },
  });
  console.log(result.structuredOutput);
} finally {
  await ai.deleteFile(file.id);
}

Caller-executed tools

const response = await ai.runTools(
  {
    connectionId: "connection-id-from-catalog",
    model: "model-id-from-catalog",
    input: [
      {
        role: "user",
        content: [{ type: "text", text: "What time is it in Warsaw?" }],
      },
    ],
    tools: [
      {
        name: "get_time",
        description: "Return the current time for an IANA timezone",
        parameters: {
          type: "object",
          properties: { timezone: { type: "string" } },
          required: ["timezone"],
        },
        strict: true,
      },
    ],
  },
  {
    get_time: async (args) => getAuthorizedTime(args),
  },
);

Tool handlers are trusted application code: validate arguments, authorize every side effect and keep the default iteration limit. Requests are not automatically retried or moved to another provider. Uploaded files are limited to ten per request, 25 MiB each and 50 MiB total.

Every request selects an explicitly enabled connectionId and opaque model ID. Reasoning, output limits, structured output and tools are forwarded to that model through its provider adapter; unsupported combinations produce a normalized provider error. Optional systemPrompt is scoped to that request; MMGT Cloud does not persist defaults or profiles.