Dograh

Ollama Voice Assistant: Run a Voice Agent With a Local LLM

Ollama Voice Assistant: Run a Voice Agent With a Local LLM
TutorialDecember 1, 2026·12 min read

Ollama Voice Assistant: Run a Voice Agent With a Local LLM

Abhishek Kumar
Abhishek Kumar·Co-founder, Dograh AI

Co-founder of Dograh, building the future of open-source voice AI agents. Own your voice AI stack.

To build an Ollama voice assistant, run Ollama beside your voice platform, pull a tool-calling model, and point the platform at Ollama's OpenAI-compatible address. Add speech-to-text and a voice, then test by phone. For teams that keep models on their own servers, a self-hosted install of Dograh, the open-source AI voice agent platform, connects to Ollama this way.

Key Takeaways

  • Inside Dograh's container, localhost:11434 is Dograh itself, so use ollama:11434.
  • Ollama unloads an idle model after 5 minutes, so the next call waits.
  • Hosted speech or a hosted carrier still receives call audio, even with a local LLM.

Here we build an Ollama voice assistant, step by step, in Dograh. We run Ollama beside it in Docker, connect the two, size the hardware and add speech for phone calls, and we finish with the delay callers hear and what still leaves your own server.

What you need before you start

These steps follow the published Dograh and Ollama docs. Run them on a trial server before production. Each command names its source in the lead-in, and the one block we wrote ourselves is marked as an adaptation.

  • A self-hosted Dograh install running with Docker Compose, from Dograh's Docker setup guide, on a Linux server you control.
  • An NVIDIA GPU with the NVIDIA Container Toolkit installed. Ollama's GPU page lists NVIDIA cards with compute capability 5.0 or higher and driver 550 or newer, AMD cards through ROCm v7 on Linux, and Apple chips through Metal.
  • A phone carrier account such as Twilio, Telnyx or Plivo, with one number you can point at the agent.
  • A plan for speech-to-text and the voice, either local models or hosted keys.

Card size decides which models fit. A model, its context and any local speech models all share the card's memory, and our guide to GPU sizing for self-hosted voice agents works through the numbers by card.

Why run the language model next to Dograh

Ollama runs the language model and nothing else. Most Ollama voice assistants online are a short Python loop on a laptop that records a few seconds, transcribes, asks the model and speaks the reply. That works for a desk demo, but a phone agent also needs turn-taking, tools, a carrier connection and a record of every call.

Dograh carries the call itself, from the flow and its tools to the phone line, and you plug in the speech and language models it uses. Ollama takes the language slot through its OpenAI-compatible address, the same kind of address a hosted model uses, so the platform needs no special code for it.

This is a self-hosted setup. Ollama has to sit on a network the platform can reach, and Dograh Cloud only calls public addresses, so the platform runs on your server too. That is also the point, since a language model on your own GPU means the prompts and conversation history for that step stay on hardware you control.

Step 1: Add Ollama to Dograh's compose file

Run Ollama inside the same Docker setup as the platform, so the two containers share a network. This matters because Dograh's default address for a local model is http://localhost:11434/v1, and inside Dograh's API container localhost is the container itself. Ollama on its own would never answer there.

One server holds two containers on a shared network. A request from Dograh's API container to localhost loops back into the same container and is crossed out. A request by the name ollama on port 11434 reaches the Ollama container on the GPU, while traffic from the internet stops at the server's firewall.
Left on the localhost default, every model request turns back inside Dograh's own container and Ollama never replies. A shared compose network is what makes the short service name reach the container on the GPU.

The block below is our adaptation of the docker run line on Ollama's Docker page, with the GPU lines from Docker's GPU guide for Compose. Add it under services: in the docker-compose.yaml inside your dograh folder. It names the container ollama, keeps models in the ollama volume, joins Dograh's app-network, and publishes port 11434 on 127.0.0.1 only.

  ollama:
    image: ollama/ollama
    container_name: ollama
    volumes:
      - ollama:/root/.ollama
    ports:
      - "127.0.0.1:11434:11434"
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: all
              capabilities: [gpu]
    networks:
      - app-network

What this does: It adds Ollama to the stack on the GPU. Dograh reaches it by the name ollama on port 11434, and you can reach it from the server itself on the same port, while nothing outside the server can.

