Run your own model
On this page
Run your own model
Lensy answers with the model you point it at. A model on your own machine or network keeps everything inside it: the questions and the tool results never go to a provider. This page helps you choose a model, run it, connect BxLens to it and check that it works.
The Settings, Assistant page of the console has a card, Run your own model, with the same steps and a Use these settings button that fills the model fields for you. It does not save: you press Save the model, then Test connection.

The assistant needs BoxLang+ or a trial. See Licensing.
Choose a model
Lensy works by calling tools, so the model has to support tool calling (also called function calling). A model that does not will answer from memory instead of reading your server, and Lensy will say so.
| What | Why |
|---|---|
| Tool calling | Lensy offers its tools and the model chooses which to call. In the Ollama library, look for the tools label on the model page. |
| A context window of at least 16,000 tokens | The tool definitions alone are about 5,000 tokens for an admin (about 4 characters make a token, so this is an estimate), a tool result can add up to about 3,000 more, and the conversation comes on top. Check the window of your model with ollama show <model>. Many Ollama versions start with a small window: raise it with the OLLAMA_CONTEXT_LENGTH environment variable of the Ollama server. |
| Memory | The model has to fit in RAM, or in video memory when you use a GPU. A model of 3 billion parameters needs a few gigabytes, 8 billion about 8 GB, and larger ones much more. Check the size on the model page. |
| Speed | The first question loads the model, which can take a minute. An answer has to finish within ai.timeoutSeconds (default 120). |
A small model handles simple questions ("how many requests?"). A larger one is better when Lensy has to read several tools and put the answer together. Start with the default and move up if answers are thin.
Models tested with Lensy
A model is listed here only when it passed every question of the smoke test (see Test the model), with the date and the version of BxLens. Anything else is untested: it may work, and the smoke test tells you.
| Model | Provider | Tested on | BxLens | Result |
|---|---|---|---|---|
| none yet | The smoke test has been run against a stand-in server to test the script itself. No real model has been listed, because none has been run through it yet. |
To add a row, run the smoke test with the model, and send the output with the model name and its exact tag.
1. Ollama on this machine
# install from https://ollama.com, then:
ollama pull llama3.2 # the chat model
ollama pull nomic-embed-text # the embedding model for the documentation search
ollama serve # if it is not already running as a service
Ollama listens on http://localhost:11434, which is what BxLens expects. The defaults are ai.provider: "ollama", ai.model: "llama3.2", ai.baseUrl: "http://localhost:11434" and ai.embeddingModel: "nomic-embed-text".
Turn the assistant on in Settings, Assistant (Enable the assistant, Save the model, Test connection), or in boxlang.json:
{ "modules": { "bxLens": { "settings": { "ai": { "enabled": true } } } } }
2. Docker Compose
This runs Ollama in a container, keeps the models in a volume and pulls the two models once. The file is tools/ai/docker-compose.ollama.yml in the BxLens repository.
services:
ollama:
image: ollama/ollama:latest
# Only this machine can reach it. Ollama has no login: do not publish it on a network you do not control.
ports:
- "127.0.0.1:11434:11434"
volumes:
- ollama:/root/.ollama
restart: unless-stopped
# The pull service waits until the server answers
healthcheck:
test: ["CMD", "ollama", "list"]
interval: 5s
timeout: 5s
retries: 30
# NVIDIA GPU: uncomment the next lines (needs the NVIDIA Container Toolkit)
# deploy:
# resources:
# reservations:
# devices:
# - driver: nvidia
# count: all
# capabilities: [gpu]
# Pulls the chat model and the embedding model once, then exits.
ollama-pull:
image: ollama/ollama:latest
depends_on:
ollama:
condition: service_healthy
environment:
OLLAMA_HOST: "http://ollama:11434"
entrypoint: ["/bin/sh", "-c", "ollama pull llama3.2 && ollama pull nomic-embed-text"]
restart: "no"
volumes:
ollama: {}
docker compose -f docker-compose.ollama.yml up -d
docker compose -f docker-compose.ollama.yml logs -f ollama-pull # the first start downloads the models
Then use provider ollama, address http://localhost:11434. Notes:
- The port is published on
127.0.0.1only, so only this machine can reach it. If BxLens runs in another container, put both in the same Compose network and usehttp://ollama:11434. - With an NVIDIA GPU, uncomment the
deployblock (it needs the NVIDIA Container Toolkit). - The models live in the
ollamavolume, so they survivedocker compose down.down -vremoves them. - The syntax of this file is checked with
docker compose config. It has not been run in an automated test: if something is wrong on your machine, please tell us.
3. Docker Model Runner
Docker Model Runner comes with Docker Desktop and runs models with GPU acceleration. BxLens has a provider for it.
- Turn Model Runner on in Docker Desktop and pull a model:
docker model pull <model>.docker model listshows the names to use. - In Settings, Assistant set the provider to
dockerand the model to the name fromdocker model list. - The address from this machine is
http://localhost:12434/engines/v1. From a container it ishttp://model-runner.docker.internal/engines/v1. It needs no key.
Check that the model you chose supports tool calling and has a large enough window (see above): Model Runner serves whatever you pull.
4. Another server, an OpenAI compatible server or a hosted provider
| You have | Provider | Address (ai.baseUrl) | Key |
|---|---|---|---|
| Ollama on another machine or container | ollama | http://ollama.internal:11434 | none |
| vLLM, LM Studio, the llama.cpp server, a gateway | openai-compatible | the address with /v1, for example http://localhost:8000/v1 | if the server wants one |
| OpenAI, Claude, Gemini, Mistral, Groq and others | openai, claude, gemini, mistral, groq, grok, deepseek, openrouter, cohere | leave empty | ai.apiKeyEnv |
For a key, put it in an environment variable of the BoxLang server and give its name in ai.apiKeyEnv (for example OPENAI_API_KEY). You can also paste it into Settings, Assistant (write only, kept sealed, never shown again), which wins over the variable, or keep it in boxlang.json as an encrypted value ("ai": { "apiKey": "bxsecret:..." }). A hosted provider receives what the assistant reads.
Security
- Ollama has no login. Anyone who can reach its port can use it and see what it is sent. Keep it on
127.0.0.1or on a private network, or put it behind a gateway that authenticates. - Lensy sends your tool results to the model: request data, error messages, thread names, settings and log lines, after BxLens has hidden secrets and capped the size. With a model you run, that stays on your network. With a hosted model it does not.
- The assistant cannot run SQL, restart the server, take a heap dump or read files, and every change it proposes waits for your Approve click. A model you run does not change that.
Test the model
The Test connection button checks that BxLens can talk to the model. It does not check that the model uses the tools well. The smoke test does.
tools/ai/smoke.bxs is a BoxLang script that signs in to a running console, asks six fixed questions and checks, for each one, that the model called one of the right tools, stayed inside the tool limit (ai.maxToolCalls), finished within the time and gave an answer. One of the questions asks for an action: the script denies the approval card, so nothing is changed on the server. It prints one line per question and ends with exit code 1 if any failed.
BXLENS_URL=http://localhost:8085/~bxlens/index.bxm BXLENS_PASSWORD=your-console-password \
boxlang tools/ai/smoke.bxs
pass overview (3 s) tools: overview
pass threads (2 s) tools: blockedThreads
...
6 passed, 0 failed. This model works with Lensy on these questions.
BXLENS_TIMEOUT sets the seconds one question may take (default 120). BXLENS_ONLY=overview,docs runs some of them. The script is not part of the module.
If it does not work
| Test connection says | Try |
|---|---|
| Connection refused | Is the server up? curl http://localhost:11434/api/tags. With Compose: docker compose ps. |
| model not found | ollama pull llama3.2 (or the model you set). For other servers use the name the server lists. |
| 401 or 403, key missing | The environment variable named in ai.apiKeyEnv is not set in the BoxLang server, or the key is wrong. |
| 404 | The server answers, but not at that path. An OpenAI compatible address ends in /v1. |
| The embedding test fails | ollama pull nomic-embed-text. The assistant still works: the documentation search falls back to keywords. |
| No answer in 40 seconds | The first request loads the model into memory. Try again, use a smaller model, or raise ai.timeoutSeconds. |
| It answers but never uses a tool | The model does not support tool calling, or its context window is too small. Run the smoke test. |
| It runs out of memory | Use a smaller model, or a smaller context window. |