Skip to main content

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")

Chat CLI

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

Image Example

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 the LANGSEARCH_API_KEY environment 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.11.tar.gz (352.1 kB view details)

Uploaded Source

File details

Details for the file yaoc-0.1.11.tar.gz.

File metadata

  • Download URL: yaoc-0.1.11.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

Hashes for yaoc-0.1.11.tar.gz
Algorithm Hash digest
SHA256 4fee4d7daf97cf93db252781ce538d40d2045cd7d152c49e73ef1b94a86e1816
MD5 ed8c556628a29ae2a9d52ce4c0145f65
BLAKE2b-256 9fcb966e4468048fbce761d7a49851eac41f7c207f30a90e510a145f175d6053

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page