Skip to main content

Overview

OpenClaw supports local LLM inference via node-llama-cpp and Ollama integration. The prebuilt native binary (@node-llama-cpp/linux-arm64) is included with the installation and loads successfully under the glibc environment — local LLM is technically functional on the phone. However, there are practical constraints to consider before running local models.
☁️ Cloud Models Available: Ollama now supports cloud-hosted models! Use ollama launch openclaw --model kimi-k2.5:cloud for superior performance without local resource usage. See Cloud Models section below.

⚠️ Practical Constraints

For experimentation, small models like TinyLlama 1.1B (Q4, ~670MB) can run on the phone. For production use, cloud LLM providers are recommended.

☁️ Ollama Cloud Models

Best of both worlds: Run models in the cloud with Ollama’s cloud integration — no local RAM/storage constraints!

Quick Start

Commands

Why Cloud Models?

💡 Recommendation: Use cloud models for production workloads, local models for testing/experimentation.

🚀 Quick Start

Why --ignore-scripts? The installer uses npm install -g openclaw@latest --ignore-scripts because node-llama-cpp’s postinstall script attempts to compile llama.cpp from source via cmake — a process that takes 30+ minutes on a phone and fails due to toolchain incompatibilities. The prebuilt binaries work without this compilation step, so the postinstall is safely skipped. Install:
Download a model (TinyLlama 1.1B Q4 - good for testing):
Run inference:

Option 2: Ollama (Full Server)

Ollama provides a complete local LLM server with model management. Install Ollama:
Start the server:
Pull a model:
Chat with a model:
API Endpoint:
Ollama needs more RAM and storage than node-llama-cpp. Recommended only for devices with 6GB+ RAM and 32GB+ free storage.

🔗 Official Ollama OpenClaw Integration

OpenClaw officially integrates with Ollama to provide a seamless local AI assistant experience.

Why it’s powerful

  1. Native API Integration: OpenClaw connects directly to Ollama’s native /api/chat endpoint. This ensures full support for streaming and tool calling.
    ⚠️ Important: Do not use the /v1 OpenAI-compatible URL with OpenClaw. It breaks tool calling and causes models to output raw JSON!
  2. Automatic Model Discovery: OpenClaw queries /api/tags and /api/show to automatically find your downloaded Ollama models, detect if they support tool calling, and configure their context windows appropriately.

Setup Methods

Method A: Ollama Launcher (Recommended) The easiest way to connect OpenClaw to Ollama is using the official launcher command:
This setups the security profile, configures the provider, and sets your primary model. To launch a specific model directly:
Method B: OpenClaw Onboarding Run the onboarding wizard and select “Ollama” when asked for a provider:
It will ask for your Ollama base URL (default is http://127.0.0.1:11434). Method C: Explicit Configuration You can force OpenClaw to use Ollama by exporting the API key environment variable before starting the gateway:

📊 Model Recommendations


🔧 Configuration

node-llama-cpp Context Length

Reduce context length to save RAM:

Ollama Configuration

Set environment variables before starting:

🌐 Cloud vs Local Comparison


🛠️ Troubleshooting

”Cannot find module ‘node-llama-cpp’”

Make sure you installed with --ignore-scripts:

“Out of memory” error

Close other apps and reduce context size:

Ollama killed by Android

Disable Phantom Process Killer:

Model download fails

Use a different mirror or download on PC and transfer:

📚 Resources


💡 Best Practices

  1. Start small: Begin with TinyLlama 1.1B to test your device
  2. Monitor RAM: Use htop or Termux’s top to watch memory usage
  3. Use tmux: Run long inference sessions in tmux to prevent disconnection
  4. Cool your phone: CPU inference generates heat; consider active cooling
  5. Cloud for production: Use local LLM for testing, cloud for real work
Pro Tip: Use OCA’s hybrid mode — route simple queries to local LLM, complex tasks to cloud APIs. Best of both worlds!