Spaces:
Running
Running
File size: 652 Bytes
19bb594 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | 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}")
|