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

@dj-bot07/ai-chat-cli

v1.0.6

Published

A CLI and programmatic interface for chatting with AI using Gemini

Readme

Gemini CLI Chat Bot

A powerful command-line interface and programmatic API for chatting with AI using Google's Gemini model. Have interactive conversations or get quick answers right from your terminal!

Features

  • 🤖 Interactive chat sessions with memory
  • 💡 Quick single-question mode
  • 🎨 Beautiful CLI interface with loading spinners
  • 📦 Easy-to-use programmatic API
  • 🔧 TypeScript support
  • 🚀 Built on Google's Gemini AI model

Installation

Global Installation (for CLI usage)

npm install -g @dj-bot07/ai-chat-cli

Local Installation (for programmatic usage)

npm install @dj-bot07/ai-chat-cli

Setup

Before using the package, you'll need a Gemini API key from Google. You can get one from the Google AI Studio.

There are two ways to set up your API key:

  1. Create a .env file in your project root:
GEMINI_API_KEY=your_api_key_here
  1. Set it as an environment variable:
# Windows (PowerShell)
$env:GEMINI_API_KEY="your_api_key_here"

# Linux/MacOS
export GEMINI_API_KEY="your_api_key_here"

CLI Usage

Interactive Chat Session

Start an interactive chat session where you can have a conversation with the AI:

gchat chat

In chat mode:

  • Type your messages and press Enter to send
  • Type 'exit' to end the session
  • The chat maintains context of your conversation

Quick Questions

Ask a single question and get an immediate response:

gchat ask "What is the capital of France?"

Programmatic Usage

Basic Usage

import { AIService } from 'gemini-cli-chat-bot-dj';

// Initialize with your API key
const aiService = new AIService('your_api_key_here');

// Ask a single question
try {
  const response = await aiService.chat('What is the capital of France?');
  console.log(response);
} catch (error) {
  console.error('Error:', error.message);
}

Chat Session

import { AIService } from 'gemini-cli-chat-bot-dj';

async function chatExample() {
  const aiService = new AIService('your_api_key_here');
  
  // Start a chat session
  const chatSession = await aiService.startChat();
  
  try {
    // Send multiple messages in the same context
    const response1 = await chatSession.sendMessage('Tell me about Paris.');
    console.log('AI:', response1);
    
    const response2 = await chatSession.sendMessage('What about its famous landmarks?');
    console.log('AI:', response2);
  } catch (error) {
    console.error('Error:', error.message);
  }
}

chatExample();

With Environment Variables

import dotenv from 'dotenv';
import { AIService } from 'gemini-cli-chat-bot-dj';

// Load environment variables from .env file
dotenv.config();

const aiService = new AIService(process.env.GEMINI_API_KEY);

Error Handling

The package includes built-in error handling for common issues:

try {
  const response = await aiService.chat('Your question here');
  console.log(response);
} catch (error) {
  if (error.message.includes('API key')) {
    console.error('Invalid or missing API key');
  } else {
    console.error('An error occurred:', error.message);
  }
}

TypeScript Support

The package is written in TypeScript and includes type definitions. You get full type support out of the box:

import { AIService } from 'gemini-cli-chat-bot-dj';

const aiService = new AIService(process.env.GEMINI_API_KEY!);

interface ChatResponse {
  text: string;
  timestamp: Date;
}

async function getResponse(): Promise<ChatResponse> {
  const response = await aiService.chat('Hello!');
  return {
    text: response,
    timestamp: new Date()
  };
}

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

ISC

Support

If you encounter any issues or have questions, please file an issue on the GitHub repository.