General
Use host.docker.internal to reach local Ollama from Mule
0 views

Problem
The flow failed with a connection refused error when the configuration used http://localhost:11434/v1 as the base URL. The MuleSoft Inference Connector enables text generation workflows docs.
Input
{
"prompt": "Reply with exactly one word: pong"
}
Working configuration
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:http="http://www.mulesoft.org/schema/mule/http"
xmlns:ms-inference="http://www.mulesoft.org/schema/mule/ms-inference"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/ms-inference http://www.mulesoft.org/schema/mule/ms-inference/current/mule-ms-inference.xsd">
<http:listener-config name="http-listener-config">
<http:listener-connection host="0.0.0.0" port="8081" />
</http:listener-config>
<ms-inference:text-generation-config name="ollama-openai-compatible">
<ms-inference:openai-compatible-connection
openAICompatibleModelName="qwen2.5:14b"
openAICompatibleURL="http://host.docker.internal:11434/v1"
apiKey="ollama"
maxTokens="16"
temperature="0"
topP="1"
timeout="120" />
</ms-inference:text-generation-config>
<flow name="ask">
<http:listener config-ref="http-listener-config" path="/ask" />
<ms-inference:chat-answer-prompt config-ref="ollama-openai-compatible">
<ms-inference:prompt>#[payload.prompt]</ms-inference:prompt>
</ms-inference:chat-answer-prompt>
</flow>
</mule>
Output
{"response": {"response": "Pong"}, "status": 200}
The response field contains the model output, and status shows 200.
The trap
Using http://localhost:11434/v1 as the base URL causes a connection refused error.
What I do now
I configure openAICompatibleURL to http://host.docker.internal:11434/v1 in the connector configuration.
Runs shown: Mule 4 Community kernel 4.12.0
104 DataWeave patterns + 8 Exchange modules with 208 MUnit tests: github.com/shakarbisetty/mulesoft-cookbook | 60-second walkthroughs: youtube.com/@SanThaParv
Read original: https://dev.to/thasha/use-hostdockerinternal-to-reach-local-ollama-from-mule-1p02
PreviousUSDC Escrow for AI Agents: How Trustless Freelancing Actually WorksNextUser Consent Management: One Choice Should Never Become Two Records
Related posts
Recognizing Keystrokes Using WiFi Devices
0Lobsters
Polyend releases the Tracker firmware source code
0Lobsters
eli venn
0Lobsters

16GB Raspberry Pi 5 hiked to $385, more than triple its launch price — makers are already shifting to Pico/ESP32 for small projects, mini PCs for more ambitious tasks
0Tom's Hardware
The Trump Administration Is Wreaking Havoc on the Electoral System Before the Midterms
0Wired

YouTuber Druski is going to make exclusive content for Netflix
0The Verge