https://github.com/varlabz/qq
minimalistic cli llm command (bash only)
https://github.com/varlabz/qq
bash bash-script llm minimal openai
Last synced: 3 months ago
JSON representation
minimalistic cli llm command (bash only)
- Host: GitHub
- URL: https://github.com/varlabz/qq
- Owner: varlabz
- Created: 2025-05-19T19:17:55.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-07-14T23:00:32.000Z (12 months ago)
- Last Synced: 2025-08-10T22:47:42.219Z (11 months ago)
- Topics: bash, bash-script, llm, minimal, openai
- Language: Shell
- Homepage:
- Size: 12.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# qq: Simple Bash CLI for OpenAI Chat Completions
qq is a minimal Bash script that lets you interact with OpenAI-compatible chat models from the command line. It supports both single-message and system-prompted conversations, and can read input from stdin for flexible scripting.
## Features
- Send prompts and messages to OpenAI's chat/completions API (or compatible endpoints)
- Supports system prompts and user messages
- Reads message from stdin if last argument is `-`
- Loads API keys and settings from `.env` or `~/.config/qq-env`
- Minimal dependencies: only `curl` and `jq`
## Usage
```bash
qq
qq
qq - # message from stdin
```
- If only one argument is given, it is treated as the user message with a default system prompt.
- If two or more arguments are given, the first is the system prompt, the rest are joined as the user message.
- If the last argument is `-`, the message is read from stdin.
## Environment Variables
qq uses the following environment variables (set in `.env` or `~/.config/qq-env`):
- `LLM_API_KEY` (required): Your OpenAI API key
- `LLM_BASE_URL` (optional): API endpoint (default: `https://api.openai.com/v1/chat/completions`)
- `LLM_MODEL` (optional): Model name (default: `openai/gpt-4o-mini`)
- `LLM_TEMPERATURE` (optional): Sampling temperature (default: `0.1`)
## Example
```bash
echo "Summarize this text:" | qq "You are a helpful assistant." -
qq "You are a helpful assistant." "What is the capital of France?"
qq "What is the capital of France?"
qq "You are a helpful assistant." - < message.txt
qq "$(cat prompt.txt)" "$(cat message.txt)"
qq "$(cat prompt.txt)" - < message.txt
```
## Requirements
- bash
- curl
- jq
## Installation
Just copy the `qq` script somewhere in your `$PATH` and make it executable:
```bash
chmod +x qq
```
## License
MIT