gpt-cli

A console chat with ChatGPT, Claude, Gemini and Cohere: custom assistants in YAML, one-shot prompts from scripts and shell commands you edit before running

  • 721 ★ on the repository
  • Last commit
  • MIT
CLI

Extended access

Why this level

  • Sends your prompts and text piped from stdin to model providers using API keys
  • Keys can be written to `~/.config/gpt-cli/gpt.yml`, where they are stored in plain text
  • The `--execute` mode runs the command the model produced in your shell after your edit
All reasons and checks

kharvd/gpt-cli

Install

In your terminal, with SkillFoxx CLI

npx skillfoxx add cli/gpt-cli

Detects the agents on your machine, shows the access level and pins the version.

Other ways to install

Access and checks

How we review

Extended accessThe tool runs code or makes network calls and only reads external data.

  • Sends your prompts and text piped from stdin to model providers using API keys
  • Keys can be written to `~/.config/gpt-cli/gpt.yml`, where they are stored in plain text
  • The `--execute` mode runs the command the model produced in your shell after your edit

This is third-party code. Review the repository files before installing.

What it does

gpt-cli is a console program in Python that opens a chat with a language model right in the terminal. The `gpt` command starts an interactive dialogue with Markdown-formatted replies, and `gpt dev`, `gpt bash` and `gpt general` pick an assistant. The `dev` assistant answers as a development expert and briefly, while `bash` returns only shell commands. It connects OpenAI, Anthropic, Google Gemini, Cohere and any OpenAI-compatible API, for example Together, OpenRouter or local models through LM Studio. For a single question without a dialogue there is the `-p` flag, which prints the answer to standard output and accepts the prompt from stdin, so the program is easy to call from scripts. The `-e` flag asks the assistant for a command and opens it in the `$EDITOR` editor so you can fix it before it runs, as in `gpt bash -e "how do I list files"`. Custom assistants are described in `~/.config/gpt-cli/gpt.yml`: model, temperature, `top_p`, starting messages and included files through `!include`. Claude 3.7 extended thinking is turned on with `--thinking` and a token budget. During a chat the program counts tokens and shows the cost of a request, which `--no_price` turns off. In the dialogue `:c` clears the conversation, `:r` regenerates the last reply, and a backslash followed by a newline starts multi-line input.

Who it is for. For developers and administrators who want to ask a model from the terminal on Linux or macOS and keep several configured assistants for different tasks.

Good fit when

  • You want a quick question to a model without a browser: `gpt dev` answers briefly and to the point
  • You need to call a model from a script and get the answer on stdout through `gpt -p "..."`
  • It is easier to ask a model for a shell command and fix it in an editor than to recall it: `gpt bash -e`
  • You need assistants with ready roles and starting messages described in one YAML
  • You want to see token usage and request cost right in the dialogue

Not a fit when

  • You need an agent that reads project files and edits code on its own: this is a plain chat, and Aider fits repository work better
  • You need a single tool with RAG and tool calling: AIChat covers that
  • You work on Windows: the install notes name Linux and macOS
  • You need support for recent models: the repository was last updated in April 2025 and its examples use Claude 3

Example request

Ask the model through gpt-cli how to find all files over 100 MB in a directory and let me edit the command before running it

Limitations

  • It needs Python from 3.9 to 3.12. The install notes target Linux and macOS.
  • Provider API keys are required: `OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, `GOOGLE_API_KEY` or `COHERE_API_KEY`. Keys can be written to `~/.config/gpt-cli/gpt.yml`, where they sit in plain text. The OpenAI and Anthropic APIs are unavailable from Russia, so a compatible address through `OPENAI_BASE_URL` or a local model fits.
  • Extended thinking works only in Claude 3.7 models, and enabling it forces the temperature to 1.0.
  • The project is in beta and the latest release is 0.4.3.
  • A command from `--execute` runs after your edit in the editor, but the program adds no protection against dangerous commands, so you must check the text yourself.

How to disable. Remove the package with `pip uninstall gpt-command-line` and, if you wish, the `~/.config/gpt-cli/gpt.yml` file with settings and keys. If you launched it through `uvx`, there is nothing to remove: the package was not installed. Drop the `OPENAI_API_KEY` line from `.bashrc` if you added it following the instructions.

FAQ

How do I use ChatGPT and Claude in the terminal?

Install `pip install gpt-command-line`, set `OPENAI_API_KEY` or `ANTHROPIC_API_KEY` and run `gpt`. A Claude model is chosen with the `--model` flag, for example `gpt --model claude-3-opus-20240229`.

How do I run gpt-cli without installing it?

With `uvx --from gpt-command-line gpt` after exporting a key, for example `export ANTHROPIC_API_KEY=...`. The package is downloaded into a temporary environment and nothing is left in the system.

How do I get a shell command from a model without running it blindly?

Use `gpt bash -e "task"`. The model returns a command, the program opens it in `$EDITOR`, and execution starts after your edit. The author says this mode works best with the gpt-4 model.

How do I connect OpenRouter, Together or a local model?

Set `openai_base_url` in the settings file or the `OPENAI_BASE_URL` variable and add the `oai-compat:` prefix to the model name, for example `oai-compat:meta-llama/Llama-3-70b-chat-hf`. For Azure OpenAI the prefix is `oai-azure:`.

How do I create my own assistant with a role?

Describe it in `~/.config/gpt-cli/gpt.yml` under `assistants`: name, model, temperature and starting messages. Then run `gpt name`. A long role text can be included from a file through `!include`.

Discussion

No questions or reviews yet.

CLI tools
Official

An MCP server on your machine that lets ChatGPT and Claude edit code, run tests and check Git in a local repository

MCP serverBroad access2.5KRepository stars

CodexPro

codexpro

A local MCP server that gives ChatGPT in developer mode tools for reading, searching, editing and checking the repositories you allow

MCP serverBroad access2.1KRepository stars

A Python terminal coding agent in the manner of Claude Code: reads the repository, edits files, runs commands, with memory, sub-agents and MCP

CLIBroad access1KRepository stars

A Rust CLI for over 20 LLM providers: command mode, REPL chat, RAG and tool calling from the terminal

CLIExtended access10.5KRepository stars

A self-hosted MCP server that gives ChatGPT and other clients access to code on your machine: read, edit, search and run commands

MCP serverBroad access5.3KRepository stars

Two Rust commands for the terminal: qq answers a quick command-line question, and qa performs a single step with files and commands

CLIBroad access629Repository stars

Comparison with similar tools

Entries that share the main search query, and how they differ.

EntryOfficialRepository starsMain difference
gpt-cli (this entry)no721
AIChatno10,533a Rust CLI for over 20 providers: command mode, REPL chat, RAG and tool calling
ShellGPTno12,296the sgpt command writes shell commands and code, reads piped output, keeps chats and calls functions
LLMno12,681a CLI and Python library for many models: prompts, chats, tools, embeddings and a SQLite log

README in short

The repository holds Python sources with separate provider modules for OpenAI, Azure OpenAI, Anthropic, Google, Cohere and Llama, a cost-counting module, pytest tests and a screenshot. The overview opens with a launch through `uvx`, followed by a provider table, a feature list, flag help and a description of the settings file. Separate sections explain connecting compatible APIs, Claude 3.7 with thinking, Gemini and Cohere. MIT license.

README badge

Report a problem

Foxx AIgpt-cli
Foxx AI

I am Foxx AI and I have already vetted this tool. Ask about install, setup or anything else, and I will keep it simple.