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/test_security_validation.sh
View on GitHub#!/usr/bin/env bash
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"
failures=0
assert_pass() {
local name=$1
shift
if ! ("$@"); then
printf 'FAIL expected pass: %s\n' "$name" >&2
failures=$((failures + 1))
fi
}
assert_fail() {
local name=$1
shift
if ("$@") >/dev/null 2>&1; then
printf 'FAIL expected rejection: %s\n' "$name" >&2
failures=$((failures + 1))
fi
}
assert_pass port_valid require_port PORT 8200
assert_fail port_shell_meta require_port PORT '8200;id'
assert_fail port_out_of_range require_port PORT 70000
assert_fail port_overflow require_port PORT 18446744073709559816
assert_pass decimal_integer require_positive_decimal PRICE 15
assert_pass decimal_fraction require_positive_decimal PRICE 0.25
assert_fail decimal_zero require_positive_decimal PRICE 0.0
assert_fail decimal_exponent require_positive_decimal PRICE 1e3
assert_pass path_valid require_absolute_safe_path DB /root/newapi/data/one-api.db
assert_fail path_quote require_absolute_safe_path DB "/root/newapi/data/one-api.db';id'"
assert_fail path_space require_absolute_safe_path DB '/root/newapi/data/one api.db'
assert_fail path_traversal require_absolute_safe_path DB /root/newapi/../etc/passwd
assert_pass ssh_target_valid require_safe_ssh_target SSH_TARGET root@1.2.3.4
assert_fail ssh_target_option require_safe_ssh_target SSH_TARGET '-oProxyCommand=id'
assert_fail ssh_target_shell_meta require_safe_ssh_target SSH_TARGET 'root@host;id'
digest='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
assert_pass docker_image_pinned require_pinned_docker_image IMAGE "calciumion/new-api@sha256:$digest"
assert_fail docker_image_tag require_pinned_docker_image IMAGE calciumion/new-api:latest
assert_fail docker_image_option require_pinned_docker_image IMAGE '-bad'
assert_fail docker_image_short_digest require_pinned_docker_image IMAGE calciumion/new-api@sha256:abcd
assert_pass container_valid require_safe_container_name CONTAINER new-api
assert_fail container_shell_meta require_safe_container_name CONTAINER 'new-api;id'
assert_pass model_valid require_safe_model_name MODEL gpt-5.4
assert_fail model_json_breakout require_safe_model_name MODEL 'gpt";id'
assert_pass loopback_url_valid require_loopback_http_origin URL http://127.0.0.1:8317
assert_fail loopback_url_public require_loopback_http_origin URL http://example.com:8317
assert_fail loopback_url_bad_port require_loopback_http_origin URL http://127.0.0.1:70000
assert_pass https_origin_valid require_https_origin URL https://api.example.com
assert_pass https_origin_port require_https_origin URL https://api.example.com:8443
assert_fail https_origin_http require_https_origin URL http://api.example.com
assert_fail https_origin_path require_https_origin URL https://api.example.com/v1
assert_pass token_valid require_safe_token TOKEN sk_example.test-1
assert_fail token_newline require_safe_token TOKEN $'bad\ntoken'
if ((failures > 0)); then
exit 1
fi
echo "security validation tests passed"
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 |