Project

aicli

0.0
The project is in a healthy, maintained state
aicli turns natural language into runnable shell commands using OpenAI or Anthropic. Chat with the model and execute suggested commands live in your shell in one seamless flow.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Runtime

~> 1.3
~> 0.8
~> 1.16
~> 1.3
~> 0.23
 Project Readme

aicli logo

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+

  1. Install aicli:

    gem install aicli

    Or from this repository:

    bundle install
    bundle exec rake install
    # or
    gem build aicli.gemspec && gem install ./aicli-*.gem
  2. 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 files

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

Ask 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 files

Or save the preference:

aicli config set SILENT_MODE=true

Provider and model

aicli config set PROVIDER=openai      # or anthropic
aicli config set MODEL=gpt-4o-mini    # provider-specific model id

Defaults: 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-Hans

Config UI

aicli config

Upgrading

aicli --version
gem update aicli

Or:

aicli update

Development

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 files

bin/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.

Credit