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 冷却放大故障”时触发。
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 10.0 KB |
| agents/openai.yaml | config | 248 B |
| references/multi-account.md | markdown | 2.6 KB |
| references/newapi-pricing.md | markdown | 2.8 KB |
| references/troubleshooting.md | markdown | 2.9 KB |
| scripts/add_codex_account.shexecutable | script | 2.9 KB |
| scripts/deploy_newapi.shexecutable | script | 1.9 KB |
| scripts/lib/validation.sh | script | 3.3 KB |
| scripts/set_pricing.pyexecutable | script | 5.8 KB |
| scripts/test_security_validation.shexecutable | script | 3.1 KB |
| scripts/topup.shexecutable | script | 1.8 KB |
| scripts/verify_stack.shexecutable | script | 4.9 KB |
scripts/lib/validation.sh
View on GitHub#!/usr/bin/env bash
die() {
printf 'error: %s\n' "$*" >&2
exit 2
}
require_uint() {
local name=$1
local value=$2
if [[ ! "$value" =~ ^[0-9]+$ ]]; then
die "$name must be an unsigned integer"
fi
}
require_positive_uint() {
local name=$1
local value=$2
require_uint "$name" "$value"
if [[ "$value" =~ ^0+$ ]]; then
die "$name must be greater than zero"
fi
}
require_port() {
local name=$1
local value=$2
require_uint "$name" "$value"
if (( ${#value} > 5 )); then
die "$name must be between 1 and 65535"
fi
if (( 10#$value < 1 || 10#$value > 65535 )); then
die "$name must be between 1 and 65535"
fi
}
require_positive_decimal() {
local name=$1
local value=$2
local nonzero=${value//[.0]/}
if [[ ! "$value" =~ ^[0-9]+([.][0-9]+)?$ || -z "$nonzero" ]]; then
die "$name must be a positive decimal"
fi
}
require_absolute_safe_path() {
local name=$1
local value=$2
if [[ -z "$value" || "$value" != /* ]]; then
die "$name must be an absolute path"
fi
if [[ ! "$value" =~ ^/[A-Za-z0-9._/:+-]+$ ]]; then
die "$name contains unsupported characters"
fi
if [[ "$value" == *"/../"* || "$value" == *"/.." || "$value" == *"//"* ]]; then
die "$name must not contain path traversal or duplicate slashes"
fi
}
require_safe_container_name() {
local name=$1
local value=$2
if [[ "$value" == -* || ! "$value" =~ ^[A-Za-z0-9][A-Za-z0-9_.-]*$ ]]; then
die "$name must be a Docker container name"
fi
}
require_safe_docker_image() {
local name=$1
local value=$2
if [[ "$value" == -* || ! "$value" =~ ^[A-Za-z0-9][A-Za-z0-9._/:@-]*$ ]]; then
die "$name must be a Docker image reference"
fi
}
require_pinned_docker_image() {
local name=$1
local value=$2
require_safe_docker_image "$name" "$value"
if [[ ! "$value" =~ @sha256:[0-9a-fA-F]{64}$ ]]; then
die "$name must use an immutable sha256 digest"
fi
}
require_safe_host() {
local name=$1
local value=$2
if [[ "$value" == -* || ! "$value" =~ ^[A-Za-z0-9._:-]+$ ]]; then
die "$name must be a host name or IP address"
fi
}
require_safe_model_name() {
local name=$1
local value=$2
if [[ "$value" == -* || ! "$value" =~ ^[A-Za-z0-9][A-Za-z0-9._:+/@-]*$ ]]; then
die "$name must be a model name"
fi
}
require_loopback_http_origin() {
local name=$1
local value=$2
if [[ ! "$value" =~ ^http://127\.0\.0\.1:([0-9]+)$ ]]; then
die "$name must be an HTTP loopback origin with an explicit port"
fi
require_port "$name port" "${BASH_REMATCH[1]}"
}
require_https_origin() {
local name=$1
local value=$2
if [[ ! "$value" =~ ^https://[A-Za-z0-9][A-Za-z0-9.-]*(:[0-9]+)?$ ]]; then
die "$name must be an HTTPS origin without a path"
fi
if [[ "$value" =~ :([0-9]+)$ ]]; then
require_port "$name port" "${BASH_REMATCH[1]}"
fi
}
require_safe_token() {
local name=$1
local value=$2
if [[ -z "$value" || ! "$value" =~ ^[A-Za-z0-9._-]+$ ]]; then
die "$name contains unsupported characters"
fi
}
require_safe_ssh_target() {
local name=$1
local value=$2
if [[ "$value" == -* || ! "$value" =~ ^([A-Za-z0-9._~-]+@)?[A-Za-z0-9._:-]+$ ]]; then
die "$name must be an SSH host or user@host target"
fi
}
require_safe_timezone() {
local name=$1
local value=$2
if [[ "$value" == -* || ! "$value" =~ ^[A-Za-z0-9_+./-]+$ ]]; then
die "$name must be an IANA-style timezone"
fi
}
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deployment | Stars: 321k | Updated | Claude CodeCodex | Verified | Install |
| 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: 197k | Updated | Claude CodeCodex | Verified | Install |
| 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: 119k | Updated | Claude CodeCodex | Verified | Install |
| 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: 118k | Updated | Claude CodeCodex | Verified | Install |