Spaces:
Paused
Paused
Download test_api.py from ASEM12345/MoltBotMKX: direct link, hf CLI and curl.
- Browser
- Download file 652 Bytes
-
https://huggingface.co/spaces/ASEM12345/MoltBotMKX/resolve/main/test_api.py
- Command line
-
hf download hf://spaces/ASEM12345/MoltBotMKX/test_api.py
-
curl -L -o test_api.py https://huggingface.co/spaces/ASEM12345/MoltBotMKX/resolve/main/test_api.py
652 Bytes
| 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}") | |