dbc-gptcli


Namedbc-gptcli JSON
Version 0.21.1 PyPI version JSON
download
home_pageNone
SummaryA CLI tool for talking to the Openai API
upload_time2025-08-11 17:52:45
maintainerNone
docs_urlNone
authorNone
requires_pythonNone
licenseNone
keywords openai gpt cli gptcli terminal chat api
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            ![PyPI](https://img.shields.io/pypi/v/dbc-gptcli?label=PyPI%20version)
![Repo](https://img.shields.io/github/v/tag/deathbychocolate/gptcli?label=Repo%20version)
![Supported Python Versions](https://img.shields.io/pypi/pyversions/dbc-gptcli)
![Supported OS](https://img.shields.io/badge/Supported%20OS-Linux%20%7C%20MacOS%20-blueviolet)
[![PyPI Downloads](https://static.pepy.tech/personalized-badge/dbc-gptcli?period=total&units=international_system&left_color=grey&right_color=brightgreen&left_text=downloads)](https://pepy.tech/projects/dbc-gptcli)
[![PyPI Downloads](https://static.pepy.tech/personalized-badge/dbc-gptcli?period=month&units=international_system&left_color=grey&right_color=brightgreen&left_text=downloads/month)](https://pepy.tech/projects/dbc-gptcli)

# How do I run it?
- Pypi:
    - Open your preferred terminal.
    - Install the project via pypi using `pip install dbc-gptcli`.
    - Run `gptcli [mistral|openai] [chat|se]`.
    - For more info on usage, check the builtin help docs using:
      - `gptcli -h`
      - `gptcli [mistral|openai] [-h|--help]`
      - `gptcli [mistral|openai] [chat|se] [-h|--help]`.
- Docker:
    - Open your preferred terminal.
    - Start docker via the desktop app or running `sudo systemctl start docker`.
    - Pull the docker image with `docker pull deathbychocolate/gptcli:latest`.
    - Start and enter a container with `docker run --rm -it --entrypoint /bin/bash deathbychocolate/gptcli:latest`.
    - Run `gptcli [mistral|openai] [chat|se]` or `python3 gptcli/main.py [mistral|openai] [chat|se]`.

# How do I get an API key?
You need valid API keys to communicate with the AI models.

For OpenAI:
- Create an OpenAI account here: https://chat.openai.com/
- Generate an OpenAI API key here: https://platform.openai.com/api-keys

For Mistral AI:
- Create a Mistral AI account here: https://chat.mistral.ai/chat
- Generate a Mistral AI API key here: https://console.mistral.ai/api-keys

# How does GPTCLI work?
The project uses the OpenAI API to query chat completions. It does so by sending message objects converted to JSON payloads and sent over HTTPS POST requests. For now, GPTCLI is for purely text based LLMs.

GPTCLI facilitates access to 2 LLM providers, Mistral AI and OpenAI. Each provider offers 2 modes to communicate with the LLM of your choosing, `Chat` and `Single-Exchange`:

`Chat` mode allows the user to have a conversation that is similar to ChatGPT by creating a MESSAGE-REPLY thread. This mode will show you output similar to the following:
```text
username@hostname ~/> gptcli openai chat
>>> hi
>>> Hello! How can I assist you today?
>>> /q
username@hostname ~/>
```

`Chat` mode also allows for multiline correspondence. This is useful in cases where you would like to copy and paste small to medium-large text or code samples; though there is no size limit. You may enter and exit this feature by typing and entering `/m` in the prompt. For example, you should see output similar to the following:
```text
username@hostname ~/> gptcli openai chat
>>> /m
... What is the expected output of this code? Be concise.
...
... import json
... payload: dict = {'a': 1, 'b': 2}
... print(json.dumps(payload, indent=4))  # Hit [ESC] followed by [ENTER] here
>>> The output is a pretty-printed JSON string of the dictionary:

{
    "a": 1,
    "b": 2
}

>>> /q
username@hostname ~/>
```

`Chat` mode also allows loading of the last chat session as your current session. For example:
```text
username@hostname ~/> gptcli openai chat --load-last
>>> What is the expected output of this code? Be concise.

import json
payload: dict = {'a': 1, 'b': 2}
print(json.dumps(payload, indent=4))  # Hit [ESC] followed by [ENTER] here
>>> The output is a pretty-printed JSON string of the dictionary:

{
    "a": 1,
    "b": 2
}

>>> Send a message (/? for help)
```

`Chat` mode also allows for in-chat commands. For example:
```text
username@hostname ~/> gptcli openai chat
>>> /?

/?, /h, /help           Show help.
/c, /cls, /clear        Clear screen.
/m, /mult               Enter multiline mode.
/e, /exit, /q, /quit    End program.
↑/↓                     Navigate history.
Enter                   Send message.

>>> Send a message (/? for help)
```

`Single-Exchange` is functionally similar to `Chat`, but it only allows a single exchange of messages to happen (1 sent from client-side, 1 response message from server-side) and then exit. This encourages loading all the context and instructions in one message. It is also more suitable for automating multiple calls to the API with different payloads, and flags. This mode will show you output similar to the following:
```text
username@hostname ~/> gptcli openai se "hello"
Hello! How can I assist you today?
username@hostname ~/>
```

# How is GPTCLI different from other clients?
- GPTCLI does not use any software developed by OpenAI or Mistral AI, except for tokenization (ie tiktoken, and mistral-common).
- GPTCLI prioritizes features that make the CLI useful and easy to use.
- GPTCLI aims to eventually have all the features of its WebApp counterparts in the terminal.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "dbc-gptcli",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "openai, gpt, cli, gptcli, terminal, chat, api",
    "author": null,
    "author_email": "Damian Vonapartis <damianosvon@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/a5/45/ba6e4b35b815cd879cda47f419f7f8a46215eca52e359eefd50497f6b603/dbc_gptcli-0.21.1.tar.gz",
    "platform": null,
    "description": "![PyPI](https://img.shields.io/pypi/v/dbc-gptcli?label=PyPI%20version)\n![Repo](https://img.shields.io/github/v/tag/deathbychocolate/gptcli?label=Repo%20version)\n![Supported Python Versions](https://img.shields.io/pypi/pyversions/dbc-gptcli)\n![Supported OS](https://img.shields.io/badge/Supported%20OS-Linux%20%7C%20MacOS%20-blueviolet)\n[![PyPI Downloads](https://static.pepy.tech/personalized-badge/dbc-gptcli?period=total&units=international_system&left_color=grey&right_color=brightgreen&left_text=downloads)](https://pepy.tech/projects/dbc-gptcli)\n[![PyPI Downloads](https://static.pepy.tech/personalized-badge/dbc-gptcli?period=month&units=international_system&left_color=grey&right_color=brightgreen&left_text=downloads/month)](https://pepy.tech/projects/dbc-gptcli)\n\n# How do I run it?\n- Pypi:\n    - Open your preferred terminal.\n    - Install the project via pypi using `pip install dbc-gptcli`.\n    - Run `gptcli [mistral|openai] [chat|se]`.\n    - For more info on usage, check the builtin help docs using:\n      - `gptcli -h`\n      - `gptcli [mistral|openai] [-h|--help]`\n      - `gptcli [mistral|openai] [chat|se] [-h|--help]`.\n- Docker:\n    - Open your preferred terminal.\n    - Start docker via the desktop app or running `sudo systemctl start docker`.\n    - Pull the docker image with `docker pull deathbychocolate/gptcli:latest`.\n    - Start and enter a container with `docker run --rm -it --entrypoint /bin/bash deathbychocolate/gptcli:latest`.\n    - Run `gptcli [mistral|openai] [chat|se]` or `python3 gptcli/main.py [mistral|openai] [chat|se]`.\n\n# How do I get an API key?\nYou need valid API keys to communicate with the AI models.\n\nFor OpenAI:\n- Create an OpenAI account here: https://chat.openai.com/\n- Generate an OpenAI API key here: https://platform.openai.com/api-keys\n\nFor Mistral AI:\n- Create a Mistral AI account here: https://chat.mistral.ai/chat\n- Generate a Mistral AI API key here: https://console.mistral.ai/api-keys\n\n# How does GPTCLI work?\nThe project uses the OpenAI API to query chat completions. It does so by sending message objects converted to JSON payloads and sent over HTTPS POST requests. For now, GPTCLI is for purely text based LLMs.\n\nGPTCLI facilitates access to 2 LLM providers, Mistral AI and OpenAI. Each provider offers 2 modes to communicate with the LLM of your choosing, `Chat` and `Single-Exchange`:\n\n`Chat` mode allows the user to have a conversation that is similar to ChatGPT by creating a MESSAGE-REPLY thread. This mode will show you output similar to the following:\n```text\nusername@hostname ~/> gptcli openai chat\n>>> hi\n>>> Hello! How can I assist you today?\n>>> /q\nusername@hostname ~/>\n```\n\n`Chat` mode also allows for multiline correspondence. This is useful in cases where you would like to copy and paste small to medium-large text or code samples; though there is no size limit. You may enter and exit this feature by typing and entering `/m` in the prompt. For example, you should see output similar to the following:\n```text\nusername@hostname ~/> gptcli openai chat\n>>> /m\n... What is the expected output of this code? Be concise.\n...\n... import json\n... payload: dict = {'a': 1, 'b': 2}\n... print(json.dumps(payload, indent=4))  # Hit [ESC] followed by [ENTER] here\n>>> The output is a pretty-printed JSON string of the dictionary:\n\n{\n    \"a\": 1,\n    \"b\": 2\n}\n\n>>> /q\nusername@hostname ~/>\n```\n\n`Chat` mode also allows loading of the last chat session as your current session. For example:\n```text\nusername@hostname ~/> gptcli openai chat --load-last\n>>> What is the expected output of this code? Be concise.\n\nimport json\npayload: dict = {'a': 1, 'b': 2}\nprint(json.dumps(payload, indent=4))  # Hit [ESC] followed by [ENTER] here\n>>> The output is a pretty-printed JSON string of the dictionary:\n\n{\n    \"a\": 1,\n    \"b\": 2\n}\n\n>>> Send a message (/? for help)\n```\n\n`Chat` mode also allows for in-chat commands. For example:\n```text\nusername@hostname ~/> gptcli openai chat\n>>> /?\n\n/?, /h, /help           Show help.\n/c, /cls, /clear        Clear screen.\n/m, /mult               Enter multiline mode.\n/e, /exit, /q, /quit    End program.\n\u2191/\u2193                     Navigate history.\nEnter                   Send message.\n\n>>> Send a message (/? for help)\n```\n\n`Single-Exchange` is functionally similar to `Chat`, but it only allows a single exchange of messages to happen (1 sent from client-side, 1 response message from server-side) and then exit. This encourages loading all the context and instructions in one message. It is also more suitable for automating multiple calls to the API with different payloads, and flags. This mode will show you output similar to the following:\n```text\nusername@hostname ~/> gptcli openai se \"hello\"\nHello! How can I assist you today?\nusername@hostname ~/>\n```\n\n# How is GPTCLI different from other clients?\n- GPTCLI does not use any software developed by OpenAI or Mistral AI, except for tokenization (ie tiktoken, and mistral-common).\n- GPTCLI prioritizes features that make the CLI useful and easy to use.\n- GPTCLI aims to eventually have all the features of its WebApp counterparts in the terminal.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A CLI tool for talking to the Openai API",
    "version": "0.21.1",
    "project_urls": {
        "Repository": "https://github.com/deathbychocolate/gptcli"
    },
    "split_keywords": [
        "openai",
        " gpt",
        " cli",
        " gptcli",
        " terminal",
        " chat",
        " api"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "14170c9e433204ebaa17912718fa947aed693995398d76d7bf44f8019f20f4fb",
                "md5": "79fc20a46a91684465f78fdbc31a4794",
                "sha256": "4a07e07ead5eba4db67583337552edbc00f3b4c1dc1af6bdca7c729dc26b30f1"
            },
            "downloads": -1,
            "filename": "dbc_gptcli-0.21.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "79fc20a46a91684465f78fdbc31a4794",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 49927,
            "upload_time": "2025-08-11T17:52:44",
            "upload_time_iso_8601": "2025-08-11T17:52:44.120662Z",
            "url": "https://files.pythonhosted.org/packages/14/17/0c9e433204ebaa17912718fa947aed693995398d76d7bf44f8019f20f4fb/dbc_gptcli-0.21.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "a545ba6e4b35b815cd879cda47f419f7f8a46215eca52e359eefd50497f6b603",
                "md5": "c5a9f775b6235d0798d5636f493981c9",
                "sha256": "16a9f4c8a307a416d8dbc41c93e17d1458bf653aea6acc4fc518bc3eed53e7ee"
            },
            "downloads": -1,
            "filename": "dbc_gptcli-0.21.1.tar.gz",
            "has_sig": false,
            "md5_digest": "c5a9f775b6235d0798d5636f493981c9",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 41987,
            "upload_time": "2025-08-11T17:52:45",
            "upload_time_iso_8601": "2025-08-11T17:52:45.363583Z",
            "url": "https://files.pythonhosted.org/packages/a5/45/ba6e4b35b815cd879cda47f419f7f8a46215eca52e359eefd50497f6b603/dbc_gptcli-0.21.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-11 17:52:45",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "deathbychocolate",
    "github_project": "gptcli",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "lcname": "dbc-gptcli"
}
        
Elapsed time: 2.23541s