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, and performing web searches.
  • 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

  1. Clone the repository:

    git clone https://github.com/doryiii/yaoc.git
    cd yaoc
    
  2. Install the dependencies:

    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.main --base-url "http://localhost:8090/v1"
    
  • If cloned from Github
    python src/openai_cli/main.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.
--no-tools Disable tool calling
--cache_prompt llama.cpp specific prompt caching

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.

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.3.tar.gz (351.6 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: yaoc-0.1.3.tar.gz
  • Upload date:
  • Size: 351.6 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.3.tar.gz
Algorithm Hash digest
SHA256 95e1e44bdb6f3876e7c388510b9bec00472599bc74fca1d61e5c6ba88f7939eb
MD5 ccd2d827e3e6b8d13416fe070b69970c
BLAKE2b-256 818f5c30a9429385748384de3787a7041e5e212e856b9cb5b2c59762f52a4599

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