Then add ollama: under the top-level volumes: list and start the new service with sudo docker compose up -d ollama from the dograh folder. Keep port 11434 closed in your firewall. Ollama ignores API keys, so anyone who reaches that port can use your GPU.

Check: sudo docker ps lists a running container named ollama.

Step 2: Pull a model that can call tools

Pick a model that supports tool calling, because a phone agent uses tools to look things up and to end or transfer calls. Ollama's tool calling page uses qwen3 as its example, so we use it here. The command below is the run line from Ollama's Docker page with qwen3 in place of llama3.2.

docker exec -it ollama ollama run qwen3

What this does: It downloads qwen3 into the ollama volume and opens a chat prompt inside the container. Type a short question to see it answer, then /bye to leave.

Then check the address Dograh will use. Ollama's OpenAI compatibility page lists a /v1/models route, and chat completions there support streaming and tools. The request below asks the server which models it holds.

curl http://localhost:11434/v1/models

What this does: It returns a JSON list that should include qwen3. The exact name in that list is the name you type into Dograh later.

Check: the JSON list includes the model you pulled.

Dograh

Open Source Alternative to Vapi / Retell

Self-hosted voice agent platform — no per-minute fees

dograh-hq/dograh

Star on GitHub

Step 3: Keep the model loaded and give it room

Two Ollama defaults matter on calls. Ollama's FAQ says models are kept in memory for 5 minutes before being unloaded, and Ollama's context length page sets the default context by GPU memory, 4k tokens on cards under 24 GiB. The first default makes a quiet line slow, and the second can cut a long prompt short.

After 5 idle minutes, the next call waits while the model loads back onto the GPU. Set OLLAMA_KEEP_ALIVE on the service to keep it loaded longer, where any negative number such as -1 keeps it loaded until the server restarts. A voice agent prompt with tools and a few minutes of conversation can pass 4k tokens, so on a smaller card set OLLAMA_CONTEXT_LENGTH higher, keeping in mind that more context takes more GPU memory. Add both to the ollama service.

    environment:
      - OLLAMA_KEEP_ALIVE=-1
      - OLLAMA_CONTEXT_LENGTH=8192

What this does: It keeps qwen3 loaded on the GPU between calls and gives each request a context of 8192 tokens. On a card with 24 GiB or more, leave the context line out, since Ollama's default there is already larger. Run sudo docker compose up -d ollama again so the container picks up the new values.

Then confirm the model sits fully on the GPU. Part of a model on the CPU makes every reply slower.

Check: docker exec -it ollama ollama ps shows qwen3 with 100% GPU.

Step 4: Connect Ollama as a provider in Dograh

Now tell Dograh where the model lives. The provider type for any OpenAI-compatible server is called Local Models (Speaches), and Dograh's LLM provider page lists Ollama and vLLM among the endpoints it supports.

Open Providers in the sidebar and click Add Provider. Choose Local Models (Speaches) and give the connection a name such as Ollama on GPU, so you can tell it apart from a speech server later. Under Connection settings, set the base URL to http://ollama:11434/v1. Leave the API key empty, because Ollama does not check one. Then click Save Connection.

Check: the new connection appears as its own row in Providers.

Step 5: Put it in a model configuration

A configuration ties the language model to speech-to-text and a voice. Open Models in the sidebar, click Add Configuration, name it, and choose BYOK mode, which takes a separate connection for each service, as Dograh's model configuration guide explains.

On the LLM tab, pick the Ollama connection and type the model name exactly as /v1/models listed it, using Enter Custom Value if it is not in the dropdown. Fill the speech-to-text and voice tabs with the services from the next step, then save. Click Make org default if every agent should use it, or leave it and choose it per agent in the agent's Model tab, since models are chosen per agent.

Check: the configuration appears under Named Model Configurations with the Ollama connection on its LLM tab.

Join the Dograh Community

Dograh is an OSS alternative to Vapi. Join our Slack community for queries, releases, best practices & community interactions.

Step 6: Choose speech-to-text and a voice

The language model is one of three parts of every turn. For a fully local agent, run Speaches, an OpenAI-compatible server for faster-whisper speech-to-text and Kokoro voices, and connect it with the same Local Models (Speaches) provider on its own connection. Our tutorial to run faster-whisper locally adds Speaches to the same compose file and covers its model downloads.

Dograh sends Speaches each finished stretch of the caller's speech as one request, not a running stream. That keeps the setup simple, but every turn waits for the transcript first, so start on a small English model and move up only when real calls show errors.

