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

ads4gpts-vercelai

v0.1.5

Published

Ads for AI applications. Enabling the Freemium model for the AI era.

Downloads

11

Readme

ADS4GPTs Vercel AI SDK Toolkit

This is the Vercel AI SDK toolkit for ADS4GPTs.

An npm package that integrates ADS4GPTs functionalities into applications built with Vercel AI SDK, allowing for seamless retrieval of relevant advertisements based on contextual input.


Table of Contents


Introduction

ADS4GPTs Vercel AI SDK Toolkit is an npm package designed to seamlessly incorporate ADS4GPTs functionalities into your Vercel AI SDK based applications. It provides tools and utilities to retrieve contextually relevant advertisements, leveraging the power of Vercel AI SDK.

Whether you're building a chatbot or an Gen AI weather app and you want to monetize and grow through Ads, this package offers a robust and production-ready solution.

Show Your Support

If you find our ADS4GPTs project helpful, please give it a star ⭐️

GitHub Stars


Features

  • Easy Integration:
    Quickly integrate ad retrieval capabilities into your Vercel AI SDK-driven applications.
  • Contextual Ad Retrieval:
    Fetch relevant ads based on the provided context to enhance user engagement.
  • Flexible and Extensible:
    Options to use each tool standalone or the whole toolkit for added flexibility
  • Production-Ready:
    Clear error handling, retry logic, and environment-based configuration for a robust production setup.
  • Privacy-First User data are provided not mined. You control what is being sent over.

Installation

Install the package from npm:

npm install ads4gpts-vercelai

From Source

Alternatively, you can install the package from source:

  1. Clone the repository:
git clone https://github.com/ADS4GPTs/ads4gpts.git
  1. Navigate to the root folder of your app where you want to install the package.
  2. Install the package:
npm install path/to/project/ads4gpts/libs/js-sdk/ads4gpts-vercelai

Linking the package from source

To link the package's source with your app's project and reflect changes in real-time, follow these steps:

  1. Clone the repository:
git clone https://github.com/ADS4GPTs/ads4gpts.git
  1. Navigate to the package's directory:
cd ads4gpts/libs/js-sdk/ads4gpts-vercelai
  1. Link the package globally:
npm link
  1. Navigate to the root folder of your app where you want to link the package.
  2. Link the package to your app:
npm link ads4gpts-vercelai

Usage

Prerequisites

  • Node.js 18.0.0+
  • ADS4GPTs API Key
    • Obtain an API key for the ADS4GPTs service at https://ads4gpts.com/contact-us

Environment Variables

The package requires certain environment variables for API authentication:

  • ADS4GPTS_API_KEY: Your ADS4GPTs API key.

Set them in your environment:

export ADS4GPTS_API_KEY='your-ads4gpts-api-key'

Alternatively, you can pass the API keys directly when initializing the toolkit or individual tools or set up a .env file.

Initialization

Import the necessary toolkit class or tools in your Typescript code:

import {
    ADS4GPTsToolkit,
    ADS4GPTsChatTool,
    ADS4GPTsBannerTool,
} from 'ads4gpts-vercelai';

System Prompt Templates

When using the ADS4GPTs Toolkit with Vercel AI SDK, it's essential to include a system prompt that aligns with the ad retrieval functionalities. This ensures the toolkit's tools operate correctly and return contextually relevant advertisements with the desired frequency and in chat integration.

To simplify the process, ADS4GPTs provides ready-to-use prompt templates as starting points. These templates are designed to help you quickly integrate or enhance your app's functionality with ADS4GPTs tools. Available Prompt Templates:

Simply adapt these templates to your application's specific requirements and include them in your system prompt during initialization. Using these prompts ensures optimal ad performance and a seamless user experience.

Examples

Example 1: Using the ADS4GPTs Toolkit

import { ADS4GPTsToolkit} from 'ads4gpts-vercelai';

# Instantiate the toolkit (API key retrieved from environment variable)
const ads_toolkit = ADS4GPTsToolkit()

# Add to your streamText function call
const result = streamText({
        model: openai('gpt-4o'),
        system: systemPrompt,
        messages,
        tools: { ...ads_toolkit.getTools() },
    });

Example 2: Using the tools Directly

import { ADS4GPTsChatTool } from 'ads4gpts-vercelai';

# Instantiate the tool (API key retrieved from environment variable)
const inChatAdsTool = ADS4GPTsChatTool()

# Add to your streamText function call
const result = streamText({
        model: openai('gpt-4o'),
        system: systemPrompt,
        messages,
        tools: { ads4gpts_chat_tool : inChatAdsTool },
    });

Examples for using them in your Vercel AI SDK applications exist in the examples folder of the parent repo.

Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the Repository: Click the "Fork" button at the top right of the repository page.
  2. Clone Your Fork:
git clone [email protected]:ADS4GPTs/ads4gpts.git
  1. Create a Branch:
git checkout -b feature/your-feature-name
  1. Make Changes: Implement your feature or bug fix.
  2. Run Tests: Ensure all tests pass.
npm run test
# Or to automatically rerun tests when files change.
npm run test:watch

Formal tests are still under development.

  1. Commit Changes:
git commit -am 'Add your commit message here'
  1. Push to Your Fork:
git push origin feature/your-feature-name
  1. Open a Pull Request: Navigate to the original repository and click "New pull request".

License

This project is licensed under the License of the ADS4GPTs repository.

Contact

For issues and feature requests, please use the GitHub issues page.