import requests import json try: # 尝试 OpenAI 格式 resp = requests.post("http://127.0.0.1:18789/v1/chat/completions", json={ "model": "default", "messages": [{"role": "user", "content": "hello"}] }, timeout=5) print(f"POST /v1/chat/completions: {resp.status_code}") print(resp.text[:200]) except Exception as e: print(f"POST /v1/chat/completions error: {e}") try: # 尝试 OpenClaw 原生格式 (如果有) resp = requests.get("http://127.0.0.1:18789/health", timeout=5) print(f"GET /health: {resp.status_code}") except Exception as e: print(f"GET /health error: {e}")