CLI for querying LLMs from the terminal. Supports Anthropic (Claude), OpenAI, and Google (Gemini).
Talks to each provider's REST API directly over net/http — no vendor SDKs, so the only dependency is a TOML parser.
go install github.com/leinonen/ask@latestOr build from source:
go build -o ask .ask "what is the capital of France?"
echo "func foo() {}" | ask "explain this"
cat file.txt | ask "summarize"
ask --shell "list files sorted by size"
ask --code "fibonacci in python"
ask --caveman "explain what a mutex is"| Flag | Short | Description |
|---|---|---|
--shell |
-s |
Generate a shell command (prompts to execute) |
--code |
-c |
Output code only, no markdown fences |
--caveman |
-V |
Terse caveman output (~75% fewer tokens) |
--system TEXT |
-S |
Custom system prompt |
--model TEXT |
-m |
Model override |
--provider TEXT |
-p |
Provider override (anthropic, openai, or gemini) |
On first run, a setup wizard prompts for provider, API key, and default model. Config is saved to ~/.config/ask/config.toml.
To enable caveman mode by default, add caveman = true to your config:
provider = "anthropic"
model = "claude-opus-4-7"
caveman = trueYou can also set keys via environment variables:
export ANTHROPIC_API_KEY=sk-ant-...
export OPENAI_API_KEY=sk-...
export GEMINI_API_KEY=... # GOOGLE_API_KEY also worksSelect Google (Gemini) in the setup wizard, or set it in your config:
provider = "gemini"
model = "gemini-2.5-flash"
[gemini]
api_key = "..."Get a key from Google AI Studio. Available models include gemini-2.5-flash, gemini-2.5-pro, gemini-2.5-flash-lite, and gemini-2.0-flash.
Any OpenAI-compatible service (Ollama, LiteLLM, Azure OpenAI, local models, etc.) works by setting base_url in the [openai] section:
provider = "openai"
model = "llama3.2"
[openai]
api_key = ""
base_url = "http://localhost:11434/v1"The setup wizard also prompts for a base URL when OpenAI is selected. Leave it blank to use api.openai.com.