shgpt


Nameshgpt JSON
Version 0.6.2 PyPI version JSON
download
home_pageNone
SummaryChat with LLM in your terminal, be it shell generator, story teller, linux-terminal, etc.
upload_time2025-08-03 08:16:53
maintainerNone
docs_urlNone
authorNone
requires_python>=3.0.0
licenseNone
keywords ai llm shell gpt
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # ShellGPT

[![](https://img.shields.io/pypi/v/shgpt)](https://pypi.org/project/shgpt/)
[![](https://github.com/jiacai2050/my-works/actions/workflows/shellgpt-ci.yml/badge.svg)](https://github.com/jiacai2050/my-works/actions/workflows/shellgpt-ci.yml)
[![](https://github.com/jiacai2050/my-works/actions/workflows/shellgpt-release.yml/badge.svg)](https://github.com/jiacai2050/my-works/actions/workflows/shellgpt-release.yml)

Chat with LLM in your terminal, be it shell generator, story teller, linux-terminal, etc.

# Install

```bash
pip install -U shgpt
```

or if you prefer to use [uvtool](https://docs.astral.sh/uv/concepts/tools/)

```bash
uv tool install shgpt
```

This will install two commands: `sg` and `shellgpt`, which are identical.

After install, use `sg --init` to create required directories(mainly `~/.shellgpt`).

# Usage

ShellGPT has three modes to use:

- Direct mode, `sg [question]` or pipeline like `echo question | sg`.
- REPL mode, `sg -r`, chat with LLM.
- TUI mode, `sg -t`, tailored for infer shell command.

## Model

By default, `shellgpt` uses [Ollama](https://ollama.com/) as its language model backend, requiring installation prior to usage.

Alternatively, one can set up `shellgpt` to utilize [OpenAI compatible](https://developers.cloudflare.com/workers-ai/configuration/open-ai-compatibility/) API endpoints:

```bash
export SHELLGPT_API_URL=https://api.openai.com
export SHELLGPT_API_KEY=<token>
export SHELLGPT_MODEL='gpt-3.5-turbo'

# or Cloudflare Worker AI
export SHELLGPT_API_URL=https://api.cloudflare.com/client/v4/accounts/<account-id>/ai
export SHELLGPT_API_KEY=<token>
export SHELLGPT_MODEL='@cf/meta/llama-3-8b-instruct'

# or GitHub Models
# https://docs.github.com/en/github-models/quickstart
export SHELLGPT_API_URL=https://models.github.ai
export SHELLGPT_MODEL=openai/gpt-4.1
export SHELLGPT_API_KEY=$GITHUB_TOKEN
```

See [conf.py](shellgpt/utils/conf.py) for more configs.

## TUI

There are 3 key bindings to use in TUI:

- `ctrl+j`, Infer answer
- `ctrl+r`, Run command
- `ctrl+y`, Yank command

![TUI screenshot](https://github.com/jiacai2050/shellgpt/raw/main/assets/shellgpt-tui.jpg)

## System contents

There are some built-in [system contents](https://platform.openai.com/docs/guides/text-generation/chat-completions-api) in shellgpt:

- `default`, used for ask general questions
- `typo`, used for correct article typos.
- `slug`, used for generate URL slug.
- `code`, used for ask programming questions
- `shell`, used for infer shell command
- `commit`, used for generate git commit message, like `git diff --staged | sg -s commit`

Users can define their own content in `~/.shellgpt/prompts.toml`

- key being content name and
- value being content body

Or you can just copy [prompts.toml](https://github.com/jiacai2050/my-works/blob/main/shellgpt/prompts.toml) to play with, it's generated from [Awesome ChatGPT Prompts](https://github.com/f/awesome-chatgpt-prompts/blob/main/prompts.csv).

```bash
$ sg -s linux-terminal pwd
/home/user

$ sg -s javascript-console 0.1 + 0.2
0.3

```

Users can share their customized contents in [discussions](https://github.com/jiacai2050/my-works/discussions/3).

# License

[GPL-3.0](https://opensource.org/license/GPL-3.0)

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "shgpt",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.0.0",
    "maintainer_email": null,
    "keywords": "ai, llm, shell, gpt",
    "author": null,
    "author_email": "Jiacai Liu <dev@liujiacai.net>",
    "download_url": "https://files.pythonhosted.org/packages/ea/ed/29d937a0f08e6c94fb93761776b010859552ef5484ff1b8cf66c1319a1bf/shgpt-0.6.2.tar.gz",
    "platform": null,
    "description": "# ShellGPT\n\n[![](https://img.shields.io/pypi/v/shgpt)](https://pypi.org/project/shgpt/)\n[![](https://github.com/jiacai2050/my-works/actions/workflows/shellgpt-ci.yml/badge.svg)](https://github.com/jiacai2050/my-works/actions/workflows/shellgpt-ci.yml)\n[![](https://github.com/jiacai2050/my-works/actions/workflows/shellgpt-release.yml/badge.svg)](https://github.com/jiacai2050/my-works/actions/workflows/shellgpt-release.yml)\n\nChat with LLM in your terminal, be it shell generator, story teller, linux-terminal, etc.\n\n# Install\n\n```bash\npip install -U shgpt\n```\n\nor if you prefer to use [uvtool](https://docs.astral.sh/uv/concepts/tools/)\n\n```bash\nuv tool install shgpt\n```\n\nThis will install two commands: `sg` and `shellgpt`, which are identical.\n\nAfter install, use `sg --init` to create required directories(mainly `~/.shellgpt`).\n\n# Usage\n\nShellGPT has three modes to use:\n\n- Direct mode, `sg [question]` or pipeline like `echo question | sg`.\n- REPL mode, `sg -r`, chat with LLM.\n- TUI mode, `sg -t`, tailored for infer shell command.\n\n## Model\n\nBy default, `shellgpt` uses [Ollama](https://ollama.com/) as its language model backend, requiring installation prior to usage.\n\nAlternatively, one can set up `shellgpt` to utilize [OpenAI compatible](https://developers.cloudflare.com/workers-ai/configuration/open-ai-compatibility/) API endpoints:\n\n```bash\nexport SHELLGPT_API_URL=https://api.openai.com\nexport SHELLGPT_API_KEY=<token>\nexport SHELLGPT_MODEL='gpt-3.5-turbo'\n\n# or Cloudflare Worker AI\nexport SHELLGPT_API_URL=https://api.cloudflare.com/client/v4/accounts/<account-id>/ai\nexport SHELLGPT_API_KEY=<token>\nexport SHELLGPT_MODEL='@cf/meta/llama-3-8b-instruct'\n\n# or GitHub Models\n# https://docs.github.com/en/github-models/quickstart\nexport SHELLGPT_API_URL=https://models.github.ai\nexport SHELLGPT_MODEL=openai/gpt-4.1\nexport SHELLGPT_API_KEY=$GITHUB_TOKEN\n```\n\nSee [conf.py](shellgpt/utils/conf.py) for more configs.\n\n## TUI\n\nThere are 3 key bindings to use in TUI:\n\n- `ctrl+j`, Infer answer\n- `ctrl+r`, Run command\n- `ctrl+y`, Yank command\n\n![TUI screenshot](https://github.com/jiacai2050/shellgpt/raw/main/assets/shellgpt-tui.jpg)\n\n## System contents\n\nThere are some built-in [system contents](https://platform.openai.com/docs/guides/text-generation/chat-completions-api) in shellgpt:\n\n- `default`, used for ask general questions\n- `typo`, used for correct article typos.\n- `slug`, used for generate URL slug.\n- `code`, used for ask programming questions\n- `shell`, used for infer shell command\n- `commit`, used for generate git commit message, like `git diff --staged | sg -s commit`\n\nUsers can define their own content in `~/.shellgpt/prompts.toml`\n\n- key being content name and\n- value being content body\n\nOr you can just copy [prompts.toml](https://github.com/jiacai2050/my-works/blob/main/shellgpt/prompts.toml) to play with, it's generated from [Awesome ChatGPT Prompts](https://github.com/f/awesome-chatgpt-prompts/blob/main/prompts.csv).\n\n```bash\n$ sg -s linux-terminal pwd\n/home/user\n\n$ sg -s javascript-console 0.1 + 0.2\n0.3\n\n```\n\nUsers can share their customized contents in [discussions](https://github.com/jiacai2050/my-works/discussions/3).\n\n# License\n\n[GPL-3.0](https://opensource.org/license/GPL-3.0)\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Chat with LLM in your terminal, be it shell generator, story teller, linux-terminal, etc.",
    "version": "0.6.2",
    "project_urls": {
        "Issues": "https://github.com/jiacai2050/my-works/issues",
        "Repository": "https://github.com/jiacai2050/my-works/tree/main/shellgpt"
    },
    "split_keywords": [
        "ai",
        " llm",
        " shell",
        " gpt"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "85508aebde906e20d8d7199f80815f3327bae310682199320db888d1eef9e826",
                "md5": "b4011a99dd6db3ad5dfa81b55d5bbb75",
                "sha256": "7b4c3061810e568d2c4d6cdf708630fa96ee91b178ee28c756f210dedfed7cbc"
            },
            "downloads": -1,
            "filename": "shgpt-0.6.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b4011a99dd6db3ad5dfa81b55d5bbb75",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.0.0",
            "size": 13588,
            "upload_time": "2025-08-03T08:16:51",
            "upload_time_iso_8601": "2025-08-03T08:16:51.066149Z",
            "url": "https://files.pythonhosted.org/packages/85/50/8aebde906e20d8d7199f80815f3327bae310682199320db888d1eef9e826/shgpt-0.6.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "eaed29d937a0f08e6c94fb93761776b010859552ef5484ff1b8cf66c1319a1bf",
                "md5": "bf9a99d568d85c3a5a736469dd484553",
                "sha256": "c188dd4c62183a52b06569e32b1fda3e86cc30826676a5886af5daf1647d412c"
            },
            "downloads": -1,
            "filename": "shgpt-0.6.2.tar.gz",
            "has_sig": false,
            "md5_digest": "bf9a99d568d85c3a5a736469dd484553",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.0.0",
            "size": 13916,
            "upload_time": "2025-08-03T08:16:53",
            "upload_time_iso_8601": "2025-08-03T08:16:53.176753Z",
            "url": "https://files.pythonhosted.org/packages/ea/ed/29d937a0f08e6c94fb93761776b010859552ef5484ff1b8cf66c1319a1bf/shgpt-0.6.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-03 08:16:53",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "jiacai2050",
    "github_project": "my-works",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "shgpt"
}
        
Elapsed time: 1.96123s