ask is a lightweight CLI that sends chat prompts to OpenAI. It now runs as a single C++17 binary (libcurl + cJSON) and supports both one-shot replies and interactive chat.
- Default model:
gpt-5.2-latest-chat(Also known as chatgpt 5.2 instant) - Default token limit:
128000
Dependencies: g++ (C++17), libcurl, cJSON.
macOS:
brew install curl cjson
makeUbuntu/Debian:
sudo apt-get update
sudo apt-get install -y g++ libcurl4-openssl-dev libcjson-dev
makeThis produces the ask binary. ask.sh is a helper wrapper that runs it from the repo root.
You must provide OPENAI_API_KEY (and optionally ASK_GLOBAL_MODEL):
export OPENAI_API_KEY=sk-...
export ASK_GLOBAL_MODEL=gpt-5.2-latest-chatOr write a .env:
OPENAI_API_KEY=sk-...
ASK_GLOBAL_MODEL=gpt-5.2-latest-chat
Or persist via flags (writes .env):
./ask --setAPIKey sk-... --setModel gpt-5.2-latest-chatOne-shot:
./ask "What is the capital of France?"Interactive:
./ask -c "Let's chat"
# then type messages; use `exit` to quit, `status` to view token/model infoDisable streaming (receive full response at once):
./ask --no-stream "Tell me a story"Attach text files inline using @path (up to 10KB, plain text, exact name):
./ask "Summarize @README.md"-c,--continueinteractive conversation--no-streamdisable SSE streaming-t,--tokenAPI key for this run-m,--modelmodel for this run (default: gpt-5.2-latest-chat)-T,--temperaturesampling temperature (default: 1.0)-l,--tokenLimitmax tokens budget (default: 128000, approximate)--tokenCountprint approximate token count for input and exit--debug/--log LEVELset log verbosity;--logfile FILEto log to file--setAPIKey,--setModelpersist to.env--help,--versioninfo
Token counting is approximate; streaming prints chunks as they arrive and falls back to full JSON if needed. The CLI shows a short “thinking…” spinner and retries once on timeout (60s) so you see progress instead of hanging.
Tags matching v* trigger GitHub Actions to build and upload tarballs:
git tag v1.0
git push origin v1.0Artifacts are published as ask-<os>-<arch>.tar.gz with SHA256 checksums for Linux and macOS.
Issues and PRs welcome. Keep changes portable (Linux/macOS) and stay within the C++17 toolchain used in Makefile.