GGUF
Chinese
English
spark-x2.5
llama.cpp
speculative-decoding
t4
cuda
colab
edge-deployment
conversational
Instructions to use gasschina/Spark-X2.5-4B-build-cpp with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use gasschina/Spark-X2.5-4B-build-cpp with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf gasschina/Spark-X2.5-4B-build-cpp:Q8_0 # Run inference directly in the terminal: llama cli -hf gasschina/Spark-X2.5-4B-build-cpp:Q8_0
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf gasschina/Spark-X2.5-4B-build-cpp:Q8_0 # Run inference directly in the terminal: llama cli -hf gasschina/Spark-X2.5-4B-build-cpp:Q8_0
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf gasschina/Spark-X2.5-4B-build-cpp:Q8_0 # Run inference directly in the terminal: ./llama-cli -hf gasschina/Spark-X2.5-4B-build-cpp:Q8_0
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf gasschina/Spark-X2.5-4B-build-cpp:Q8_0 # Run inference directly in the terminal: ./build/bin/llama-cli -hf gasschina/Spark-X2.5-4B-build-cpp:Q8_0
Use Docker
docker model run hf.co/gasschina/Spark-X2.5-4B-build-cpp:Q8_0
- LM Studio
- Jan
- Ollama
How to use gasschina/Spark-X2.5-4B-build-cpp with Ollama:
ollama run hf.co/gasschina/Spark-X2.5-4B-build-cpp:Q8_0
- Unsloth Desktop
- Pi
How to use gasschina/Spark-X2.5-4B-build-cpp with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf gasschina/Spark-X2.5-4B-build-cpp:Q8_0
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "gasschina/Spark-X2.5-4B-build-cpp:Q8_0" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use gasschina/Spark-X2.5-4B-build-cpp with Docker Model Runner:
docker model run hf.co/gasschina/Spark-X2.5-4B-build-cpp:Q8_0
- Lemonade
How to use gasschina/Spark-X2.5-4B-build-cpp with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull gasschina/Spark-X2.5-4B-build-cpp:Q8_0
Run and chat with the model
lemonade run user.Spark-X2.5-4B-build-cpp-Q8_0
List all available models
lemonade list
- Hermes Agent
How to use gasschina/Spark-X2.5-4B-build-cpp with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf gasschina/Spark-X2.5-4B-build-cpp:Q8_0
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default gasschina/Spark-X2.5-4B-build-cpp:Q8_0
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use gasschina/Spark-X2.5-4B-build-cpp with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf gasschina/Spark-X2.5-4B-build-cpp:Q8_0
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "gasschina/Spark-X2.5-4B-build-cpp:Q8_0" \ --custom-provider-id llama-cpp \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
Upload scripts/tunnel_api.sh with huggingface_hub
Browse files- scripts/tunnel_api.sh +91 -0
scripts/tunnel_api.sh
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
# ============================================================================
|
| 3 |
+
# tunnel_api.sh — 为 Spark API (默认8080) 开 aitun.cc 公网隧道
|
| 4 |
+
# 位置: /content/drive/MyDrive/spark-t4/tunnel_api.sh
|
| 5 |
+
#
|
| 6 |
+
# 原理: 直接运行 aitun-client 二进制,并用独立的 HOME (= /root/.aitun-api)
|
| 7 |
+
# 注册,完全不触碰现有 Flask 桥接隧道的 /root/.aitun 配置,
|
| 8 |
+
# 两隧道互不影响。免费模式自动分配隧道码和公网 URL。
|
| 9 |
+
#
|
| 10 |
+
# 用法:
|
| 11 |
+
# bash tunnel_api.sh start # 开隧道并打印公网 URL(约10~20秒)
|
| 12 |
+
# bash tunnel_api.sh status
|
| 13 |
+
# bash tunnel_api.sh stop
|
| 14 |
+
# 自定义: PORT=8080 bash tunnel_api.sh start
|
| 15 |
+
# ============================================================================
|
| 16 |
+
set -euo pipefail
|
| 17 |
+
|
| 18 |
+
PORT="${PORT:-8080}"
|
| 19 |
+
CLIENT_BIN="/usr/local/lib/python3.13/dist-packages/aitun/bin/aitun-client-linux-amd64"
|
| 20 |
+
API_HOME="/root/.aitun-api" # 独立配置目录,保护桥接隧道
|
| 21 |
+
LOG_FILE="/content/aitun-api-tunnel.log"
|
| 22 |
+
PID_FILE="/content/aitun-api-tunnel.pid"
|
| 23 |
+
|
| 24 |
+
GREEN='\033[0;32m'; YELLOW='\033[1;33m'; RED='\033[0;31m'; CYAN='\033[0;36m'; NC='\033[0m'
|
| 25 |
+
info() { echo -e "${GREEN}[隧道]${NC} $*"; }
|
| 26 |
+
fail() { echo -e "${RED}[隧道]${NC} $*"; exit 1; }
|
| 27 |
+
|
| 28 |
+
[[ -x "$CLIENT_BIN" ]] || fail "未找到 aitun 客户端: $CLIENT_BIN (本机需已安装 aitun)"
|
| 29 |
+
|
| 30 |
+
extract_url() {
|
| 31 |
+
grep -oE "https://aitun\.cc/[A-Za-z0-9]+" "$LOG_FILE" 2>/dev/null | tail -1
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
do_start() {
|
| 35 |
+
do_stop 2>/dev/null || true
|
| 36 |
+
mkdir -p "$API_HOME"
|
| 37 |
+
info "启动隧道 (本地 :$PORT → 公网)..."
|
| 38 |
+
HOME="$API_HOME" nohup "$CLIENT_BIN" -s aitun.cc:6639 -p "$PORT" \
|
| 39 |
+
> "$LOG_FILE" 2>&1 &
|
| 40 |
+
echo $! > "$PID_FILE"
|
| 41 |
+
|
| 42 |
+
for i in $(seq 1 12); do
|
| 43 |
+
sleep 5
|
| 44 |
+
URL="$(extract_url)"
|
| 45 |
+
if [[ -n "$URL" ]]; then
|
| 46 |
+
kill -0 "$(cat "$PID_FILE")" 2>/dev/null || fail "隧道进程退出,日志: $(tail -10 "$LOG_FILE")"
|
| 47 |
+
info "隧道已建立!"
|
| 48 |
+
echo -e "${CYAN}──────────────────────────────────────────────────${NC}"
|
| 49 |
+
echo -e " 公网 API: $URL/v1/chat/completions"
|
| 50 |
+
echo -e " 健康检查: $URL/health"
|
| 51 |
+
echo -e " 模型列表: $URL/v1/models"
|
| 52 |
+
if [[ -s "/content/drive/MyDrive/spark-t4/.api_key" ]]; then
|
| 53 |
+
echo -e " API Key: $(cat /content/drive/MyDrive/spark-t4/.api_key)"
|
| 54 |
+
echo -e " 调用时带: Authorization: Bearer <API Key>"
|
| 55 |
+
fi
|
| 56 |
+
echo -e "${CYAN}──────────────────────────────────────────────────${NC}"
|
| 57 |
+
echo -e " curl 示例:"
|
| 58 |
+
echo -e " curl -N $URL/v1/chat/completions \\"
|
| 59 |
+
echo -e " -H 'Content-Type: application/json' \\"
|
| 60 |
+
if [[ -s "/content/drive/MyDrive/spark-t4/.api_key" ]]; then
|
| 61 |
+
echo -e " -H \"Authorization: Bearer \$(cat /content/drive/MyDrive/spark-t4/.api_key)\" \\"
|
| 62 |
+
fi
|
| 63 |
+
echo -e " -d '{\"messages\":[{\"role\":\"user\",\"content\":\"你好\"}],\"stream\":true}'"
|
| 64 |
+
return 0
|
| 65 |
+
fi
|
| 66 |
+
done
|
| 67 |
+
fail "60 秒未取得公网 URL,日志: $(tail -15 "$LOG_FILE")"
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
do_stop() {
|
| 71 |
+
if [[ -f "$PID_FILE" ]] && kill -0 "$(cat "$PID_FILE")" 2>/dev/null; then
|
| 72 |
+
kill "$(cat "$PID_FILE")" && info "隧道已停止 (PID $(cat "$PID_FILE"))"
|
| 73 |
+
fi
|
| 74 |
+
rm -f "$PID_FILE"
|
| 75 |
+
}
|
| 76 |
+
|
| 77 |
+
do_status() {
|
| 78 |
+
URL="$(extract_url)"
|
| 79 |
+
if [[ -f "$PID_FILE" ]] && kill -0 "$(cat "$PID_FILE")" 2>/dev/null; then
|
| 80 |
+
info "隧道运行中 (PID $(cat "$PID_FILE")) URL: ${URL:-未知}"
|
| 81 |
+
else
|
| 82 |
+
echo "隧道未运行"
|
| 83 |
+
fi
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
case "${1:-help}" in
|
| 87 |
+
start) do_start ;;
|
| 88 |
+
stop) do_stop ;;
|
| 89 |
+
status) do_status ;;
|
| 90 |
+
*) grep '^# ' "$0" | sed 's/^# //' ;;
|
| 91 |
+
esac
|