Skip to content

Latest commit

 

History

9 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ask

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.

Install

go install github.com/leinonen/ask@latest

Or build from source:

go build -o ask .

Usage

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"

Flags

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)

Config

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  = true

You 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 works

Gemini

Select 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.

OpenAI-compatible providers

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.

About

CLI for querying LLMs from the terminal. Supports Anthropic (Claude) and OpenAI.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages