Token导航 LogoToken导航TokenDH.com
效率需要联网clawhub未标认证来源可访问clear审计通过

openai-newapi-calc-tokenOpenAI newapi calc token 安全

Agent Skill

openai-newapi-calc-token 用于辅助安全审计、权限检查和凭据风险排查,适合在 OpenClaw 中需要复核安全边界、认证流程或敏感配置时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

2,326

周安装

95

GitHub Stars

公开资料未说明

下载量

752
OpenClaw

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

MIT-0

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:openai-newapi-calc-token(OpenAI newapi calc token 安全)
来源仓库:https://github.com/y-victor/openai-newapi-calc-token
安装命令:
openclaw skills install openai-newapi-calc-token
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 OpenClaw 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

ClawHubOpenClaw
openclaw skills install openai-newapi-calc-token

简介

在计算、审计、实施或审查 OpenAI 风格 API、NewAPI 兼容网关、缓存输入的代币定价和计费公式时使用

SKILL.md

name
token-cost-skill
description
Use when calculating, auditing, implementing, or reviewing token pricing and billing formulas for OpenAI-style APIs, NewAPI-compatible gateways, cached input/prompt caching, per-1K or per-1M token prices, quota consumption, recharge ratios, and cost comparison dashboards.

Token Cost Skill

Use this skill to calculate or review token billing without double-counting cached tokens or mixing incompatible pricing units.

Core Rules

  1. Identify the billing mode before calculating:

- openai-raw: provider price table has input, cached input, and output prices. - newapi-quota: gateway billing uses model ratio, completion/output ratio, and group ratio. - custom-multiplier: dashboard-specific per-1K/per-1M cost projection.

  1. Normalize price units first:

- /1K prices use divisor 1000. - /1M prices use divisor 1000000.

  1. Treat cached input as a subset of input tokens, not an extra token bucket.
  2. Keep quota formulas separate from money formulas; only convert quota to money after quota is computed.
  3. Show the expanded formula with the final result so users can audit every multiplier.

OpenAI-Style Raw Pricing

Inputs:

  • inputTokens: total input tokens reported for the request.
  • cachedInputTokens: cached input tokens inside inputTokens.
  • outputTokens: output tokens.
  • inputPrice: non-cached input price per selected unit.
  • cachedInputPrice: cached input price per selected unit.
  • outputPrice: output price per selected unit.

Formula:

unitDivisor = 1000 if priceUnit = "1K", else 1000000
cachedInputTokens = min(max(cachedInputTokens, 0), max(inputTokens, 0))
nonCachedInputTokens = max(inputTokens, 0) - cachedInputTokens

inputCost = (nonCachedInputTokens / unitDivisor) * inputPrice
cachedInputCost = (cachedInputTokens / unitDivisor) * cachedInputPrice
outputCost = (max(outputTokens, 0) / unitDivisor) * outputPrice
totalCost = inputCost + cachedInputCost + outputCost
totalTokens = max(inputTokens, 0) + max(outputTokens, 0)

Never use:

totalTokens = inputTokens + cachedInputTokens + outputTokens

cachedInputTokens is already included in inputTokens.

NewAPI-Compatible Quota Pricing

Use this mode when the gateway bills quota/credits by ratios.

Standard request quota formula:

quota = (promptTokens + completionTokens * completionRatio) * modelRatio * groupRatio

Common money conversion:

usdEquivalent = quota / 500000
actualCost = usdEquivalent / rechargeRatio

Notes:

  • completionRatio is also called output ratio, completion multiplier, or completion billing ratio.
  • groupRatio is the group multiplier.
  • modelRatio is the model multiplier.
  • rechargeRatio is not part of the quota formula; it is a post-processing conversion for real paid cost.

Custom Multiplier Dashboards

Use only when a dashboard intentionally projects per-1K or per-1M prices instead of computing gateway quota.

inputCost1K = basePrice1K * modelMultiplier * groupMultiplier / rechargeRatio
outputCost1K = basePrice1K * modelMultiplier * outputMultiplier * groupMultiplier / rechargeRatio
cacheReadCost1K = basePrice1K * modelMultiplier * cacheReadMultiplier * groupMultiplier / rechargeRatio
cacheCreateCost1K = basePrice1K * modelMultiplier * cacheCreateMultiplier * groupMultiplier / rechargeRatio

If basePrice is entered per 1M, convert first:

basePrice1K = basePrice1M / 1000

Verification Checklist

  • Confirm whether token counts are request usage counts or price table units.
  • Confirm whether cachedInputTokens is included inside inputTokens.
  • Confirm whether prices are per 1K or per 1M.
  • For OpenAI-style pricing, calculate non-cached input before calculating cost.
  • For NewAPI-style pricing, calculate quota before converting to USD or local currency.
  • Clamp negative token counts to 0.
  • Clamp cached input to no more than total input.
  • Protect against division by zero in recharge ratio.
  • Add tests for one normal case, one cached-input case, one unit-conversion case, and one zero-token case.

Common Mistakes

MistakeCorrect handling
Adding cached input to total inputSubtract cached input from input to get non-cached input
Mixing /1K and /1M pricesNormalize with the correct divisor first
Applying recharge ratio inside NewAPI quotaCompute quota first; apply recharge ratio only to money conversion
Using output price for cached inputCached input uses its own price
Letting cached input exceed inputClamp cached input to input tokens

Reference

Read references/formulas.md when you need source notes, examples, or implementation snippets.

适合场景

01

OpenClaw 用户查找和安装 Skill 时

02

用户想查找某类 Agent Skill 时

03

需要根据任务场景推荐可安装能力包时

04

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

OpenClaw

76.56%
按下载量换算576

安全审计

VirusTotal

通过

ClawScan

通过

Static analysis

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills