#!/usr/bin/env python3 """Test direct connection to Ollama on GPU VM.""" import asyncio import httpx async def test(): base = "http://10.0.30.63:11434" urls = [ f"{base}/v1/models", f"{base}/api/tags", ] for url in urls: print(f"\nTesting: {url}") try: async with httpx.AsyncClient(timeout=5.0) as client: resp = await client.get(url) print(f" Status: {resp.status_code}") if resp.status_code == 200: data = resp.json() print(f" Keys: {list(data.keys())}") if 'models' in data: models = [m.get('name', m.get('model', m)) for m in data['models']] print(f" Found {len(models)} models: {models}") elif 'data' in data: models = [m.get('id', m) for m in data['data']] print(f" Found {len(models)} models: {models}") except httpx.TimeoutException: print(f" ✗ Timeout - Ollama may only be listening on localhost") except Exception as e: print(f" ✗ Error: {e}") asyncio.run(test())