Skip to main content

Yet Another OpenAI-compatible CLI

Project description

Yet Another OpenAI-compatible CLI

A simple, single-file 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: 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 src/yaoc/openai_cli.py --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_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.4.tar.gz (351.8 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: yaoc-0.1.4.tar.gz
  • Upload date:
  • Size: 351.8 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.4.tar.gz
Algorithm Hash digest
SHA256 23e50f3eb9d045c31aafb1c91c8167099948d8a5847fd6ad7a7b7890d3ad808d
MD5 4921d8a1bc174d268536639027afe096
BLAKE2b-256 71b540ecf14d80225e0b6331fd1b43a2cd1c5116a08a5e52e4f3bfe59a2d89ee

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