Natural language to live shell commands — OpenAI & Anthropic.
Chat with the model and run suggested commands in your shell in one seamless flow.
aicli
CLI by Antonio Molinari. Converts prompts into shell commands, with optional chat mode that can execute them live.
Setup
Requires Ruby 3.0+
-
Install aicli:
gem install aicli
Or from this repository:
bundle install bundle exec rake install # or gem build aicli.gemspec && gem install ./aicli-*.gem
-
Choose a provider and set the matching API key.
OpenAI (default) — key from OpenAI:
aicli config set PROVIDER=openai aicli config set OPENAI_KEY=<your token>
Anthropic — key from Anthropic:
aicli config set PROVIDER=anthropic aicli config set ANTHROPIC_KEY=<your token>
Or use the interactive UI (
aicli config) to pick provider, key, and model. Model lists come from the RubyLLM registry.Config lives in
~/.aicli/config. Chat/prompt history is stored in~/.aicli/context(last 40 messages) and reloaded on the next run.
Usage
aicli <prompt>For example:
aicli list all log filesThen you will get an output where you can choose to run the suggested command, revise it via a prompt, edit it, copy it, or cancel.
The short alias ai is also available.
Special characters
Some shells handle characters like ? or * specially. Wrap the prompt in quotes if needed:
aicli 'what is my ip address'Chat mode
aicli chatAsk for shell commands in a multi-turn conversation. When the assistant suggests a command in a code fence, you are asked whether to run it; after it runs (or you decline), chat continues. Press Ctrl+d to quit.
Silent mode (skip explanations)
aicli -s list all log filesOr save the preference:
aicli config set SILENT_MODE=trueProvider and model
aicli config set PROVIDER=openai # or anthropic
aicli config set MODEL=gpt-4o-mini # provider-specific model idDefaults: gpt-4o-mini (OpenAI), claude-sonnet-4-6 (Anthropic).
LLM calls go through RubyLLM, so chat streaming and model metadata stay provider-agnostic.
Custom OpenAI API endpoint
Useful for OpenAI-compatible proxies (ignored for Anthropic):
aicli config set OPENAI_API_ENDPOINT=<your proxy endpoint>Default: https://api.openai.com/v1
Set Language
| Language | Key |
|---|---|
| English | en |
| Simplified Chinese | zh-Hans |
| Traditional Chinese | zh-Hant |
| Spanish | es |
| Japanese | jp |
| Korean | ko |
| French | fr |
| German | de |
| Russian | ru |
| Ukrainian | uk |
| Vietnamese | vi |
| Arabic | ar |
| Portuguese | pt |
| Turkish | tr |
| Indonesian | id |
| Italian | it |
aicli config set LANGUAGE=zh-HansConfig UI
aicli configUpgrading
aicli --version
gem update aicliOr:
aicli updateDevelopment
Run the local checkout (not the installed gem) with Bundler from this directory:
bundle install
bundle exec bin/ai --help
bundle exec bin/ai config
bundle exec bin/ai chat
bundle exec bin/ai list all log filesbin/aicli is equivalent to bin/ai. bundle exec loads dependencies from the Gemfile and code from lib/.
Example config for local testing:
bundle exec bin/ai config set PROVIDER=openai
bundle exec bin/ai config set OPENAI_KEY=<your token>
# or: PROVIDER=anthropic + ANTHROPIC_KEY=<your token>Common Issues
Rate limit / quota errors
Usually billing or quota on the configured provider (OpenAI or Anthropic). Check that provider’s console billing page and that the matching API key is set in ~/.aicli/config.
Motivation
I am not a bash wizard, and am dying for access to the copilot CLI, and got impatient.