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

interlify

v1.0.5

Published

Connect your APIs to LLM in minutes

Readme

Interlify

Connect your APIs to LLM in minutes

Installation

Install the Interlify client in your project:

npm install interlify

Use the Interlify client with a few lines of code:


import { OpenAI } from "openai";
import { Interlify } from "Interlify";


const client = new OpenAI();
const MODEL = YOUR_LLM_MODEL;


// You Steps of getting ACCESS_TOKEN_FOR_YOUR_TOOLS
// ...

// Initilize client
const interlify = new Interlify({
    apiKey: YOUR_INTERLIFY_API_KEY,
    projectId: YOUR_INTERLIFY_PROJECT_ID,
    authHeaders: [
        { Authorization: ACCESS_TOKEN_FOR_YOUR_TOOLS }
    ]
});

const chat = async () => {
    // prepare tools
    const tools = await interlify.tools();

    // porivde tools to llm
    const response = await client.chat.completions.create({
        model: MODEL,
        messages: message_list as any,

        tools: tools,
        tool_choice: 'auto',
    });


    const responseMessage = response.choices[0].message;

    const toolCalls = responseMessage.tool_calls;

    if (toolCalls) {

        message_list.push(responseMessage);
        for (const toolCall of toolCalls) {

            // call the tool using interlify
            const functionResponse = await interlify.callTool(toolCall.function);

            message_list.push({
                // @ts-ignore
                tool_call_id: toolCall.id,
                role: 'tool',
                name: toolCall.function.name,
                content: JSON.stringify(functionResponse.data),
            });
        }

        const secondResponse = await client.chat.completions.create({
            model: MODEL,
            messages: message_list as any,
        });

        return secondResponse.choices[0].message.content;
    }

    return responseMessage.content;
}

const message = await chat();

console.log(message)

Explanation

In the above code, Interlify did the following things:

  1. Instantiate the client
const interlify = new Interlify({
    apiKey: YOUR_INTERLIFY_API_KEY,
    projectId: YOUR_INTERLIFY_PROJECT_ID,
    authHeaders: [
        { Authorization: ACCESS_TOKEN_FOR_YOUR_TOOLS }
    ]
});

The ACCESS_TOKEN_FOR_YOUR_TOOLS is the authorization header whole string value that will be used by your service to authorize LLM to access protected resources.

For Bearer token format: Authorization: Bearer <YOUR_TOKEN>

The ACCESS_TOKEN_FOR_YOUR_TOOLS should be "Bearer <YOUR_TOKEN>".

For Basic token format: Authorization: Basic <base64(username:password)>

The ACCESS_TOKEN_FOR_YOUR_TOOLS should be "Basic <YOUR_ENCODED_CREDENTIALS>".

If your API does not require token, you can remove the authHeaders, so the code would be:

const interlify = new Interlify({
    apiKey: YOUR_INTERLIFY_API_KEY,
    projectId: YOUR_INTERLIFY_PROJECT_ID
});
  1. Prepare the tools
const tools = await interlify.tools();
  1. Provide tools to LLM
    const response = await client.chat.completions.create({
        model: MODEL,
        messages: message_list as any,
        //@ts-ignore
        tools: tools,
        tool_choice: 'auto',
    });
  1. Call the tool
const functionResponse = await interlify.callTool(toolCall.function);

Work with Vercel AI SDK

Vercel AI SDK is the TypeScript toolkit designed to help developers build AI-powered applications and agents with React, Next.js, Vue, Svelte, Node.js, and more.

Interlify now support Vercel AI for tools calling. Now you can easily integrate interlify in your Next.js project with Vercel AI.

To start, install Vercel AI, Vercel AI Groq client, dotenv, and interlify

npm install @ai-sdk/groq ai dotenv interlify

Then create a .env file set these variables:

API_KEY = <YOUR_GROQ_API_KEY>
INTERLIFY_API_KEY = <INTERLIFY_API_KEY>
PROJECT_ID = <INTERLIFY_PROJECT_ID>
ACCESS_TOKEN = <YOUR_API_ACCESS_TOKEN>

The code is as simple as below:


import { Interlify } from "Interlify";
import { config } from 'dotenv';
import { createGroq } from '@ai-sdk/groq';
import { generateText, ToolSet } from 'ai';

config();

const client = createGroq({ apiKey: process.env.API_KEY });

const MODEL = client('llama-3.3-70b-versatile');

// Init the client
const interlify = new Interlify({
    apiKey: process.env.INTERLIFY_API_KEY || "",
    projectId: process.env.PROJECT_ID || "",
    authHeaders: [
        { Authorization: `Bearer ${process.env.ACCESS_TOKEN}` }
    ]
});

// Get tools for Vercel AI
const tools = await interlify.aiTools() as ToolSet;

const history = [
    { 
        role: "system", 
        content: "You are online shoes shop customer service. You help customer on equries."
      },{ 
    role: "user", 
    content: "what shoes do you have?"
  }]

const { text, toolResults } = await generateText({
    model: MODEL,
    // Pass tools to LLM
    tools: tools,
    messages: history
});

console.log("text: ", text);
console.log("toolResults");
console.log(JSON.stringify(toolResults));

That's it!

GL & HF!