Title: chat-cli: renamed and added Ollama support
Author: Alex Kirk
Published: October 20, 2023
Last modified: October 26, 2023

---

# chat-cli: renamed and added Ollama support

October 20, 2023

I have added support for [Ollama](https://github.com/jmorganca/ollama) to my [chat-cli tool](https://github.com/akirk/chat-cli)(
formerly named cli-chatgpt, see [previous posts](https://alex.kirk.at/2023/09/25/resuming-chatgpt-chats-in-cli/)).
Ollama is a very easy way to run `llama2` locally; it runs a local HTTP server and
this will be used.

Depending on whether an OpenAI key or Ollama are available, the models will be made
available and you can see this in `cgt -h`. (Using `cgt` as a command here is based
on my recommendation of using an alias in your shell.)

When you’re offline, OpenAI is deemed unavailable, thus–if it is installed and active–
Ollama/llama2 will be used automatically. While it currently doesn’t switch between
models during a conversation (because of your online state), you can simply exit
and re-continue the conversation with another model using `cgt -l`.

Both models show their responses in a streaming way.

    ```wp-block-code
    ❯ cgt where is gerolstein
    Model: gpt-3.5-turbo
    > where is gerolstein

    Gerolstein is a town in the Bitburg-Prüm district in Rhineland-Palatinate, Germany. It is located in the Eifel mountain range, approximately 15 kilometers southeast of Bitburg.
    > ^c

    ### Went offline here.
    ❯ cgt where is gerolstein
    Model: llama2:latest
    > where is gerolstein

     Gerolstein is a town located in the state of Rhineland-Palatinate, Germany. It is situated in the northern part of the state, approximately 20 kilometers (12 miles) northwest of the city of Mainz. The exact address of Gerolstein is:

    Gerolstein, Germany

    If you are planning to visit Gerolstein or need more detailed information, please let me know and I will be happy to help.
    > 
    ```

While there is no config available, you can [change the priority of models in the source](https://github.com/akirk/chat-cli/blob/ce91064d4fa3464bab2eaace12c88f41351f2876/chat.php#L28).

###### Fediverse Reactions

 *  [ ⌊anonymous⌉ ](https://cagrimmett.com/likes/6bf6795456/)
 *  [ ⌊anonymous⌉ ](https://cagrimmett.com/likes/6bf6795456/)

[AI](https://alex.kirk.at/category/ai/), [Explorations](https://alex.kirk.at/category/explorations/)

[ChatGPT](https://alex.kirk.at/tag/chatgpt/), [Llama2](https://alex.kirk.at/tag/llama2/),
[LLMs](https://alex.kirk.at/tag/llms/), [Ollama](https://alex.kirk.at/tag/ollama/)

Read this next

[Previous Post](https://alex.kirk.at/2023/10/12/1888341/)

## 2 responses to “chat-cli: renamed and added Ollama support”

 1. [alex.kirk.at](https://alex.kirk.at/2024/08/26/cll-now-works-with-local-files-and-improves-output-formatting/)
 2. [August 26, 2024](https://alex.kirk.at/2023/10/20/chat-cli-renamed-and-added-ollama-support/comment-page-1/#comment-86007)
 3. I’ve written about my cll tool before and it is still my go-to way of communicating
    with LLMs. See the Github repo. As a developer,…
 4. [Log in to Reply](https://alex.kirk.at/wp-login.php?redirect_to=https%3A%2F%2Falex.kirk.at%2F2023%2F10%2F20%2Fchat-cli-renamed-and-added-ollama-support%2F)
 5. [alex.kirk.at](https://alex.kirk.at/2024/11/15/setting-up-a-local-ollama-copilot-via-lsp/)
 6. [November 15, 2024](https://alex.kirk.at/2023/10/20/chat-cli-renamed-and-added-ollama-support/comment-page-1/#comment-87727)
 7. I am quite interested in running AI offline. Thus I really like Ollama, and have
    added automatic failover from ChatGPT to a local AI to…
 8. [Log in to Reply](https://alex.kirk.at/wp-login.php?redirect_to=https%3A%2F%2Falex.kirk.at%2F2023%2F10%2F20%2Fchat-cli-renamed-and-added-ollama-support%2F)

### Leave a Reply 󠀁[Cancel reply](https://alex.kirk.at/2023/10/20/chat-cli-renamed-and-added-ollama-support/comment-page-1/?output_format=md#respond)󠁿

Only people in [my network](https://alex.kirk.at/friends/) can comment.

This site uses Akismet to reduce spam. [Learn how your comment data is processed.](https://akismet.com/privacy/)