Many coding tools can talk to the same OpenAI-style API, and that is what makes this setup possible. Ollama Local AI turns an Android phone into an OpenAI-compatible server on your local network, and Cursor lets you override the OpenAI base URL. Together they let you point Cursor at the phone instead of a hosted service, as long as your version of Cursor can reach private network addresses. The steps below follow the quick start from the app and add the checks that save time when something does not connect.
What you need before you start
- An Android phone running Android 8.0 or newer with Ollama Local AI installed (Google Play listing).
- A local GGUF model loaded in the app, or at least one cloud provider key added in the app. If you are new to model files, see how to run an LLM on Android.
- A computer running Cursor that is connected to the same Wi-Fi network as the phone.
Step 1: Start the server on the phone
Open the app, pick a local GGUF model (or add your cloud provider keys), and tap Start Server. Leave the phone awake and on Wi-Fi while you work. Android may restrict background apps to save battery, so if the connection drops after the screen turns off, check the phone's battery settings for the app.
Step 2: Find the endpoint
The app shows the endpoint once the server is running. It has three parts: the phone's local IP address, the port, and the /v1 path.
http://<PHONE_IP>:<PORT>/v1
# example only
http://192.168.1.50:8080/v1Copy the value from the app instead of reusing the example, because your router assigns the address and it can change. If you need to confirm the phone's address independently, the Wi-Fi details screen in Android or the connected-devices list in your router will show it.
Step 3: Verify the endpoint from your computer
Test from the same machine that runs Cursor so you know the network path works before you touch any settings.
curl http://<PHONE_IP>:<PORT>/health
curl http://<PHONE_IP>:<PORT>/v1/modelsThe first call checks that the server is running. The second returns the models the phone offers, and each entry has an id field. Keep one of those ids handy, because Cursor needs it as the model name. If either command hangs or is refused, fix that before continuing; the troubleshooting section below covers the usual causes.
Step 4: Configure Cursor
- Open Settings and go to Models.
- In the OpenAI API Key field, enter any placeholder such as
local-lan. - Enable Override OpenAI Base URL.
- Paste the phone endpoint from step 2, including
/v1at the end. - Add the model id from step 3 as a custom model name if Cursor does not list it already.
Cursor changes its settings screens from time to time, so a label may sit in a slightly different place in your version. Check Cursor's own documentation if a control has moved or if you want to know how your version handles custom base URLs on private network addresses.
Choosing the model id
The model name Cursor sends must match what the phone reports. The id comes from GET /v1/models, not from the display name in the app or from the file name on disk. If you switch the loaded model on the phone, call /v1/models again, because the id in your Cursor settings may need to follow it.
To see exactly what Cursor will send, reproduce one request by hand. This is standard OpenAI-style chat usage:
curl http://<PHONE_IP>:<PORT>/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer local-lan" \
-d '{
"model": "<MODEL_ID>",
"messages": [
{"role": "user", "content": "Write a one-line docstring for a function that adds two numbers."}
]
}'If this succeeds, the phone side is working and any remaining problem is in Cursor's configuration.
Using cloud models through the same endpoint
The phone is a gateway, so Cursor does not need to know what sits behind it. In the app, Add Provider has a Cloud tab (NVIDIA, OpenAI, OpenRouter, Gemini, Claude, Ollama and Custom) and a Local tab. After you add a provider, its models are served through the same endpoint, and Cursor keeps the same base URL. Requests to a cloud provider go directly from the phone to that provider. The provider keys stay in AES-256 encrypted storage on the phone, which is why Cursor only needs a placeholder key.
Troubleshooting connection problems
| Symptom | Likely cause | What to do |
|---|---|---|
| Request times out | Phone and computer are on different networks | Join both to the same Wi-Fi network and confirm neither is on a separate guest or IoT network. |
| Connection refused | Server is not running, or the port is wrong | Confirm the server is started in the app and copy the port from the endpoint shown there. |
| 404 or "not found" | Missing /v1 in the base URL | Make sure the base URL ends with /v1 and has no extra path. |
| SSL or TLS error | The URL uses https | Use http on a local network. |
| Works on the phone's Wi-Fi but not from the computer | Guest-network client isolation, VPN, or a firewall | Disable the VPN temporarily, use a non-isolated network, and check the computer's firewall. |
| "Model not found" | Model id does not match | Run GET /v1/models and copy the id exactly. |
| Worked yesterday, fails today | The router gave the phone a new IP address | Re-read the endpoint in the app, or reserve a fixed address for the phone in your router. |
If curl works from your computer but Cursor still reports it cannot reach the address, the cause may be on Cursor's side: depending on the version and the feature, some requests may be sent from Cursor's own servers rather than from your computer, and those cannot reach a private LAN address. Check Cursor's documentation for how it handles custom base URLs. Do not solve it by publishing the phone to the internet.
Keep the endpoint private
The endpoint is meant for devices on your own network. Do not forward its port on your router, and do not put it behind a public tunnel or reverse proxy. Assume anyone who can reach it could send requests to the models and providers configured behind it, which could use up a metered cloud account. Ollama Local AI is an independent app by FreeRouter Team and is not affiliated with Cursor, OpenAI, Anthropic or any other provider mentioned here.
For other editors, see the VS Code, Continue, Cline, Roo Code and Windsurf guide, or go back to the home page for the full feature list.