1.0.0 • Published 5 months ago

ai-chat-cli v1.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
5 months ago

AI Chat CLI

A command-line interface and programmatic API for chatting with AI using Google's Gemini model.

Installation

npm install ai-chat-cli

Setup

You'll need a Gemini API key from Google. Once you have it, you can either:

  1. Create a .env file in your project root:
GEMINI_API_KEY=your_api_key_here
  1. Or set it as an environment variable:
export GEMINI_API_KEY=your_api_key_here

CLI Usage

Interactive Chat Session

ai-chat chat

Ask a Single Question

ai-chat ask "What is the capital of France?"

Programmatic Usage

import { AIService } from 'ai-chat-cli';

const aiService = new AIService('your_api_key_here');

// Single question
const response = await aiService.chat('What is the capital of France?');
console.log(response);

// Interactive chat session
const chatSession = await aiService.startChat();
const response1 = await chatSession.sendMessage('Hello!');
const response2 = await chatSession.sendMessage('How are you?');

Features

  • Interactive chat sessions with memory
  • Single question mode
  • Beautiful CLI interface with loading spinners
  • Easy-to-use programmatic API
  • TypeScript support
  • Built on Google's Gemini AI model

License

ISC