tbckr/sgpt

SGPT is a command-line tool that provides a convenient way to interact with OpenAI models, enabling users to run queries, generate shell commands and produce code directly from the terminal.

What it solves

SGPT provides a way to interact with Large Language Models (LLMs) directly from the command line. It eliminates the need to switch between a terminal and a web browser to get answers, generate code, or create shell commands, thereby streamlining developer workflows.

How it works

Written in Go, SGPT acts as a CLI wrapper for OpenAI-compatible APIs. It sends user prompts to a specified model and returns the response to the terminal. It supports various backends including OpenAI, OpenRouter, Requesty, Google Gemini, and local LLM runners like Ollama or vLLM by allowing the user to configure the API base URL and key.

Who it’s for

It is designed for developers, system administrators, and power users who spend most of their time in the terminal and want AI assistance for coding, shell scripting, and general queries without leaving their environment.

Highlights

  • Multi-Model Support: Works with OpenAI (including GPT-4o and o1), Google Gemini, and any OpenAI-compatible local or gateway API.
  • Shell Integration: Can generate shell commands and execute them directly with user confirmation.
  • Vision Capabilities: Supports image inputs (via URL or local path) for analysis using vision-capable models.
  • Interactive Chat: Supports named chat sessions to maintain conversation context across multiple commands.
  • Prompt Templating: Uses Go text/template syntax to inject JSON or YAML data into prompts via stdin.
  • Code Generation: Dedicated personas for producing code snippets in various programming languages.

Related

  • Project
  • Project
  • Project
  • Project
  • Project