Skip to content

A lightweight AI chatbot in C, using cURL to fetch responses from Groq API (Llama 3.3-70B). It showcases HTTP requests in C and real-time AI interactions in a simple, efficient terminal chatbot with plain-text responses. πŸš€

License

Notifications You must be signed in to change notification settings

subhadeeproy3902/AI-Terminal-Bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

14 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🧠 AI Chatbot in C using Groq API

πŸš€ A lightweight and efficient AI chatbot built in C, leveraging cURL to interact with the Groq API for AI-generated responses. This project explores AI development in a low-level programming environment, integrating real-time conversation capabilities into a terminal-based chatbot.

News πŸ₯³

The AI chatbot in C also known as Termbot has its new home: Termbot Home. A big thanks to Starnix Cloud and Ayush Ghosal for providing the deployment.

To use it:

  • Username: user
  • Password: user
  • Run termbot in the shell

πŸ“Œ Features

βœ… Groq API Integration – Fetches AI-generated responses dynamically
βœ… cURL for HTTP Requests – Handles API communication seamlessly
βœ… Interactive Chat Interface – Smooth user experience in the terminal
βœ… Optimized String Processing – Efficient parsing and formatting of AI responses
βœ… Lightweight & Fast – Built entirely in C for performance

πŸ› οΈ Installation & Usage

1️⃣ Prerequisites

Ensure you have the following installed:

  • GCC Compiler (gcc)
  • Groq API Key (Sign up at Groq API and set GROQ_API_KEY in your environment)
  • cURL Library (libcurl)

To install libcurl:

# Ubuntu/Debian
sudo apt update && sudo apt install libcurl4-openssl-dev

# Fedora
sudo dnf install libcurl-devel

# Arch Linux
sudo pacman -S curl

# macOS (Homebrew)
brew install curl

For Windows:

  1. Download libcurl from https://curl.se/windows/.
  2. Extract and add the include and lib paths to your MinGW compiler.

alt text

2️⃣ Clone the Repository

git https://github.com/subhadeeproy3902/AI-Terminal-Bot.git
cd AI-Terminal-Bot

3️⃣ Set Up API Key

export GROQ_API_KEY="your_api_key_here"

For Windows (PowerShell):

$env:GROQ_API_KEY="your_api_key_here"

4️⃣ Compile the Chatbot

gcc chatbot.c -o c.out -lcurl

5️⃣ Run the Chatbot

./c.out

Start chatting! Type exit to quit.

πŸ”₯ How It Works

  1. User Input: The user types a message in the terminal.
  2. API Request: The chatbot sends the message to the Groq API using cURL.
  3. AI Response: The API processes the request and returns a response.
  4. Display: The chatbot extracts the response and prints it in a formatted way.

πŸ’‘ The bot is designed to be direct, professional, and does not use markdown in responses.

πŸ“œ License

This project is open-source under the MIT License. Feel free to use, modify, and distribute it as needed.


If you like this project, consider giving it a ⭐ on GitHub!


πŸš€ Explore AI development beyond web apps! Build intelligent CLI tools in C! πŸ”₯

About

A lightweight AI chatbot in C, using cURL to fetch responses from Groq API (Llama 3.3-70B). It showcases HTTP requests in C and real-time AI interactions in a simple, efficient terminal chatbot with plain-text responses. πŸš€

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages