Skip to content

OpenAI Endpoint Guide

Carlos Catly edited this page Jul 25, 2026 · 3 revisions

Setting Up an OpenAI-Compatible Endpoint (Ollama + Gemma 4)

This guide walks you through setting up a local translation LLM on your computer using Ollama and configuring it as an OpenAI-Compatible Endpoint in Aibou.


Why a Custom System Prompt is Required

When Aibou sends translation requests—especially batch translations—it uses a specific delimiter (|||) to separate multiple lines of text in a single request.

Without explicit instructions, general chat AI models may try to answer conversationally (e.g., "Here is your translation: ...") or strip out the required formatting delimiters. We will set up a custom Modelfile in Ollama to instruct Gemma 4 to act strictly as a translation engine that honors Aibou's syntax.


Step 1: Install Ollama

  1. Download and install Ollama from https://ollama.com/.
  2. Once installed, open your terminal (Command Prompt, PowerShell, or macOS/Linux Terminal) to verify it is working:
    ollama -v

Step 2: Create the Translator Modelfile

To configure Gemma 4 with the required translation system prompt, create a custom model definition:

  1. Create a new text file anywhere on your computer (for example on your Desktop or inside a dedicated project folder) and name it simply Modelfile (no file extension).
  2. Paste the following configuration into the file:
FROM gemma4

SYSTEM """
You are a direct professional Japanese-to-English translation engine.
Your task is to translate the text sent by the user directly into fluent English.

Strict Rules:
1. ONLY output the direct English translation. Do NOT include explanations, greetings, introduction, or conversational filler of any kind.
2. If the input text contains multiple segments separated by the '|||' delimiter, you MUST preserve the exact same '|||' delimiter between your translated segments in the output. Do not add spaces or formatting around '|||'.
3. Maintain the exact same number of separated segments as provided in the input.
"""
  1. Open a terminal in the folder where you saved your Modelfile and run the following command to download Gemma 4 and build your translation model:
    ollama create aibou-gemma4 -f Modelfile
    (This creates a custom model named aibou-gemma4 pre-configured with Aibou's translation rules).

Step 3: Enable Ollama on Your Local Network

By default, Ollama only accepts connections from localhost (127.0.0.1). If you are running Aibou on an Android device connected to the same Wi-Fi network as your PC, you need to instruct Ollama to listen to incoming network requests:

On Windows (PowerShell)

Set the host environment variable and run Ollama:

$env:OLLAMA_HOST="0.0.0.0"
ollama serve

(Tip: To make this permanent on Windows, add OLLAMA_HOST with a value of 0.0.0.0 under System Environment Variables and restart your PC/Ollama app).

On macOS / Linux

OLLAMA_HOST=0.0.0.0 ollama serve

Step 4: Find Your PC's Local IP Address

Your phone needs your PC's local Wi-Fi IP address to communicate with Ollama:

  • Windows: Open Command Prompt / PowerShell and run ipconfig. Look for the IPv4 Address under your active Ethernet/Wi-Fi adapter (e.g., 192.168.1.50).
  • macOS/Linux: Run ifconfig or ip a.

Step 5: Configure Aibou

Open the Aibou App on your Android device and navigate to your API configurations:

  1. Select OpenAI Endpoint as your translation provider.
  2. Enter the following details:
    • API URL: http://<YOUR-PC-IP-ADDRESS>:11434/v1/chat/completions
      (Example: http://192.168.1.50:11434/v1/chat/completions)
    • API Key: ollama
      (Ollama ignores the API key, but standard OpenAI clients require a non-empty string here).
    • Model Name: aibou-gemma4
  3. Tap Save / Test to activate the endpoint!

Optional: Access Outside Your Local Network (Tailscale)

If you want to use Aibou with your local model while away from home (on mobile data or external Wi-Fi) without risking security by port forwarding your router, you can use Tailscale:

  1. Install the Tailscale app on both your PC running Ollama and your Android device running Aibou.
  2. Log into the same Tailscale account on both devices to connect them to your private virtual mesh network (Tailnet).
  3. Find your PC's Tailscale IP address in the app (usually starting with 100.x.x.x).
  4. In Aibou, replace your home local IP in the API URL with your PC's Tailscale IP:
    http://<YOUR-TAILSCALE-IP>:11434/v1/chat/completions
    (Example: http://100.85.23.41:11434/v1/chat/completions)

As long as Tailscale is running on both devices and Ollama is set to listen on 0.0.0.0 (from Step 3), Aibou can securely communicate with your PC's LLM from anywhere in the world!

Clone this wiki locally