You can also mix. A hosted speech-to-text service and a hosted voice next to a local Ollama is a common first build, because it gets good call audio quickly. The table further down shows what each hosted part receives.

Check: the configuration's speech-to-text and voice tabs each point at a saved connection.

Step 7: Build on the canvas and test by phone

Create the agent, then test it in a browser before a real call. On Dograh Cloud, and on a self-hosted install connected to a free Dograh account, new agents start in the Agent Builder. You can also start from a blank canvas.

The Agent Builder runs on Dograh's hosted models, so on a server with no internet access you build on the canvas. If the agent's description should stay on your server too, open Voice Agents, click Create Agent and choose Blank Canvas, then write the prompts in the nodes yourself. In the Model tab, pick the configuration from Step 5.

Click Test Agent for a browser call first, then place a phone call to your own mobile. Phone audio reaches the agent at a lower quality than a browser call, so a model that sounds fine in the browser can mishear on the phone.

Check: the agent answers both calls, and ollama ps shows the model still loaded after the second one.

What still leaves your server

A local language model keeps one part of the call at home. Every hosted service you keep still receives the data its job needs, so the table below goes part by part.

Part of the callLocal optionWhat a hosted option receives
Language modelOllama on your GPUPrompts, conversation history, tool definitions and results
Speech-to-textSpeaches with faster-whisperThe caller's audio
VoiceSpeaches with KokoroThe text of each reply
Phone lineAsterisk ARI to your own PBXThe call audio and the carrier's call records
TracingLangfuse only once you add its keysEach call's trace
Tools and webhooksYour own systemsWhatever you send them

The phone line is the part people forget. A hosted carrier such as Twilio carries the call audio and keeps its own records, and the server must be reachable from the internet for it. Asterisk ARI keeps the connection inside your network, though the public phone leg still passes through whatever trunk your PBX uses. Our guide to offline voice agents covers that route.

Two more switches sit in your hands. Telemetry can be switched off with ENABLE_TELEMETRY=false when self-hosting. A backup LLM is optional, and if it points at a hosted model, text leaves the server whenever it takes over, so a fully local setup points it at a second local model or leaves it off.

The delay callers hear

On a phone call, the silence after the caller stops talking is what feels slow. With Ollama it comes down to whether the model is already loaded, how big the model is for your card and how long the prompt has grown.

The cold load is the easy one to fix, and Step 3 already did. Model size is the real trade. A smaller model answers sooner and calls tools less reliably, a larger one does the reverse, and a model that spills off the GPU is slow at any size. Laptop builds that chain three models on a consumer card often take several seconds a turn, which is too slow for a phone rhythm.

Measure on your own hardware rather than trusting a number from someone else's. Our explainer on time to first token covers how to read that figure, and our guide to build a voice agent with local open-source models compares runtimes and gives a measured result on one card.

Before you ship it

Lock the model server down first. Keep port 11434 off the public internet, and if Ollama moves to its own GPU machine, put both servers on a private network and use that machine's private address in the connection.

Then plan upkeep. A self-hosted Dograh install carries no per-minute platform fee. The GPU server, any hosted speech keys and the phone minutes still cost money, and your team looks after the database, the model downloads and every upgrade. Help comes from the open-source community, with custom SLAs on Enterprise, and Dograh Cloud runs the platform for a 1¢-a-minute platform fee if you later keep only hosted models.

Last, repeat the phone test after every model change. A new model name, a bigger context or a different quantization changes both the answers and the delay, so re-run the Step 7 checks before callers hear it.

Glossary

OpenAI-compatible endpoint
A server that accepts the same requests as OpenAI's API, such as /v1/chat/completions. Ollama exposes one at /v1, so any client that speaks that API can use it.
keep_alive
How long Ollama keeps a model in GPU memory after its last request. The default is 5 minutes, and a negative value keeps it loaded.
Context window
The number of tokens a model reads per request, including the prompt, tools and conversation so far. Ollama sets the default by GPU memory, 4k tokens on cards under 24 GiB.
Compose network
The private network Docker Compose creates for a project's containers. Containers on it reach each other by service name, such as ollama:11434.

Frequently Asked Questions

Get started with Dograh

Build, deploy, and scale AI agents with Dograh. Join the community of developers building the future.