Google Gemini's “Ragnarok scenery image”

Host Ollama using Ngrok

Spoiler: Run Ollama and use ngrok to expose your Mac mini to the internet

Sarin Suriyakoon
2 min readFeb 27, 2024

--

Who should read this?

  • If you are looking for on Private Team or Organization AI Assistant, This guide is for you.
  • If you are looking for a Private LLM REST API that is hosted on your team or organization Mac mini, This guide is also for you.
  • You fit the criteria above and also want a quick and easy setup.

Prerequisite

  • You have a Mac mini, or Macbook(Other platforms should work too)
  • You understand how REST API works, or use REST API before.

Tunnel Tools

  • Ngrok is a secure reverse proxy service(aka expose your laptop/cloud to the internet, or in other words, make it accessible from the internet) that comes with great features such as free domain. “You can think of ngrok as the front door to your applications” — ngrok doc
  • Alternative: https://zrok.io/ is another candidate recommended by the reader. On the front page, it said “An open source sharing solution built on OpenZiti, the zero trust networking platform. Available as SaaS or self-hosted.”(not included here)

Large Language Model Tools

  • Ollama is a software package that allows you to run the LLM model on your local. With a few clicks, you got the REST API of LLM of your choosing running on your local machine.
  • Alternative: Hugging Face Transformer Library with your Favorite Language(not included here)

Overview

Here is a list of what we are going to do to achieve this setup.

  • Install and Run Ollama
  • Install and Run Ngrok
  • Test the Setup from an outside network(Mobile or Outside network Laptop)

Install and Run Ollama

Install and Run Ngrok

ngrok http http://localhost:11434

Because Ollama is running at http://localhost:11434

Test the Setup

From MacOS/Linux

Run curl in your terminal

curl http://localhost:11434/

From Mobile Phone(Android)

Download API Tester App

and use the same curl as MacOS/Linux

More Configuration and Integrations

--

--