An open API service indexing awesome lists of open source software.

https://github.com/baalimago/clai

Command line artificial intelligence - Your local LLM context-feeder
https://github.com/baalimago/clai

ai cli context-feeder go golang-tools llm

Last synced: about 2 months ago
JSON representation

Command line artificial intelligence - Your local LLM context-feeder

Awesome Lists containing this project

README

          

# Command Line Artificial Intelligence

[![Go Report Card](https://goreportcard.com/badge/github.com/baalimago/clai)](https://goreportcard.com/report/github.com/baalimago/clai)
![Wakatime](https://wakatime.com/badge/user/018cc8d2-3fd9-47ef-81dc-e4ad645d5f34/project/018e07e1-bd22-4077-a213-c16290d3db52.svg)

Test coverage: 67.467% πŸ˜ŒπŸ‘




clai (/klaΙͺ/, like "cli" in "climate") is a command line context-feeder for any ai task.



Banner

## Get started

Installing:

```bash
curl -fsSL https://raw.githubusercontent.com/baalimago/clai/main/setup.sh | sh
```

You can also install via go:

```bash
go install github.com/baalimago/clai@latest
```

Then run:

```bash
clai help | clai query Please give a concise explanation of clai
```

Either look at `clai help` or the [examples](./EXAMPLES.md) for how to use `clai`.
If you have time, you can also check out [this blogpost](https://lorentz.app/blog-item.html?id=clai) for a slightly more structured introduction on how to use Clai efficiently.

Install [Glow](https://github.com/charmbracelet/glow) for formatted markdown output when querying text responses.

## Features


Showcase

- **[MCP client support](./EXAMPLES.md#mcp-tools-external-tool-servers)** - Add any MCP server you'd like by simply pasting their configuration.
- **Vendor agnosticism** - Use any functionality in Clai with [most LLM vendors](#supported-vendors) interchangeably.
- **[Conversations](./EXAMPLES.md#bind-a-previous-conversation-to-the-current-directory)** - Create, manage and continue conversations.
- **[Profiles](./EXAMPLES.md#profiles--workflow-presets)** - Pre-prompted profiles enabling customized workflows and agents.
- **Unix-like** - Clai follows the [unix philosophy](https://en.wikipedia.org/wiki/Unix_philosophy) and works seamlessly with data piped in and out.

All of these features are easily combined and tweaked, empowering users to accomplish very diverse use cases.
See [examples](./EXAMPLES.md) for additional info.

## Supported vendors

| Vendor | Environment Variable | Models |
| ----------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| OpenRouter | `OPENROUTER_API_KEY` | [Text models](https://openrouter.ai/models), use prefix `or:` |
| Mistral | `MISTRAL_API_KEY` | [Text models](https://docs.mistral.ai/getting-started/models/) |
| OpenAI | `OPENAI_API_KEY` | [Text models](https://platform.openai.com/docs/models), [photo models](https://platform.openai.com/docs/models/dall-e) |
| Anthropic | `ANTHROPIC_API_KEY` | [Text models](https://platform.claude.com/docs/en/about-claude/models/overview) |
| Gemini | `GEMINI_API_KEY` | [Text models](https://ai.google.dev/gemini-api/docs/models), [photo models](https://ai.google.dev/gemini-api/docs/image-generation#image_generation_text-to-image) |
| HuggingFace | `HF_API_KEY` | [Text models](https://huggingface.co/docs/inference-endpoints/chat-completions), use prefix `hf:` |
| xAi | `XAI_API_KEY` | [Text models](https://docs.x.ai/docs/models) |
| Inception | `INCEPTION_API_KEY` | [Text models](https://platform.inceptionlabs.ai/docs#models) |
| Ollama | N/A | Use format `ollama:` (defaults to llama3), server defaults to localhost:11434 |

---

Shell completions are also available:

```bash
# bash
mkdir -p ~/.local/share/bash-completion/completions
clai completion bash > ~/.local/share/bash-completion/completions/clai
```
```bash
# zsh
mkdir -p ~/.zsh/completions
clai completion zsh > ~/.zsh/completions/_clai
```

For zsh, ensure your `fpath` includes the completions directory before `compinit`, for example:

```bash
fpath=(~/.zsh/completions $fpath)
autoload -Uz compinit && compinit
```

Then restart your shell or reload your shell configuration.