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

@osdk/aip-core

v0.2.0

Published

Core building blocks for the AIP SDK: streaming chat completions, tool calling, and chat transports backed by the Foundry Language Model Service

Readme

@osdk/aip-core

Core building blocks for AIP applications backed by the Foundry Language Model Service (LMS). Provides streaming chat completions, tool calling, and an AI SDK adapter.

Installation

pnpm add @osdk/aip-core

Peer dependencies:

pnpm add @osdk/client @osdk/language-models

Native API

foundryModel

Creates a language model handle for Foundry LMS.

import { foundryModel } from "@osdk/aip-core";

const model = foundryModel({
  client, // PlatformClient from @osdk/client
  model: "gpt-4o", // LMS model API name or a ModelIdentifier
});

The model parameter accepts either a string (LMS API name like "gpt-4o") or a structured identifier:

// Built-in LMS model
{ type: "lmsModel", apiName: "gpt-4o" }

// Customer-registered model
{ type: "registeredModel", registeredModelRid: "ri.language-model-service..." }

generateText

Performs a single chat completion and returns the full result.

import { foundryModel, generateText } from "@osdk/aip-core";

const model = foundryModel({ client, model: "gpt-4o" });

const result = await generateText({
  model,
  prompt: "Summarize the key points of this document.",
});

console.log(result.text);
console.log(result.usage); // { inputTokens, outputTokens, totalTokens, ... }

With system instructions

const result = await generateText({
  model,
  system: "You are a helpful assistant that responds concisely.",
  messages: [
    { role: "user", content: "What is TypeScript?" },
  ],
});

With tool calling

const result = await generateText({
  model,
  prompt: "What's the weather in London?",
  tools: {
    getWeather: {
      description: "Get the current weather for a location",
      inputSchema: {
        type: "object",
        properties: {
          location: { type: "string" },
        },
        required: ["location"],
      },
    },
  },
  toolChoice: "auto",
});

for (const call of result.toolCalls) {
  console.log(call.toolName, call.input);
}

Callbacks

const result = await generateText({
  model,
  prompt: "Hello",
  onStepFinish: (step) => {
    console.log("Step finished:", step.finishReason);
  },
  onFinish: (event) => {
    console.log("Total usage:", event.totalUsage);
  },
});

Sampling parameters

| Parameter | Description | | ------------------ | -------------------------------- | | maxOutputTokens | Maximum tokens to generate | | temperature | Randomness (0 = deterministic) | | topP | Nucleus sampling threshold | | presencePenalty | Penalize repeated topics | | frequencyPenalty | Penalize repeated tokens | | stopSequences | Stop generation at these strings | | seed | Deterministic sampling seed |

AI SDK Provider

@osdk/aip-core ships a custom provider for the AI SDK, allowing you to use Foundry LMS models with generateText, streamText, and other AI SDK functions.

Additional dependencies

pnpm add ai @ai-sdk/provider

Usage

import { createFoundryAI } from "@osdk/aip-core/ai-sdk";
import { generateText } from "ai";

const foundryAI = createFoundryAI({ client });

const { text } = await generateText({
  model: foundryAI("gpt-4o"),
  prompt: "Hello, world",
});

Streaming

import { createFoundryAI } from "@osdk/aip-core/ai-sdk";
import { streamText } from "ai";

const foundryAI = createFoundryAI({ client });

const result = streamText({
  model: foundryAI("gpt-4o"),
  prompt: "Write a poem about TypeScript.",
});

for await (const chunk of result.textStream) {
  process.stdout.write(chunk);
}

Registered models

const model = foundryAI({
  type: "registeredModel",
  registeredModelRid: "ri.language-model-service...",
});

Tool calling with AI SDK

import { createFoundryAI } from "@osdk/aip-core/ai-sdk";
import { generateText, tool } from "ai";
import { z } from "zod";

const foundryAI = createFoundryAI({ client });

const result = await generateText({
  model: foundryAI("gpt-4o"),
  prompt: "What's the weather in London?",
  tools: {
    getWeather: tool({
      description: "Get the current weather for a location",
      parameters: z.object({ location: z.string() }),
      execute: async ({ location }) => {
        return { temperature: 18, condition: "cloudy" };
      },
    }),
  },
});

v0 Limitations

The current release (v0) has the following limitations. Unsupported options surface as warnings in the result rather than throwing errors.

  • Single-step only — multi-step tool loops (stopWhen, prepareStep) are not yet supported
  • Text content only — image and file parts in messages are ignored with a warning
  • No structured output — JSON response format is not yet wired
  • No topK — the Foundry LMS OpenAI proxy does not accept this parameter

License

Apache-2.0