Yet Another OpenAI-compatible CLI
Project description
Yet Another OpenAI-compatible CLI
A simple yet feature-rich command-line chat client compatible with the OpenAI API.
(or "I just want to quickly test my model hosted with vllm/llama.cpp but don't want to spin up openwebui")
Features
- OpenAI API Compatible: Works with any self-hosted LLM platform that supports OpenAI chat completions API.
- Image Support: Send local or remote images to models that support vision.
- Tools: The script has built-in tools for getting the time, fetching web pages, performing web searches, and file reading/writing.
- Syntax Highlighting: Renders Markdown in the terminal for better readability.
- Extremely simple: Single file, no installation needed.
Installation
- From AUR
yay -S yaoc-git
- From PyPI
pip install yaoc
- From Github
git clone https://github.com/doryiii/yaoc.git cd yaoc pip install -r requirements.txt
(Or use your operating system's package manager to install python requests, termcolor, rich, and html2text.)
Usage
- If installed as system package
openai-cli --base-url "http://localhost:8090/v1"
- If installed with PyPI
python -m yaoc.openai_cli --base-url "http://localhost:8090/v1"
- If cloned from Github
python -m src.yaoc.openai_cli --base-url "http://localhost:8090/v1"
Flags
| Flag | Description |
|---|---|
--base-url |
(Required) The base URL of the OpenAI-compatible API. |
--model |
The model to use. If not given, the first model returned by the API will be used. |
--api-key |
The API key for the service. Defaults to the OPENAI_API_KEY environment variable. |
--system |
Optional system prompt to give to the model |
--hide-thinking |
Hide the thinking process output of the model. |
--cache-prompt |
llama.cpp specific prompt caching |
--tools-basic |
Enable basic tools (e.g. get_time) |
--tools-web-access |
Enable web search and fetch tools |
--tools-file-access |
Enable file system tools |
Images
To send an image, use the @image: tag at the end of your prompt:
> Tell me about this image @image:path/to/your/image.png
You can also use a URL:
> What do you see in this image? @image:https://example.com/image.jpg
Piping
You can pipe text into stdin:
echo "Hello!" | python src/openai_cli/main.py --base-url "http://localhost:8090/v1" --hide-thinking
Tools
The script has some built-in tools:
get_time: Get the current local time.web_fetch: Get the content of a webpage.web_search: Performs a web search. Requires theLANGSEARCH_API_KEYenvironment variable to be set.list_dir: Lists the contents of a directory.read_file: Reads the contents of a file.write_file: Writes content to a file.
Dependencies
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
yaoc-0.1.10.tar.gz
(352.1 kB
view details)
File details
Details for the file yaoc-0.1.10.tar.gz.
File metadata
- Download URL: yaoc-0.1.10.tar.gz
- Upload date:
- Size: 352.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9c536310ddfcd1bc992799ae2a094d1950c5a0982d6c8e41cf8bd6864894db64
|
|
| MD5 |
6138892af5b28f37e90a50fd7c45616c
|
|
| BLAKE2b-256 |
b84285d65fdeec593701a5c09be11db5f6565eb261d16dc9e8f011f877d959c1
|