cliproxy-newapi-stack

cliproxy-newapi-stack is a skill for Claude Code, Codex from majiayu000/spellbook. It costs 171 tokens per session (3,087 once invoked), scanned C, original, MIT.

A deployment guide for adding NewAPI, a billing and usage-control layer, in front of an already running CLIProxyAPI service. CLIProxyAPI provides an OpenAI-compatible interface to several AI account providers.

In plain words
What is it for?
Connecting NewAPI to CLIProxyAPI, deploying the billing layer with Docker, configuring model prices and quota corrections, loading OAuth credentials, and verifying requests and logs.
Why use it?
It helps expose usage tracking, quotas, pricing, and multiple accounts without treating the existing upstream service as a fresh installation.

Skill for Claude CodeCodex

Written for Claude Code and Codex: allowed-tools in frontmatter, but also agents/openai.yaml present. Also seen: mentions Codex.

Good fit Connecting NewAPI to CLIProxyAPI, deploying the billing layer with Docker, configuring model prices and quota corrections, loading OAuth credentials, and verifying requests and logs.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/majiayu000/spellbook/cliproxy-newapi-stack
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add majiayu000/spellbook --skill cliproxy-newapi-stack
Clone the repo
git clone --depth 1 https://github.com/majiayu000/spellbook

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for cliproxy-newapi-stack

