Skip to content

StevenLi-phoenix/ask

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ASK

Release

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

Build

Dependencies: g++ (C++17), libcurl, cJSON.

macOS:

brew install curl cjson
make

Ubuntu/Debian:

sudo apt-get update
sudo apt-get install -y g++ libcurl4-openssl-dev libcjson-dev
make

This produces the ask binary. ask.sh is a helper wrapper that runs it from the repo root.

Configure API key / model

You must provide OPENAI_API_KEY (and optionally ASK_GLOBAL_MODEL):

export OPENAI_API_KEY=sk-...
export ASK_GLOBAL_MODEL=gpt-5.2-latest-chat

Or 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-chat

Usage

One-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 info

Disable 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"

Flags (selected)

  • -c, --continue interactive conversation
  • --no-stream disable SSE streaming
  • -t, --token API key for this run
  • -m, --model model for this run (default: gpt-5.2-latest-chat)
  • -T, --temperature sampling temperature (default: 1.0)
  • -l, --tokenLimit max tokens budget (default: 128000, approximate)
  • --tokenCount print approximate token count for input and exit
  • --debug / --log LEVEL set log verbosity; --logfile FILE to log to file
  • --setAPIKey, --setModel persist to .env
  • --help, --version info

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.

Releases

Tags matching v* trigger GitHub Actions to build and upload tarballs:

git tag v1.0
git push origin v1.0

Artifacts are published as ask-<os>-<arch>.tar.gz with SHA256 checksums for Linux and macOS.

Contributing

Issues and PRs welcome. Keep changes portable (Linux/macOS) and stay within the C++17 toolchain used in Makefile.

About

A simple tool to ask chatgpt in cli

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages