A terminal-based automation tool for KlokApp AI chat with session token authentication and a resilient retry mechanism.
- 🔑 Session Token Authentication - Direct login using KlokApp session token
- 📊 Interactive Dashboard - Beautiful terminal UI with
blessed
andblessed-contrib
- 🤖 Automated Prompts - Generate creative prompts using Groq API
- ⏳ Rate Limit Management - Automatic cooldown when limits are reached
- 📌 Point Tracking - Real-time monitoring of inference points
- 🔄 Automatic Retry - Handles network and server errors
- 📡 Stream Verification - Ensures successful message delivery
- 🌐 Proxy Support - Uses user-provided proxy if available, defaults to system IP otherwise
- 📜 Detailed Logging - Comprehensive monitoring and debugging
KlokAI-BOT/
├── package.json # Project dependencies
├── session-token.key # Session token for login (optional, auto-generated)
├── groq-api.key # Groq API key
├── proxies.txt # Proxy configuration (optional)
├── priv.txt # Private keys for auto-authentication
├── info.log # Log file for monitoring
├── index.js # Main entry point
├── config.js # App configuration
└── src/
├── api/ # KlokApp API functions
├── ui/ # UI components
├── services/ # External services
└── utils/ # Utilities
-
Clone the repository:
git clone https://github.com/RPC-Hubs/Klok-BOT.git cd Klok-BOT
-
Install dependencies:
npm install
-
Configure Proxy (optional):
nano proxies.txt
Format:
http://username:password@ip:port
-
Add Groq API Key:
nano groq-api.key
-
(Optional) Add Private Keys for Auto-Login:
nano priv.txt
- Each line should contain a private key
- Used to auto-generate
session-token.key
at startup
-
Run the application:
npm start
-
Open PowerShell and run:
git clone https://github.com/RPC-Hubs/Klok-BOT.git cd Klok-BOT
-
Install dependencies:
npm install
-
Configure Proxy (optional):
- Open
proxies.txt
, add:http://username:password@ip:port
- Open
-
Add Groq API Key:
- Open
groq-api.key
in Notepad and paste your key.
- Open
-
(Optional) Add Private Keys to
priv.txt
-
Start the application:
npm start
Start the app:
npm start
S
- Start automationP
- Pause automationR
- Resume automationA
- Manually switch account (if enabled)L
- Clear log fileI
- Show session & log infoH
- HelpQ
orEsc
- Quit
- Automatic Retry on network/server failures
- Exponential Backoff for rate-limiting
- Authentication Fallback using private keys
- Session Token Cleanup if invalid
Edit config.js
to control automation behavior:
module.exports = {
THREADS: 20, // Parallel execution threads
BASE_URL: "https://api1-pp.klokapp.ai/v1",
GROQ_API_KEY_PATH: "./groq-api.key",
GROQ_MODEL: "llama3-8b-8192",
DEFAULT_HEADERS: {
"content-type": "application/json",
Origin: "https://klokapp.ai",
Referer: "https://klokapp.ai/"
},
REFERRAL_CODE: {
referral_code: "GVJRESB4"
},
MIN_CHAT_DELAY: 3000,
MAX_CHAT_DELAY: 10000,
};
- Lower
THREADS
if facing API rate limits or CPU constraints - Modify
MIN_CHAT_DELAY
/MAX_CHAT_DELAY
to control chat frequency
If no session-token.key
is found at startup:
- The app will attempt to authenticate using
priv.txt
- On success, it will generate a new
session-token.key
automatically - The file is reset on every launch to ensure fresh authentication
Ensure priv.txt
is present with valid private keys to enable this feature.