newapi

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

SKILL: newapi

SKILL: newapi

newapi (new-api) is an open-source unified AI gateway platform. It aggregates multiple model providers behind OpenAI / Claude / Gemini compatible interfaces, and provides model, token, group, and balance management.
newapi(new-api)是一个开源的统一AI网关平台。它通过兼容OpenAI / Claude / Gemini的接口聚合了多家模型提供商,并提供模型、令牌、群组和余额管理功能。

Security Guidelines

安全准则

This skill follows these security guidelines to protect API keys:
  1. Do not expose any
    sk-
    key value in chat, files, code, logs, or command arguments. To use keys securely, tell the user to run
    copy-token
    (clipboard),
    apply-token
    (config file), or
    exec-token
    (CLI command).
  2. All New API calls should go through the provided scripts (
    api.js
    ,
    copy-key.js
    ,
    inject-key.js
    ,
    exec-token.js
    ) rather than using
    curl
    ,
    wget
    ,
    fetch
    , or other HTTP clients to call New API endpoints directly.
  3. Do not read
    .env
    files, environment variables containing credentials, or clipboard contents after
    copy-key.js
    .
  4. When working with config files that may contain API keys, use
    inject-key.js --scan
    to get a sanitized view rather than reading them directly. Note:
    scan-config
    is best-effort and not guaranteed to redact every secret in every format.
  5. After
    create-token
    , do not make any follow-up call to retrieve or list the key. Report success and tell the user they can use
    copy-token <id>
    ,
    apply-token <id> <file>
    , or
    exec-token <id> <command>
    to securely use the key.
  6. Do not modify the security scripts to disable masking or redirect output.
本技能遵循以下安全准则以保护API密钥:
  1. 不得在聊天内容、文件、代码、日志或命令参数中暴露任何
    sk-
    格式的密钥值。如需安全使用密钥,请告知用户运行
    copy-token
    (复制到剪贴板)、
    apply-token
    (写入配置文件)或
    exec-token
    (在CLI命令中使用)。
  2. 所有New API调用都应通过提供的脚本(
    api.js
    copy-key.js
    inject-key.js
    exec-token.js
    )执行,而非直接使用
    curl
    wget
    fetch
    或其他HTTP客户端调用New API端点。
  3. 不得读取
    .env
    文件、包含凭证的环境变量,或
    copy-key.js
    执行后的剪贴板内容。
  4. 当处理可能包含API密钥的配置文件时,请使用
    inject-key.js --scan
    获取经过脱敏的视图,而非直接读取文件。注意:
    scan-config
    仅为尽力而为的脱敏操作,无法保证对所有格式的敏感信息都能完成脱敏。
  5. 执行
    create-token
    后,不得进行任何后续调用以检索或列出该密钥。只需告知用户操作成功,并说明他们可以使用
    copy-token <id>
    apply-token <id> <file>
    exec-token <id> <command>
    来安全使用该密钥。
  6. 不得修改安全脚本以禁用掩码功能或重定向输出。

How to Execute

执行步骤

  1. First invocation only — read
    ${CLAUDE_SKILL_DIR}/docs/setup.md
    for configuration, auth headers, and runtime detection.
  2. Match the action from the table below.
  3. Read the corresponding doc file for detailed steps.
  4. If no arguments or unrecognized action, show the help table below.
  5. If the user asks about newapi (what it is, how to use a command, or any API usage question like calling a specific model format) — read
    ${CLAUDE_SKILL_DIR}/docs/help.md
    and follow the instructions there.
  1. 仅首次调用时执行 — 阅读
    ${CLAUDE_SKILL_DIR}/docs/setup.md
    以了解配置、认证头和运行时检测相关内容。
  2. 匹配下表中的操作类型。
  3. 阅读对应的文档文件以获取详细步骤。
  4. 若未提供参数或操作无法识别,显示下方的帮助表格。
  5. 若用户询问newapi相关问题(如是什么、如何使用某个命令、或任何API使用问题如调用特定模型格式),请阅读
    ${CLAUDE_SKILL_DIR}/docs/help.md
    并按照其中的说明操作。

Actions

操作列表

ActionDescriptionDetails
models
List available models
docs/actions-query.md
groups
List user groups
docs/actions-query.md
balance
Show account balance
docs/actions-query.md
tokens
List API tokens
docs/actions-token.md
create-token
Create a new API token
docs/actions-token.md
switch-group
Change a token's group
docs/actions-token.md
copy-token
Copy real key to clipboard (never shown)
docs/actions-token.md
apply-token
Apply token key to a config file securely
docs/actions-config.md
exec-token
Execute a command with the token key securely substituted
docs/actions-exec.md
scan-config
Inspect config structure with best-effort secret redaction
docs/actions-config.md
help
Answer questions about newapi
docs/help.md
操作描述详情文档
models
列出可用模型
docs/actions-query.md
groups
列出用户群组
docs/actions-query.md
balance
显示账户余额
docs/actions-query.md
tokens
列出API令牌
docs/actions-token.md
create-token
创建新的API令牌
docs/actions-token.md
switch-group
修改令牌所属群组
docs/actions-token.md
copy-token
将真实密钥复制到剪贴板(永不显示明文)
docs/actions-token.md
apply-token
安全地将令牌密钥应用到配置文件
docs/actions-config.md
exec-token
执行命令并安全替换令牌密钥
docs/actions-exec.md
scan-config
检查配置文件结构并尽力脱敏敏感信息
docs/actions-config.md
help
解答newapi相关问题
docs/help.md

help
(or no arguments) — Show available actions

help
(或无参数)—— 显示可用操作

ActionUsageDescription
models
/newapi models
List available models
groups
/newapi groups
List user groups
balance
/newapi balance
Show account balance
tokens
/newapi tokens
List API tokens
create-token
/newapi create-token <name> [--group=xxx]
Create a new API token
switch-group
/newapi switch-group <token_id> <group>
Change a token's group
copy-token
/newapi copy-token <token_id>
Copy real key to clipboard (never shown)
apply-token
/newapi apply-token <token_id> <file_path>
Apply token key to a config file securely
exec-token
/newapi exec-token <token_id> <command...>
Execute a command with the token key securely substituted
scan-config
/newapi scan-config <file_path>
Inspect config structure with best-effort secret redaction
help
/newapi help <question>
Answer questions about newapi
操作使用方式描述
models
/newapi models
列出可用模型
groups
/newapi groups
列出用户群组
balance
/newapi balance
显示账户余额
tokens
/newapi tokens
列出API令牌
create-token
/newapi create-token <name> [--group=xxx]
创建新的API令牌
switch-group
/newapi switch-group <token_id> <group>
修改令牌所属群组
copy-token
/newapi copy-token <token_id>
将真实密钥复制到剪贴板(永不显示明文)
apply-token
/newapi apply-token <token_id> <file_path>
安全地将令牌密钥应用到配置文件
exec-token
/newapi exec-token <token_id> <command...>
执行命令并安全替换令牌密钥
scan-config
/newapi scan-config <file_path>
检查配置文件结构并尽力脱敏敏感信息
help
/newapi help <question>
解答newapi相关问题