Command-line chat client for OpenAI and Azure OpenAI models.
Project description
CommandChat
commandchat provides the occ CLI for chatting with OpenAI or Azure OpenAI models from your terminal.
Features
- Interactive CLI chat with
occ chat - Profile-based configuration for multiple OpenAI / Azure OpenAI accounts
- Prompt template management with built-in and custom prompts
- Prompt selection per command or as a profile default
- Experimental image generation command
Requirements
- Python 3.8+
- A terminal with
pip - An OpenAI-compatible API key or Azure OpenAI configuration
Install
pip3 install commandchat
If you manage multiple Python versions locally:
python3 -m pip install commandchat
Quick start
1. Configure your first profile
occ configure
This opens the interactive configuration flow and writes local settings under ~/.occ/.
2. Start chatting
occ chat "Hello, introduce yourself briefly."
You can also start interactive multiline input:
occ chat
Inside interactive chat, you can use slash commands:
/to open the shortcut command menu/pmp,/p, or/promptto list prompts and switch the active prompt template/mor/modelto list models and switch the active model/qto exit the chat session/helpto show the help panel again
When you switch prompts with /pmp or models with /m, the CLI will ask whether you want to keep the current context or start a fresh chat session with a new session id.
Interactive chat also shows a bottom status bar with the current prompt, model, and session id.
3. Use prompt templates
occ prompt list
occ chat -pt translate "你好世界"
occ chat -pt improve "I wants to go to school yesterday"
4. Work with multiple profiles
occ configure profile -p work
occ configure list
occ chat -p work "Summarize today's priorities"
Common commands
| Command | Description |
|---|---|
occ configure |
Open the interactive configuration menu |
occ configure profile -p <name> |
Create or update a profile |
occ configure list |
List configured profiles |
occ configure delete <name> |
Delete a profile |
occ chat "message" |
Send a one-off message |
occ chat |
Start an interactive chat session |
occ chat -p <profile> -m <model> "message" |
Use a specific profile/model |
occ chat -pt <prompt_key> "message" |
Chat with a predefined prompt |
occ chat + / |
Open the interactive shortcut menu |
occ chat + /pmp / /p / /prompt |
Switch prompt inside interactive chat |
occ chat + /m / /model |
Switch model inside interactive chat |
occ prompt list |
List prompt templates |
occ prompt show <key> |
Show prompt details |
occ prompt add <key> -n <name> -d <desc> -s <prompt> |
Add a custom prompt |
occ image -desc "..." -size m |
Generate images |
Files created locally
~/.occ/config: profile and model configuration~/.occ/prompts.json: custom prompt templates
Packaging and PyPI
This project now uses pyproject.toml as the single source of truth for packaging metadata.
README.mdis configured asproject.readme, so PyPI renders this file on the project page.README-zh.mdis kept for the GitHub repository and Chinese-language documentation.- To update the PyPI project page content, update
README.md, bump the version inpyproject.toml, and publish a new release.
Automatic publishing with GitHub Actions
The repository includes .github/workflows/publish-to-pypi.yml.
On pushes to master or manual runs, it will:
- Check whether the version in
pyproject.tomlchanged - Build the sdist and wheel from
pyproject.toml - Run
twine check dist/* - Publish to PyPI via Trusted Publishing (OIDC)
Because the package metadata points to README.md, each new PyPI release also refreshes the PyPI homepage description.
Manual build
python3 -m pip install build twine
python3 -m build
python3 -m twine check dist/*
Uninstall
pip3 uninstall commandchat
Feedback
xxx.tao.c@gmail.comxoto@outlook.be
License
MIT
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 commandchat-0.0.15.tar.gz.
File metadata
- Download URL: commandchat-0.0.15.tar.gz
- Upload date:
- Size: 22.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a7c9720d72620afdddf301b058d0624678fb951566ec8da4214d044ef0ddae71
|
|
| MD5 |
8add5c615d193f4cdbe26f989b59aa7b
|
|
| BLAKE2b-256 |
e97daf350c8e087f543a088bafa35bfcced05b2568b8ded2354d6c74c3d218f2
|
Provenance
The following attestation bundles were made for commandchat-0.0.15.tar.gz:
Publisher:
publish-to-pypi.yml on cxoto/openai-commandchat
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
commandchat-0.0.15.tar.gz -
Subject digest:
a7c9720d72620afdddf301b058d0624678fb951566ec8da4214d044ef0ddae71 - Sigstore transparency entry: 1252563845
- Sigstore integration time:
-
Permalink:
cxoto/openai-commandchat@3005404d805c5bfaa0e157f028deef0828016c2d -
Branch / Tag:
refs/heads/master - Owner: https://github.com/cxoto
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@3005404d805c5bfaa0e157f028deef0828016c2d -
Trigger Event:
push
-
Statement type:
File details
Details for the file commandchat-0.0.15-py3-none-any.whl.
File metadata
- Download URL: commandchat-0.0.15-py3-none-any.whl
- Upload date:
- Size: 28.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7d126218a1de043c2fdc8d768f3b41224a2d59fe24eaa41c2f94fba30ccc3012
|
|
| MD5 |
94278ace9c22182ca4e245d078348342
|
|
| BLAKE2b-256 |
d95e86d2265e9432b04adceb58bc596bed6cf594df4b223a23019b57b51a049a
|
Provenance
The following attestation bundles were made for commandchat-0.0.15-py3-none-any.whl:
Publisher:
publish-to-pypi.yml on cxoto/openai-commandchat
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
commandchat-0.0.15-py3-none-any.whl -
Subject digest:
7d126218a1de043c2fdc8d768f3b41224a2d59fe24eaa41c2f94fba30ccc3012 - Sigstore transparency entry: 1252563869
- Sigstore integration time:
-
Permalink:
cxoto/openai-commandchat@3005404d805c5bfaa0e157f028deef0828016c2d -
Branch / Tag:
refs/heads/master - Owner: https://github.com/cxoto
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@3005404d805c5bfaa0e157f028deef0828016c2d -
Trigger Event:
push
-
Statement type: