360 Secure SkillHub
360 安全技能中心

check-ai-credits

只读查询 DeepSeek、DeepInfra、Codex、Grok、MiMo、Claude、Gemini、Kimi、OpenRouter 和 apikey.fun 的余额/额度,支持 JSON 快照、消耗趋势、凭据检测和按模型月度明细;依赖 Bun、供应商凭据及部分 CodexBar 支持。

mfang0126
mfang0126
热度 15.95
最近更新 2026-09-24 00:20:32
分类:数据依赖:代码执行 / 读写文件 / 第三方 API应用场景:财务 / 报告撰写 / API 集成 / 工作流

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add check-ai-credits
Metadata
name
check-ai-credits
description
Check AI provider credits and balance across 10 services.
license
MIT
metadata
{"hermes":{"category":"devops","tags":["credits","balance","provider","usage","quota","cli"]}}

check-ai-credits

Use when the user asks how much credit/balance/quota is left on an AI provider (DeepSeek, DeepInfra, Codex, Grok, MiMo, Claude, Gemini, Kimi, OpenRouter, apikey.fun) — or "还剩多少钱 / 查额度 / 查余额".

Commands

check-ai-credits                  # all configured providers
check-ai-credits <provider>       # one: deepseek|deepinfra|codex|grok|mimo|claude|gemini|kimi|openrouter|apikeyfun
check-ai-credits --json           # machine-readable snapshots
check-ai-credits --trend          # burn rate + days-left from history
check-ai-credits --list           # credential detection status per provider
check-ai-credits deepinfra --models  # per-model month breakdown

Binary location: dist/check-ai-credits after bun run build, or run directly with bun src/cli.ts.

Output contract

--json returns the snapshot schema (provider, source, timestamp, currency, balance, usedPercent, resetsAt, monthCost, monthPeriod, details, error). Check error first; a non-null error means the balance fields are unreliable. authHint carries the login URL when credentials expired.

Common failures

  1. DEEPSEEK_API_KEY missing → key resolves from process env first, then $HERMES_HOME/.env; set it there, never hardcode.
  2. codex/grok auth token is expired → run the vendor CLI once (codex / grok login); this tool never refreshes tokens itself because that would rotate the CLI's refresh token.
  3. codexbar … returned no data → Claude/Gemini/Kimi/OpenRouter/apikeyfun need the CodexBar app installed; run codexbar usage once interactively.

Safety

Read-only credential access, no secret echo in any output mode, no telemetry. Do not edit provider files to "fix" a failure without checking the endpoint semantics in docs/MIGRATION.md first (DeepInfra costs are in cents; Grok units are credits, not dollars).