GPT CLI — A conversational assistant with memory, config, and logging features.
This project has been archived.
The maintainers of this project have marked this project as archived. No new releases are expected.
Project description
🧠 GPT CLI Tool with Persistent Memory and Streaming
A terminal-based GPT assistant powered by the OpenAI API, featuring:
- 🔁 Persistent memory across sessions with summarization
- 🌊 Streaming output (optional)
- 🧾 Command history and logging
- 🧠 Customizable prompt and model
- 🔐 Secure
.envconfiguration
📦 Features
- Conversational memory with summarization after 20 messages
- Markdown-formatted input/output in terminal
- Command history with autocompletion
- Optional streaming mode (prints as it's generated)
- Command-line and one-shot mode
- Log file support for auditing
🚀 Installation
Install the GPT CLI via pip or pipx. Requires Python 3.8+.
Using PyPI
pip install konijima-gpt-cli
Using pipx (recommended)
pipx install konijima-gpt-cli
From GitHub (install directly from source)
# Install directly from the GitHub repo to avoid PyPI conflicts
pip install git+https://github.com/Konijima/gpt-cli.git#egg=konijima-gpt-cli
# or with pipx
pipx install git+https://github.com/Konijima/gpt-cli.git#egg=konijima-gpt-cli
Development Installation
git clone https://github.com/Konijima/gpt-cli.git
cd gpt-cli
pip install .
Update
pip install --upgrade konijima-gpt-cli
# or
pipx upgrade konijima-gpt-cli
Uninstallation
pip uninstall konijima-gpt-cli
# or
pipx uninstall konijima-gpt-cli
🛠️ Environment Setup
A .env file is required to store your API key and configuration.
touch ~/.gpt-cli/.env
Sample .env File
OPENAI_API_KEY=your-api-key-here
OPENAI_MODEL=gpt-4o
OPENAI_DEFAULT_PROMPT=You are a helpful CLI assistant.
OPENAI_LOGFILE=~/.gpt.log
OPENAI_TEMPERATURE=0.5
OPENAI_MAX_TOKENS=4096
OPENAI_MAX_SUMMARY_TOKENS=2048
OPENAI_MEMORY_PATH=~/.gpt_memory.json
OPENAI_STREAM_ENABLED=false
🔧 Usage
After installation, you can use the gpt command globally.
Interactive Mode
gpt
You’ll enter a REPL-like interface:
🧠 GPT CLI is ready. Type your question or 'exit' to quit.
One-Shot Mode
gpt "Translate 'hello' to French"
From Pipe Input
echo "Write a haiku about the ocean" | gpt
Reset Memory
gpt --reset
This clears all saved memory and summaries, then exits.
Edit Environment Configuration
gpt --env
Opens your
.envfile in your default terminal editor (e.g.,nano,vim, or set via$EDITOR).
Uninstall
gpt --uninstall
This command will completely remove the GPT CLI, including the .env file and virtual environment under ~/.gpt-cli, as well as the global gpt command from ~/.local/bin.
🔐 Environment Variables (Full Reference)
| Variable | Description | Default |
|---|---|---|
OPENAI_API_KEY |
Required. Your OpenAI API key | — |
OPENAI_MODEL |
Model to use (gpt-4o, gpt-3.5-turbo, etc.) |
gpt-4o |
OPENAI_DEFAULT_PROMPT |
System prompt used at the start of each session | (empty) |
OPENAI_LOGFILE |
File path to log all interactions | ~/.gpt.log |
OPENAI_TEMPERATURE |
Sampling temperature (creativity vs determinism) | 0.5 |
OPENAI_MAX_TOKENS |
Maximum tokens per response | 4096 |
OPENAI_MAX_SUMMARY_TOKENS |
Max tokens when summarizing recent interactions | 2048 |
OPENAI_MEMORY_PATH |
Path to memory file for summary + recent messages | ~/.gpt_memory.json |
OPENAI_STREAM_ENABLED |
Enable streaming output (live typing) | false |
📝 Log Format
If OPENAI_LOGFILE is set, all prompts and responses are saved:
[2025-04-15 15:51:51] Prompt:
Hello there
Response:
Hello there again! What would you like to explore or discuss today?
--------------------------------------------------------------------------------
🧹 Memory
Memory consists of:
- A rolling summary of conversation
- The 10 most recent messages
When 20 messages accumulate, the tool summarizes them into the context summary.
To reset memory:
gpt --reset
❓ Troubleshooting
- ❌ Missing API key: Ensure
OPENAI_API_KEYis set in.env - ❌ Client failed to initialize: Check internet and API credentials
- 💭 Too many tokens: Try a smaller input or enable summarization
🧪 Example Output
You:
Write a joke about servers
GPT:
Why did the server go to therapy?
Because it had too many unresolved requests.
📄 License
MIT License
✨ Credits
Built with ❤️ by Konijima and OpenAI’s GPT models.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file konijima_gpt_cli-1.1.1.tar.gz.
File metadata
- Download URL: konijima_gpt_cli-1.1.1.tar.gz
- Upload date:
- Size: 11.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0a174167317669205ad0afe76341b395d4651e7647fc8ed8e093872dcda4b2d6
|
|
| MD5 |
44740913423d0d12c365937e4e74031a
|
|
| BLAKE2b-256 |
9320459222674440fbad2d63ce18482f8117c62bb8f0e0f7e58fc120de0e71fd
|
Provenance
The following attestation bundles were made for konijima_gpt_cli-1.1.1.tar.gz:
Publisher:
publish.yml on Konijima/gpt-cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
konijima_gpt_cli-1.1.1.tar.gz -
Subject digest:
0a174167317669205ad0afe76341b395d4651e7647fc8ed8e093872dcda4b2d6 - Sigstore transparency entry: 198660978
- Sigstore integration time:
-
Permalink:
Konijima/gpt-cli@5cada53dc9051e8bd14401414c7853c0c5b24738 -
Branch / Tag:
refs/tags/v1.1.1 - Owner: https://github.com/Konijima
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5cada53dc9051e8bd14401414c7853c0c5b24738 -
Trigger Event:
push
-
Statement type:
File details
Details for the file konijima_gpt_cli-1.1.1-py3-none-any.whl.
File metadata
- Download URL: konijima_gpt_cli-1.1.1-py3-none-any.whl
- Upload date:
- Size: 11.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
933138bf1161ec6d93e2f78ede2849c13050c67710b6662e4df54073e938455e
|
|
| MD5 |
97d6ca2f3db3a48dd423b17d126fb28c
|
|
| BLAKE2b-256 |
d31725ff912c32cc6b7bfbf012de2ae79afa021d42e183aef5d1378a2eaf6958
|
Provenance
The following attestation bundles were made for konijima_gpt_cli-1.1.1-py3-none-any.whl:
Publisher:
publish.yml on Konijima/gpt-cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
konijima_gpt_cli-1.1.1-py3-none-any.whl -
Subject digest:
933138bf1161ec6d93e2f78ede2849c13050c67710b6662e4df54073e938455e - Sigstore transparency entry: 198660985
- Sigstore integration time:
-
Permalink:
Konijima/gpt-cli@5cada53dc9051e8bd14401414c7853c0c5b24738 -
Branch / Tag:
refs/tags/v1.1.1 - Owner: https://github.com/Konijima
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5cada53dc9051e8bd14401414c7853c0c5b24738 -
Trigger Event:
push
-
Statement type: