Working with Antigravity and want to run a local LLM through Ollama? It's powerful, but when connection issues pop up — "can't connect," "model not found," "no API response" — it can be frustrating. This guide helps you pinpoint exactly what's wrong and fix it, step by step.
Recognizing Your Error Pattern
Connection errors might look the same on the surface, but they usually stem from different root causes. Let's identify which pattern matches what you're experiencing:
Connection Timeout
- Message example: "Connection timeout," "No response from localhost:11434"
- Likely cause: Ollama isn't running, wrong port, or firewall blocking
Empty Model List
- Message example: "Available models: []," "No models loaded"
- Likely cause: Ollama is running but hasn't pulled (downloaded) any models yet
API Response Error
- Message example: "500 Internal Server Error," "Invalid request format"
- Likely cause: Configuration format mismatch or request structure problem
Authentication / Permission Issues
- Message example: "Permission denied," "Authentication failed"
- Likely cause: User permissions or missing environment variables
Keep these patterns in mind as we work through the diagnostic steps below.
Step 1: Verify Ollama Is Running
The first and most crucial check: Is Ollama actually running? Skip this, and all subsequent diagnostics are wasted effort.
On macOS/Linux
Open a terminal and run:
ollama listIf Ollama is running properly, you'll see your installed models:
NAME ID SIZE MODIFIED
llama2:latest c75d82f30b65 3.8 GB 2 minutes ago
mistral:latest 8f3797de41b5 4.1 GB 1 hour ago
neural-chat:latest 282e9238f2d6 4.1 GB 3 hours ago
If the output is blank (no models), Ollama is running but you haven't downloaded models yet. We'll handle that in Step 4.
If You Get an Error
Error: couldn't connect to running Ollama instanceOllama isn't running. Launch the Ollama app from your menu, or start the server manually:
ollama serveThen open another terminal tab and retry ollama list.
On Windows
After installing Ollama for Windows, launch it from your Start menu. Then in Command Prompt or PowerShell:
ollama listIf PowerShell complains about execution policy:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUserThen retry.
Step 2: Check Ports and Firewall Access
Once Ollama is confirmed running, let's verify that Antigravity can actually reach it. The key things here are port number and firewall permissions.
Ollama's Default Port
Ollama runs on port 11434 by default. Your Antigravity connection URL should be http://localhost:11434 or http://127.0.0.1:11434. If you've set a custom port via the OLLAMA_HOST environment variable:
echo $OLLAMA_HOSTTest the Port Connection
Use curl to see if the API is responding:
curl http://localhost:11434/api/tagsA successful response looks like this (JSON of your installed models):
{"models":[{"name":"llama2:latest","modified_at":"2026-04-01T10:00:00.000000000Z","size":3825930240},{"name":"mistral:latest","modified_at":"2026-04-02T15:30:00.000000000Z","size":4294967296}]}If Connection Is Refused
curl: (7) Failed to connect to localhost port 11434: Connection refused
This means Ollama either isn't listening or crashed. Go back to Step 1 and verify it's actually running.
macOS Firewall Check
If you have macOS firewall enabled, it might block Antigravity's localhost requests:
- Go to System Settings → Security & Privacy → Firewall
- Click Firewall Options
- Either uncheck "Block all incoming connections" temporarily, or add Ollama to the exceptions list
Then retry the curl command above.
Windows Firewall
- Open Windows Defender Firewall → Allow an app through firewall
- Click Change settings → add Ollama to the allowlist
Or from an admin Command Prompt:
netstat -ano | findstr :11434If you see a LISTENING entry, port 11434 is open.
Step 3: Verify Antigravity's LLM Configuration
Ollama is running and the port is open. Now let's confirm Antigravity's settings actually point to Ollama correctly.
Environment Variables
Create a .env.local file in your Antigravity project root:
NEXT_PUBLIC_LLM_PROVIDER=ollama
NEXT_PUBLIC_OLLAMA_BASE_URL=http://localhost:11434
NEXT_PUBLIC_OLLAMA_MODEL=llama2Note: Use http:// (not https://) for localhost. HTTPS will block localhost connections.
Configuration File
Some projects use antigravity.config.ts:
export const llmConfig = {
provider: "ollama",
baseUrl: "http://localhost:11434",
model: "llama2",
temperature: 0.7,
};Reflect Configuration Changes
After updating your env or config file, restart the dev server:
# Stop the server (Ctrl+C), then:
npm run dev
# or
yarn devCheck your browser's Network tab (F12 → Network) and look for Ollama requests. They should return status 200.
Step 4: Verify Model Name and Quantization Compatibility
If Ollama is running and the port is open but you still can't connect, the issue is likely a model name mismatch.
List Your Installed Models
ollama listExample output:
NAME ID SIZE MODIFIED
llama2:latest c75d82f30b65 3.8 GB 1 hour ago
mistral:7b-instruct a33e5e2d6b48 3.8 GB 2 hours ago
neural-chat:7b-q4 ab1c2d3e4f5g 2.1 GB 1 day ago
The NAME column must match exactly what you've configured in Antigravity.
Common Model Name Mistakes
- Set Antigravity to
mistralbut you installedmistral:7b-instruct - Used uppercase in the model name (
Llama2instead ofllama2) - Omitted the tag (wrote
mistralinstead ofmistral:latest)
Update your Antigravity config to match an installed model exactly. If you don't have a model you want, pull it:
ollama pull llama2:latestQuantization Variants
Ollama distributes quantized (compressed) versions of models for efficiency. Examples:
llama2:7b— full sizellama2:7b-q4_0— quantized to ~4GB (slight quality loss)llama2:7b-q5_K_M— higher-fidelity quantization (~5GB)
Make sure your Antigravity configuration and what's installed match. If you configure mistral:7b but installed mistral:7b-q4_0, expect errors.
Your options:
- Install the full-size model:
ollama pull mistral:7b - Update your Antigravity config to the installed variant:
mistral:7b-q4_0
If you're low on memory, quantized versions are the way to go.
Deep Dive: Logs and CORS
Still stuck? Let's look at detailed logs and common advanced issues.
Check Ollama's Log
# macOS
cat ~/.ollama/logs/server.log
# Linux
journalctl -u ollama -n 50Look for error or failed:
cat ~/.ollama/logs/server.log | grep -i errorBrowser Console Errors
Press F12 → Console tab. Look for messages like:
// Uncaught Error: Failed to fetch from http://localhost:11434
// CORS error: No 'Access-Control-Allow-Origin' header is presentIf You See CORS Errors
When Antigravity is a web app, the browser's CORS security might block cross-port requests to Ollama. Fix it:
- Enable CORS on Ollama:
export OLLAMA_ORIGINS=*
ollama serveOr more restrictively:
export OLLAMA_ORIGINS=http://localhost:3000
ollama serve- Use a backend proxy: Route Ollama requests through your Antigravity backend API instead of directly from the browser.
Restart Ollama Cleanly
pkill ollama
sleep 2
ollama serveOr just restart the app from your menu.
Cache Clearing and Full Reinstall
Often the issue is stale cache or Node modules. Do this nuclear option:
# In your Antigravity project directory
npm cache clean --force
rm -rf node_modules
rm -rf .next
npm install
npm run devOn Windows:
npm cache clean --force
rmdir /s node_modules
rmdir /s .next
npm install
npm run devLooking back
When Antigravity can't reach your local Ollama, work through these steps:
- Step 1: Run
ollama listto confirm Ollama is running - Step 2: Use curl to test
http://localhost:11434/api/tags; check firewall settings - Step 3: Verify Antigravity's
.env.localor config file has the correct base URL and useshttp://(nothttps://) - Step 4: Confirm your configured model name matches exactly what
ollama listshows - Advanced: Check logs, verify CORS settings, clear cache, and do a full reinstall if needed
Follow these methodically and you'll find your issue. Happy local LLM building!