Skip to content

A versatile command-line tool for interacting with various Large Language Models through the terminal.

License

Notifications You must be signed in to change notification settings

wangenius/gpt-shell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

51 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

GPT Shell

GPT Shell Logo

GPT Shell

Professional Terminal Assistant for LLM Interactions

GitHub stars License Platform PRs Welcome Version

Key Features β€’ Quick Start β€’ Usage Guide β€’ Advanced Configuration

πŸ“– Overview

GPT Shell is a powerful terminal AI assistant built with Rust, enabling direct interaction with various Large Language Models (LLMs) through the command line. With its clean interface and support for multiple AI providers, it's the ideal choice for developers and terminal users. Whether you need programming assistance, text creation, or task automation, GPT Shell provides professional support.

🌟 Key Features

πŸ”Œ Core Features

  • Multi-Model Support: Compatible with OpenAI, DeepSeek, Tongyi, ZhiPu, and more
  • Custom Endpoints: Support for private deployments and compatible services
  • Real-time Response: Stream API-based output
  • Role Presets: Quick switching between different AI assistant scenarios
  • Command Aliases: Single-character shortcut support
  • Cross-Platform: Full support for Windows, MacOS, and Linux
  • Auto Updates: Built-in version checking and updating

🎯 User Experience

  • Interactive Mode: Natural conversation flow
  • Direct Queries: Quick one-off questions
  • Colored Output: Enhanced terminal display
  • Context Memory: Automatic conversation history management
  • Generation Control: Ctrl+C interrupt support
  • Flexible Config: Environment variables and config file support
  • JSON Mode: Structured data interaction support

πŸ€– Supported Providers

  • βœ… OpenAI: GPT-3.5/4 models with complete streaming response
  • βœ… DeepSeek: DeepSeek-Chat models with custom API endpoints
  • βœ… Tongyi: Qianwen models with configurable parameters
  • βœ… ZhiPu: ChatGLM models with flexible interface adaptation
  • βœ… Other models: Compatible with OpenAI API format

⚑ Quick Start

Installation

# Windows PowerShell
irm https://raw.githubusercontent.com/wangenius/gpt-shell/refs/heads/master/install.ps1 | iex

# For other platforms, please refer to the online documentation

Command Line Arguments

gpt [OPTIONS] [PROMPT]

Options:
  -b, --bot <BOT>      Use specified preset role
  -a, --agent <AGENT>  Use specified intelligent agent
  -h, --help          Display help information
  -V, --version       Display version information

Subcommands:
  update              Check and install updates
  config              Configuration management
  bots                Role management

Basic Commands

# Start interactive session
gpt

# Direct question
gpt "How to use Docker?"

# Use specific role
gpt -b programmer "Code review"

# Show help
gpt --help

πŸ“š Usage Guide

Interactive Mode

gpt
> Hello
Hello! How can I help you today?

> What is a closure?
A closure is a function that can access free variables...
[Press Ctrl+C to interrupt generation]

> exit
Goodbye!

Model Configuration

# Add model
gpt config model add openai sk-xxxxxxxxxxxxxxxx

# Add custom model
gpt config model add deepseek your-api-key \
  --url https://api.deepseek.com/v1/chat/completions \
  --model deepseek-chat

# View and switch models
gpt config model list
gpt config model use deepseek
gpt config model remove openai

Note: --url should be a complete API address, like https://api.deepseek.com/v1/chat/completions, not just the base URL.

Role Management

# View all roles
gpt bots

# Add custom role
gpt bots add reviewer -s "You are a professional code review expert"

# Manage role aliases
gpt bots alias set reviewer r
gpt bots alias list
gpt bots alias remove r

πŸ€– Intelligent Agent System

GPT Shell provides a powerful intelligent agent system with high-performance command execution and state management implemented in Rust:

  • System Prompts: Define agent roles and behavior characteristics
  • Environment Variables: Configure system environment variables for command execution
  • Command Templates: Predefined common command templates
  • Smart Command Execution: Automatic variable replacement and execution
  • State Management: Maintain conversation context and execution state
  • Concurrency Control: Support for async operations and task cancellation
  • Standardized Interaction: JSON format request-response

Agent Configuration Example

name = "Development Assistant"
description = "Professional development tool"
system_prompt = "You are an experienced developer"

[env]
editor = "code"
browser = "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe"

[templates]
open_file = "{{editor}} {{file}}"
open_browser = "start {{browser}} {{url}}"

βš™οΈ Advanced Configuration

System Settings

# View configuration
gpt config

# Edit settings
gpt config edit

# Update system prompt
gpt config system "You are a professional developer"

# Feature toggles
gpt config stream true

Configuration Storage

  • Config file location: ~/.gpt-shell/
  • Secure API key storage
  • Automatic session history management
  • .env environment variable support

Technical Features

  • Async Processing: tokio-based async runtime
  • Stream Transfer: Real-time response handling
  • Memory Safety: Rust-guaranteed memory safety
  • Error Handling: Comprehensive error handling
  • Type System: Strong typing for data safety

πŸ”’ Security Best Practices

  • API Keys: Secure storage, avoid version control
  • Access Control: Careful permission management
  • Cost Management: Monitor API usage
  • Data Privacy: Mind data handling policies
  • Updates: Keep tools and dependencies current

🀝 Contributing

Welcome to contribute to the project:

  • πŸ› Report issues and bugs
  • πŸ’‘ Suggest new features
  • πŸ”§ Submit code improvements
  • πŸ“– Improve project documentation
  • 🌍 Enhance translations

Development Guide

  1. Clone project and install dependencies
  2. Follow Rust coding standards
  3. Write test cases
  4. Ensure all tests pass before submitting PR

πŸ“„ License

This project is licensed under the MIT License.


Acknowledgments

About

A versatile command-line tool for interacting with various Large Language Models through the terminal.

Resources

License

Stars

Watchers

Forks

Packages

No packages published