BLACKCORTEX GPT CLI
A Conversational Assistant for the Terminal
A terminal-based GPT assistant powered by the OpenAI API, developed by Konijima and now maintained under the BlackCortex organization.
Features
- Persistent memory across sessions with summarization
- Streaming output support
- Command history and logging
- Configurable prompt, model, and temperature
.env-based secure configuration
Installation
Requires Python 3.8+.
Using PyPI
pip install blackcortex-gpt-cli
Using pipx (recommended)
pipx install blackcortex-gpt-cli
From GitHub
pip install git+https://github.com/BlackCortexAgent/blackcortex-gpt-cli.git
# or with pipx
pipx install git+https://github.com/BlackCortexAgent/blackcortex-gpt-cli.git
Development Installation
git clone https://github.com/BlackCortexAgent/blackcortex-gpt-cli.git
cd blackcortex-gpt-cli
make dev
CLI Usage
After installation, use the gpt command globally.
Positional Arguments
| Argument | Description |
|---|---|
input_data |
Input text for one-shot command processing. |
Options
-h, --help: Show this help message and exit
Session
-ch, --clear-history: Clear prompt history-cl, --clear-log: Clear the conversation log-cm, --clear-memory: Clear context memory-l, --log: Display conversation log
Configuration
-e, --env: Open configuration file-k [API_KEY], --set-key [API_KEY]: Set or update OpenAI API key (prompt if value omitted)
Output
-md {true,false}, --markdown {true,false}: Control Markdown formatting in responses ('true' to enable, 'false' to disable)-s {true,false}, --stream {true,false}: Control streaming of assistant responses ('true' to enable, 'false' to disable)
System
-p, --ping: Test OpenAI API connectivity-x, --uninstall: Uninstall the CLI tool-u, --update: Update the CLI tool
General
-v, --version: Show version and exit
Environment Configuration
The GPT CLI loads settings from two locations:
.envfile in the current working directory (if present)~/.gpt-cli/.env(default persistent configuration)
You can configure model behavior, memory, logging, and streaming options.
Sample .env File
OPENAI_API_KEY=your-api-key-here
MODEL=gpt-4o
SUMMARY_MODEL=gpt-3.5-turbo
DEFAULT_PROMPT="You are a helpful assistant."
TEMPERATURE=0.7
MAX_TOKENS=4096
MEMORY_PATH=/custom/path/memory.json
HISTORY_PATH=/custom/path/history
MEMORY_LIMIT=10
MAX_SUMMARY_TOKENS=2048
LOG_FILE=/custom/path/gpt.log
LOG_LEVEL=INFO
LOG_TO_CONSOLE=true
MARKDOWN_ENABLED=true
STREAM_ENABLED=false
Use
gpt --envto open and edit the.envfile in your terminal editor.
Memory System
Memory includes:
- Rolling conversation summary
- The 10 most recent messages
Older messages are summarized once the limit is reached. Use --clear-memory to clear memory.
Troubleshooting
- Missing API key: Check
.envforOPENAI_API_KEY - Client init failed: Verify internet and credentials
- Token limit exceeded: Reduce input size or use summarization
Interactive Example Output
You: Tell me a joke about databases
Assistant: Why did the database break up with the spreadsheet?
Because it couldn't handle the rows of emotions.
────────────────────────────────────────────────────────
Contributing
We welcome all contributions!
Quickstart for Development
git clone https://github.com/BlackCortexAgent/blackcortex-gpt-cli.git
cd blackcortex-gpt-cli
make dev
Run tests:
make test # uses virtualenv (.venv)
# or use 'make ci-release' if running outside .venv
Lint and format:
make lint
make format
Use make check to lint, test, build, and validate in .venv.
Use make ci-release for system Python (e.g., CI/CD pipelines).
See CONTRIBUTING.md for full details.
License
This project is licensed under the MIT License, an OSI-approved open source license that permits the following:
- ✅ Free use for personal, academic, or commercial purposes
- ✅ Permission to modify, merge, publish, and distribute the software
- ✅ Usage with or without attribution (attribution encouraged but not required)
- ✅ No warranty is provided — use at your own risk
Credits
Originally created by Konijima, now maintained by the BlackCortex team.
Metadata
Release files for blackcortex-gpt-cli 1.3.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| blackcortex_gpt_cli-1.3.2.tar.gz | 23.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| blackcortex_gpt_cli-1.3.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 54.4 kB
Release files / blackcortex_gpt_cli-1.3.2.tar.gz
| Download URL | blackcortex_gpt_cli-1.3.2.tar.gz |
|---|---|
| Size | 23.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f282ed53b7518988e8ab545d7c0870830c819c71379399c0873724697b5adbfd
|
|
BLAKE2b-256 checksum How to use checksums |
dbd88b0ccbd15a0440d6cb0111933199b89025a63f5e8809cabb8c78d2955fd4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 21, 2025.
Transparency logRelease files / blackcortex_gpt_cli-1.3.2-py3-none-any.whl
| Download URL | blackcortex_gpt_cli-1.3.2-py3-none-any.whl |
|---|---|
| Size | 30.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7b7f66b7dd807111cd78dc999318c0c066a017bfbfc1fd76594d512506f5b49b
|
|
BLAKE2b-256 checksum How to use checksums |
7b56899d74a689cd84db249755dd29e5d5ff59bbc14858e69c919a8c1deb499c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 21, 2025.
Transparency log