An open API service indexing awesome lists of open source software.

https://github.com/haalven/llm_terminal

ask LLMs in the terminal
https://github.com/haalven/llm_terminal

chatgpt command-line gemma2 gpt4o llama3 ollama-api openai-api python terminal

Last synced: about 1 month ago
JSON representation

ask LLMs in the terminal

Awesome Lists containing this project

README

          

# ask LLMs in the Terminal

`ask_openai.py` – call the [OpenAI API](https://openai.com/api), `API_KEY` required

`ask_ollama.py` – call the [local Ollama API](https://ollama.com/) (localhost:11434)

required:
* [prompt_toolkit](https://github.com/prompt-toolkit/python-prompt-toolkit) (input)
* [openai](https://github.com/openai/openai-python) (ask_openai.py)
* [requests](https://requests.readthedocs.io/) (ask_ollama.py)
* [rich](https://github.com/Textualize/rich) (output)

## OpenAI API

[ask_openai.py](https://github.com/haalven/LLM_terminal/blob/main/ask_openai.py) uses the [openai Python library](https://github.com/openai/openai-python) to call the [OpenAI API](https://openai.com/api). An internet connection is required.

[ask_openai.toml](https://github.com/haalven/LLM_terminal/blob/main/ask_openai.toml) ➔ you have to insert your `API_KEY` by editing the `my_api_key = "sk-***"` line before running the script.

usage: `./ask_openai.py [question?]`

Choose a specific OpenAI model ➔ see: [platform.openai.com/docs/models](https://platform.openai.com/docs/models).

## Ollama API

[ask_ollama.py](https://github.com/haalven/LLM_terminal/blob/main/ask_ollama.py) uses the [requests Python library](https://requests.readthedocs.io/) to call the [local Ollama API](https://ollama.com/) (based on [llama.cpp](https://en.wikipedia.org/wiki/Llama.cpp)). An internet connection is not required. Install Ollama first and start the local server (localhost:11434). To download LLMs use the `ollama run ` command.

usage: `./ask_ollama.py [question?]`

Good general LLMs for computers with 8…16 GB of RAM in 2026 are `gemma3:12b` by Google (12B, 8.1GB) and `llama3.1:8b` by Meta (8B, 4.9 GB). See also: [ollama.com/models](https://ollama.com/models). and [canirun.ai](https://www.canirun.ai)

## Example

![example screenshot](example1.jpg)