LLX - A CLI for Interacting with Large Language Models
LLX is a Python-based command-line interface (CLI) that makes it easy to interact with various Large Language Model (LLM) providers. Whether you need to chat with models, send prompts with attachments, crawl URLs for content extraction, or run evaluations, LLX provides a convenient set of commands to streamline the process.
Features
- Support for multiple LLM providers (OpenAI, Ollama, Anthropic, Deepseek, Mistral, Gemini, XAI).
- LLM response streaming.
- Multimodal support, upload and analyze files.
Installation
-
Make sure you have Python 3.7+ installed.
-
(Optional) Create and activate a virtual environment:
python3 -m venv venv source venv/bin/activate # Linux/Mac venv\Scripts\activate # Windows -
Install LLX with pip:
pip install llx -
(Optional) Create a .env file in your project directory to store your provider API keys (e.g., OPENAI_API_KEY, ANTHROPIC_API_KEY, etc.). You can use .env.example as a reference.
Usage
Once installed, you can run the CLI with:
llx --help
This will list all available subcommands and their required/optional parameters. Below is a summary of each subcommand and example usage.
1. prompt
Send a single prompt to a specified model. The prompt text can be passed in directly or piped in via stdin.
• Required options:
--model / -m : The model in ":<model_name>" format.
• Optional:
--prompt / -p : The prompt string (if not provided, it reads from stdin).
--attachment / -a : Path to an image file to send as an attachment.
Example 1 (inline prompt):
llx prompt --model openai:gpt-3.5-turbo --prompt "Hello, how are you?"
Example 2 (pipe prompt from stdin):
echo "Hello from stdin" | llx prompt -m openai:gpt-3.5-turbo
Example 3 (with attachment):
llx prompt -m openai:gpt-3.5-turbo -p "Extract text from this image" -a /path/to/image.jpg
2. chat
Start an interactive chat session with a specified model. Your local terminal will prompt for user input, and the assistant response will stream back.
• Required option:
--model / -m : The model in ":<model_name>" format.
Example:
llx chat --model openai:gpt-3.5-turbo
Then type your messages. Type /bye or press Ctrl+C to exit.
3. server
Start a small FastAPI server to expose a chat completions endpoint (POST /v1/chat/completions). This is helpful if you want to run your own local API wrapper.
• Options:
--host : Defaults to 127.0.0.1.
--port : Defaults to 8000.
Example:
llx server --host 127.0.0.1 --port 8000
You can then send POST requests to http://127.0.0.1:8000/v1/chat/completions.
4. url_to_prompt
Crawl one or more URLs, optionally extracting text from HTML, and print the content (plus an optional prompt) to stdout.
• Required option:
--url : The starting URL to begin crawling.
• Optional:
--prompt / -p : A prompt to prepend.
--extract-text : Extract text instead of returning raw HTML.
--domain : Restrict crawling to this domain.
--max-depth : Depth of links to follow (defaults to 1).
--max-urls : Max number of links to crawl (defaults to 1).
Example:
llx url_to_prompt --url https://example.com --prompt "Summarize the following:" --extract-text true --max-depth 2 --max-urls 5
This will print the extracted text from up to 5 URLs (within 2 link levels from the start) in a structured format alongside your prompt.
5. files_to_prompt
Concatenate the contents of all files in a directory into a single prompt (printed to stdout). You can prepend an optional prompt string.
• Required options:
--path : Directory path containing the files.
• Optional:
--prompt / -p : A prompt to prepend.
Example:
llx files_to_prompt --path /path/to/documents --prompt "Here are the contents of my documents:"
This command walks through each file, ignoring binary files, and combines them in an XML-like structure printed to stdout.
6. audio_to_prompt
Perform speech-to-text on the given audio file, and prepend the resulting text as context to the LLM prompt.
• Required options:
--path : Path to the audio file.
--model / -m : Model in ":<model_name>" format.
• Optional:
--prompt / -p : A prompt to prepend to the transcribed text.
Example:
llx audio_to_prompt --path /path/to/speech.wav --model openai:whisper-1 --prompt "Transcribe and analyze this audio:"
(Note: Actual speech-to-text logic is a placeholder in this example; implement your own logic or extend the code where needed.)
7. evals
Run evaluation scripts against a specified LLM.
• Required options:
--path : Path to the evals file.
--model / -m : Model in ":<model_name>" format.
Example:
llx evals --path /path/to/evals.json --model openai:gpt-3.5-turbo
Customize this command for your own testing or evaluation methods.
Environment Variables
Providers require API keys to function. Store them in a .env file in your working directory or set them directly in your shell environment. For example:
• OPENAI_API_KEY
• ANTHROPIC_API_KEY
• DEEPSEEK_API_KEY
• MISTRAL_API_KEY
• GEMINI_API_KEY
• XAI_API_KEY
Use the .env.example file as a reference.
Example .env:
OPENAI_API_KEY=<your-openai-key>
ANTHROPIC_API_KEY=<your-anthropic-key>
...
Contributing
- Clone the repository.
- Create and activate a virtual environment.
- Install dependencies by running pip install -e .
- Develop and submit pull requests.
We appreciate bug reports, feature requests, and pull requests!
License
This project is licensed under the MIT License. See the LICENSE file for details.
Happy prompting! If you have any questions or issues, feel free to open a GitHub issue.%
Metadata
Release files for llm-tools-cli 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| llm_tools_cli-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Release files / llm_tools_cli-0.1.0-py3-none-any.whl
| Download URL | llm_tools_cli-0.1.0-py3-none-any.whl |
|---|---|
| Size | 18.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
198f1b3306627ea0b412d5df60f1b9f70dd76ae969c80c761bb5c4081ea9e1b1
|
|
BLAKE2b-256 checksum How to use checksums |
39e114f20a8927bc9451c13c6802ad994bf206a44ff21b18f070c943f72c2aa5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.4
|
Security for llm-tools-cli 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.