sgpt  by tbckr

CLI tool for interacting with OpenAI models from the terminal

created 2 years ago
355 stars

Top 79.7% on sourcepulse

GitHubView on GitHub
Project Summary

SGPT is a Go-based command-line interface for interacting with OpenAI and other LLM APIs, designed to streamline terminal-based workflows for developers and power users. It allows users to query models, generate shell commands, write code, and process images directly from the command line, enhancing productivity and simplifying complex tasks.

How It Works

SGPT leverages OpenAI's API (including GPT-4o and Vision) and supports integrations with OpenRouter, enabling access to a variety of LLMs. It processes natural language prompts to generate shell commands, code snippets, or textual responses. The tool can execute generated commands, maintain chat sessions for contextual conversations, and integrate with shell environments via aliases and functions for automated workflows.

Quick Start & Requirements

  • Installation:
    • Homebrew (macOS): brew install tbckr/tap/sgpt
    • Scoop (Windows): scoop bucket add tbckr https://github.com/tbckr/scoop-bucket.git && scoop install tbckr/sgpt
    • Go: go install github.com/tbckr/sgpt/v2/cmd/sgpt@latest
    • Docker: docker pull ghcr.io/tbckr/sgpt:latest
    • Ansible: See provided playbook in README.
  • Prerequisites: OpenAI API Key (set as OPENAI_API_KEY environment variable). For OpenRouter, set OPENAI_API_BASE and OPENAI_API_KEY.
  • Documentation: Usage Guide

Highlighted Details

  • Supports GPT-4o and GPT-4 Vision API for image analysis.
  • Generates and optionally executes shell commands.
  • Facilitates code generation in various programming languages.
  • Integrates with OpenRouter for access to diverse LLMs.
  • Enables persistent chat sessions for contextual interactions.

Maintenance & Community

The project is actively maintained, with v2 still supported during the refactoring for v3. The original inspiration is shell-gpt.

Licensing & Compatibility

The repository does not explicitly state a license in the provided README. Compatibility for commercial use or closed-source linking is not specified.

Limitations & Caveats

SGPT is currently undergoing heavy refactoring for v3, though v2 remains maintained. The project notes that it does not natively support interactive shell sessions, but provides a workaround using rlwrap. GPT-4o and GPT-4 Vision API integration is noted as being in beta.

Health Check
Last commit

6 days ago

Responsiveness

1 day

Pull Requests (30d)
2
Issues (30d)
0
Star History
32 stars in the last 90 days

Explore Similar Projects

Feedback? Help us improve.