Skip to content
项目

关于

GPTX: AI chatbot for natural language conversations

机器学习

这些数字如何统计

可以做什么

  • 💬 - Streamed answers - Chat Completions stream token-by-token into the terminal - no long silent waits
  • 🧠 - Modern chat models - gpt-4o-mini default; any OpenAI chat model via config
  • 🎨 - Premium color theme - Custom violet-gold rich palette with live generation indicators
  • 🛡️ - Error containment - A failed API call reports and returns to the prompt - the loop never crashes out

实测星标增长

24小时
0
7天
0
15天
0
1个月
正在收集历史

各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。

README.md

原文

⃤ G P T X ⃤

ChatGPT in your terminal - one prompt loop, streamed answers, zero web UI.

Python OpenAI Platform Streaming Stars Forks


📋 Table of Contents


🎯 Why GPTX?

Everything you need from ChatGPT fits into one terminal loop: type a question, get the answer, repeat. GPTX is that loop - no browser tabs, no API playground, no framework.

v2.0 modernizes the engine. Built on the OpenAI SDK v1+ Chat Completions API (gpt-4o-mini default), replies stream into the terminal as they generate, wrapped in a premium violet-gold rich theme with per-loop error containment and fail-fast config validation. Setup detects Termux and four Linux package-manager families automatically, and verifies every dependency before claiming success.


🧭 What It Does

# Step What happens
1️⃣ Ask You type a question in the terminal (◆ You ›)
2️⃣ Stream The OpenAI chat model replies, printing token-by-token (◆ GPTX ›)
3️⃣ Loop Ask again, exit / bye when done - Ctrl+C / Ctrl+D also exit cleanly

What this tool is NOT: it is not a group-bot platform, not a reseller frontend, and not a way around OpenAI's usage policies - you are responsible for what you ask.


🚀 Quick Start

git clone https://github.com/MrHacker-X/GPTX.git
cd GPTX
./setup.sh                      # installs deps (Termux / apt / dnf / pacman / apk)
nano config.py                  # or: export OPENAI_API_KEY="sk-..."
python3 gptx.py                 # chat loop starts
🔑 Where do I get an API key?

Create one at platform.openai.com/api-keys - every question is billed to that key, so keep it private.


📦 Installation

Termux (Android)

apt update -y && apt install git -y
git clone https://github.com/MrHacker-X/GPTX.git
cd GPTX
chmod +x setup.sh
./setup.sh

Desktop Linux / macOS

git clone https://github.com/MrHacker-X/GPTX.git
cd GPTX
./setup.sh          # or: pip install -r requirements.txt

Supported Systems

OS Status Notes
📱 Termux (Android) ✅ Fully supported Auto-detected
🐧 Debian / Ubuntu / Kali ✅ Fully supported apt detected automatically
🐧 Fedora / RHEL ✅ Fully supported dnf detected automatically
🐧 Arch / Manjaro ✅ Fully supported pacman detected automatically
🐧 Alpine ✅ Fully supported apk detected automatically
🍎 macOS ✅ Fully supported pip-only path, needs Python preinstalled

💡 The setup script verifies every dependency at the end and tells you exactly what's missing - it will never print "installed successfully" when it isn't.


✨ Features

Feature Description
💬 Streamed answers Chat Completions stream token-by-token into the terminal - no long silent waits
🧠 Modern chat models gpt-4o-mini default; any OpenAI chat model via config
🎨 Premium color theme Custom violet-gold rich palette with live generation indicators
🛡️ Error containment A failed API call reports and returns to the prompt - the loop never crashes out
🩹 Fail-fast validation Missing API key → one clear line at startup, no stack trace
🧹 Clean exits exit, bye, Ctrl+C and Ctrl+D all leave gracefully
🔑 Env-var credentials Key supplied via config.py placeholder or environment variables — a real key never ships in the repo
🪶 Minimal dependencies 2 packages: openai, rich

⌨️ Usage

Run the tool, ask anything:

python3 gptx.py
Input Result
any question e.g. explain DNS in one paragraph → streamed GPTX answer
empty input Gentle hint, loop continues
exit or bye Exits with links to the developer's channels
Ctrl+C / Ctrl+D Same clean exit - no traceback

⚙️ Configuration

Everything lives in config.py - and every setting can be overridden from the shell:

Setting Env var Default Description
API key OPENAI_API_KEY (required) Your OpenAI API key (key inside config.py)
Model GPTX_MODEL gpt-4o-mini Any OpenAI chat model
Max tokens GPTX_MAX_TOKENS 1024 Length cap per reply
# either edit config.py, or:
export OPENAI_API_KEY="sk-..."
export GPTX_MODEL="gpt-4o"

🧰 Tech Stack

Layer Technology
Language Python 3.8+
AI openai SDK v1+ — streamed Chat Completions
Terminal UI rich — custom violet/gold theme (truecolor, graceful degradation)
Setup POSIX bash with 5 environment detections

⚠️ Disclaimer

Read this before using GPTX.

  1. You pay per token. Every question is billed to your OpenAI key. Keep the key private and the token cap sane.
  2. OpenAI's policies apply. Your prompts must comply with OpenAI's usage policies - you are responsible for what you ask.
  3. Personal use. GPTX is a personal assistant tool, not a service for third parties.
  4. No warranty. Provided "as is", with no warranty of any kind. The author is not liable for any misuse, cost, or damage resulting from its use.

🤝 Contributing

Contributions are welcome!

# 1. fork it
# 2. create your branch
git checkout -b feature/amazing-feature
# 3. commit
git commit -m "Add amazing feature"
# 4. push
git push origin feature/amazing-feature
# 5. open a Pull Request

Ideas worth exploring: per-session conversation memory, markdown rendering for code-heavy answers, a /clear command, one-shot --ask "..." CLI mode for scripts.


📜 License

Distributed under the MIT License. See the LICENSE file for the full text.


👨‍💻 Developer

Dev MrHacker-X
GitHub github.com/MrHacker-X
Email [email protected]
Website vritrasec.com
Network link.vritrasec.com

⭐ Star the repo if GPTX answered you well ⭐

Built by MrHacker-X - chat power, terminal simplicity.

探索相关项目

加载中…