README.md
[![agentmods](https://agentmods.dev/badge/skills/majiayu000/spellbook/cliproxy-newapi-stack/github.svg)](https://agentmods.dev/skills/majiayu000/spellbook/cliproxy-newapi-stack)
Your own site
<a href="https://agentmods.dev/skills/majiayu000/spellbook/cliproxy-newapi-stack"><img src="https://agentmods.dev/badge/skills/majiayu000/spellbook/cliproxy-newapi-stack/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for cliproxy-newapi-stack

Your own site · 80×15
<a href="https://agentmods.dev/skills/majiayu000/spellbook/cliproxy-newapi-stack"><img src="https://agentmods.dev/badge/skills/majiayu000/spellbook/cliproxy-newapi-stack.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 171 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,087 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00171 $0.03087
Opus 5.5 $0.00068 $0.01235
Sonnet 5.5 $0.00034 $0.00617
Haiku 4.5 $0.00017 $0.00309

Measured 1mo ago against content hash ea293c641fe0, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade C, and why

cliproxy-newapi-stack scanned grade C with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

The scan reads SKILL.md. This mod also ships 7 executable files (scripts/add_codex_account.sh, scripts/deploy_newapi.sh, scripts/lib/validation.sh, …), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Reaches for credential fileshighPrivilege escalation

SSH keys, cloud credentials, git-credentials, .npmrc, /etc/shadow: reading these is how a config file becomes a credential leak.

SSH_TARGET=root@<HOST> SSH_KEY=~/.ssh/id_ed25519 PORT=8200 \
skills/cliproxy-newapi-stack/SKILL.md · 236 lines

How it starts

The opening of the file, as written. The whole thing — 236 lines — stays where its author put it; the contents beside it link to each section on GitHub.

CLIProxyAPI + NewAPI Metering Stack

在用户已有并已验证的 CLIProxyAPI upstream 前增加 NewAPI (calciumion/new-api) 计费、限流和多用户 token 层。本 Skill 不安装裸 CLIProxyAPI,也不调用其他部署 Skill 补齐这个前置条件。

所有"完成"结论必须基于本会话命令输出(W-16)。价格和额度变更后必须真发一次请求并查 logs.quota 与本次请求的 token 数和目标价格相符。

Operating Contract

  • Direct actions: 只读检查、配置备份和本地 dry-run 可直接执行。
  • Escalate before: 安装容器、修改既有 upstream、重启服务、改防火墙或写生产额度前必须取得本次任务的明确授权。
  • Evidence-backed pushback: 密钥只从环境变量或密码管理器读取;要求明文落盘或公网暴露原始端口时,展示具体风险并改用 tunnel/TLS。
  • Feedback loop: 每次变更后重跑 upstream、NewAPI 和精确计费验证;任一步骤无法取得真实状态时停止并报告,不用默认值伪造成功。

0. 前置确认(必问)

  • SSH 目标:root@HOST 是否能免密
  • 端口分配:CLIPROXY_PORT(默认 8317)、NEWAPI_PORT(默认 8200)
  • upstream 证据:CLIProxyAPI 已在目标主机运行,当前会话能通过用户批准的 SSH tunnel 或 loopback 请求验证健康、模型列表和认证;证据不足就停止,不猜测、 不自动安装裸 upstream
  • 登录账号供应商:codex / claude / qwen / iflow / gemini
  • 价格输入格式:每个虚拟模型给我 input / cached / output 三个 USD per 1M 数字
  • 客户端机器:要在哪些机器上落 BASE_URL 环境变量

安全默认:本地 OAuth + scp 同步;NewAPI 仅绑定 VPS loopback,通过 SSH tunnel 完成首次注册。公网访问必须走已配置 TLS 的反向代理,不能直接开放 NewAPI 原始 HTTP 端口。


Phase 1 — 验证现有 CLIProxyAPI upstream

先记录现有服务的进程、监听地址、健康响应、模型列表和配置备份位置。任何一项 无法验证都停止。只有用户在当前消息批准修改这个既有 upstream 时,才执行以下 两个补丁:

  1. 加稳定性开关到 /root/CLIProxyAPI/config.yaml:

    disable-cooling: true
    

    原因见 references/troubleshooting.md "CLIProxyAPI cooldown 原理"。 若漏改,30 并发 5KB payload 会出现混合 ~50% 503。

  2. 不要把 CLIProxyAPI 端口暴露到公网(与裸部署不同):

    • 先用 ip -4 addr show docker0 确认 Docker bridge 地址,再把 host 绑定到该地址(常见值为 172.17.0.1)
    • 删除已有的公网 ufw allow <CLIPROXY_PORT>/tcp;管理访问统一走 SSH tunnel,不保留公网 admin 后门

Phase 2 — 部署 NewAPI 容器

IMAGE='calciumion/new-api@sha256:<VERIFIED_DIGEST>' \
SSH_TARGET=root@<HOST> SSH_KEY=~/.ssh/id_ed25519 PORT=8200 \
  scripts/deploy_newapi.sh

脚本只绑定远端 127.0.0.1:8200。首次注册前保持防火墙关闭该端口,建立 SSH tunnel:

ssh -N -L 8200:127.0.0.1:8200 -i <KEY> <SSH_TARGET>

仅访问本机 http://127.0.0.1:8200 完成 root 账号注册,并把密码保存到密码 管理器。注册和登录验证成功后,再配置带 TLS 的 Caddy/Nginx 反向代理;先 验证 HTTPS、认证和来源限制,再按需开放 443/tcp。禁止开放 <NEWAPI_PORT>。

Read the full file on GitHub · 236 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago Changed · +1 lines ea293c641fe0
  2. 1mo ago First seen · 235 lines · 171 tokens per session scan C 23ec1657f9df

Subscribe to this mod's changes

cliproxy-newapi-stack is a skill published in the GitHub repository majiayu000/spellbook (288 stars, last pushed yesterday), licensed MIT. It adds 171 tokens to every session and 3,087 once invoked, about $0.0007 per session on Opus 5.5. A static security scan graded it C with 1 finding (reaches for credential files). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

sap-build-process-automation

SAP Build Process Automation skill for workflow, RPA, and business rules development. Use when creating approval workflows, decision tables, RPA bots (Desktop Agent), API triggers, or event-driven processes from S/4HANA. Also covers Forms, Actions (OData/REST connectors), Visibility dashboards, and process monitoring.…

efeumutaslan/SAP-SKILLS · 99 tokens

cao-provider

Create a new CLI agent provider for CAO (CLI Agent Orchestrator). Use this skill whenever the user wants to add support for a new CLI-based AI agent (e.g., a new coding assistant CLI), integrate a new provider, or scaffold a provider implementation. Also use when the user asks about the provider architecture, what…

awslabs/cli-agent-orchestrator · 81 tokens

cao-session-management

Find available CAO (CLI Agent Orchestrator) agent profiles, and talk to the conductor and worker terminals of a running CAO session, including unblocking a stuck worker. Use when choosing a profile to launch, messaging or unblocking workers, or diagnosing a stuck session. For preflight, launching, session commands…

awslabs/cli-agent-orchestrator · 83 tokens

notion

Notion workspace integration for searching pages, managing databases, creating postmortems, and exporting RCA findings.

Arvo-AI/aurora · 23 tokens

output-dev-workflow-cost

Calculate and display the cost of an Output SDK workflow execution run. Use when checking LLM token costs, API service costs, or total spend for a specific workflow run.

growthxai/output · 40 tokens

notion-tool

A Notion integration tool. It performs page and database search, retrieval, creation, and updates via the API. Use when: Use when: you need to edit Notion pages, add database rows, or search and retrieve workspace content.

xuiltul/animaworks · 52 tokens