Skip to content

majiayu000/spellbook / skills/cliproxy-newapi-stack

cliproxy-newapi-stack

Flagged

在已经过独立验证的 CLIProxyAPI upstream 之上部署 NewAPI 计费层,把 Codex/Claude/Gemini/Qwen 等订阅账号包装成可计费的 OpenAI 兼容 API。本 Skill 不负责新建裸 CLIProxyAPI;负责 NewAPI Docker 部署、容器到宿主桥接、模型计费倍率、参数化额度修正、多账号 OAuth 凭据热加载和双路径验证。当用户说“给现有 cliproxy 加 NewAPI”“配置 NewAPI 渠道接已运行的 cliproxy”“NewAPI 价格不对”“给现有部署加账号”“172.17.0.1 容器网络”或“408 冷却放大故障”时触发。

FileKindSize
SKILL.mdskill md10.0 KB
agents/openai.yamlconfig248 B
references/multi-account.mdmarkdown2.6 KB
references/newapi-pricing.mdmarkdown2.8 KB
references/troubleshooting.mdmarkdown2.9 KB
scripts/add_codex_account.shexecutablescript2.9 KB
scripts/deploy_newapi.shexecutablescript1.9 KB
scripts/lib/validation.shscript3.3 KB
scripts/set_pricing.pyexecutablescript5.8 KB
scripts/test_security_validation.shexecutablescript3.1 KB
scripts/topup.shexecutablescript1.8 KB
scripts/verify_stack.shexecutablescript4.9 KB

scripts/deploy_newapi.sh

View on GitHub
#!/usr/bin/env bash
# Deploy a digest-pinned NewAPI container on loopback of a Linux VPS.
#
# Usage:
#   IMAGE=calciumion/new-api@sha256:<digest> \
#   SSH_TARGET=root@1.2.3.4 SSH_KEY=~/.ssh/id_ed25519 PORT=8200 \
#   ./deploy_newapi.sh

set -euo pipefail

SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
# shellcheck source=skills/cliproxy-newapi-stack/scripts/lib/validation.sh
. "$SCRIPT_DIR/lib/validation.sh"

: "${SSH_TARGET:?SSH_TARGET required (e.g. root@1.2.3.4)}"
: "${SSH_KEY:=$HOME/.ssh/id_ed25519}"
: "${PORT:=8200}"
: "${DATA_DIR:=/root/newapi/data}"
: "${LOGS_DIR:=/root/newapi/logs}"
: "${IMAGE:?IMAGE required; use an immutable image@sha256:digest reference}"
: "${TZ_VAL:=Asia/Shanghai}"

require_safe_ssh_target SSH_TARGET "$SSH_TARGET"
require_port PORT "$PORT"
require_absolute_safe_path DATA_DIR "$DATA_DIR"
require_absolute_safe_path LOGS_DIR "$LOGS_DIR"
require_pinned_docker_image IMAGE "$IMAGE"
require_safe_timezone TZ_VAL "$TZ_VAL"

ssh -i "$SSH_KEY" -- "$SSH_TARGET" bash -s -- \
  "$PORT" "$DATA_DIR" "$LOGS_DIR" "$IMAGE" "$TZ_VAL" <<'REMOTE'
  set -euo pipefail
  port=$1
  data_dir=$2
  logs_dir=$3
  image=$4
  tz_val=$5

  command -v docker >/dev/null || {
    apt-get update
    apt-get install -y docker.io
  }
  systemctl enable --now docker
  mkdir -p -- "$data_dir" "$logs_dir"
  docker pull "$image"
  if docker inspect new-api >/dev/null 2>&1; then
    docker rm -f new-api
  fi
  docker run -d --name new-api --restart unless-stopped \
    -p "127.0.0.1:${port}:3000" \
    -e "TZ=${tz_val}" \
    -v "${data_dir}:/data" \
    -v "${logs_dir}:/app/logs" \
    "$image"
  for _attempt in 1 2 3 4 5 6 7 8 9 10; do
    sleep 2
    if curl -fsS -o /dev/null "http://127.0.0.1:${port}/api/setup"; then
      echo "NewAPI ready on loopback port ${port}"
      exit 0
    fi
  done
  echo "NewAPI did not become ready; recent logs follow" >&2
  docker logs --tail 50 new-api >&2
  exit 1
REMOTE
writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deploymentStars: 321kUpdated Claude CodeCodexVerifiedInstall
xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved.Stars: 197kUpdated Claude CodeCodexVerifiedInstall
shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy.Stars: 119kUpdated Claude CodeCodexVerifiedInstall
childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release.Stars: 118kUpdated Claude CodeCodexVerifiedInstall