Add llm-provider-billing skill: DeepSeek balance query
This commit is contained in:
18
llm-provider-billing/scripts/deepseek-balance.sh
Normal file
18
llm-provider-billing/scripts/deepseek-balance.sh
Normal file
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
# DeepSeek 余额实时查询 — 自动从 ~/.hermes/.env 读 key,无需手动 export
|
||||
# 用法: bash deepseek-balance.sh (或 chmod +x 后直接执行)
|
||||
set -euo pipefail
|
||||
|
||||
ENV_FILE="$HOME/.hermes/.env"
|
||||
KEY=$(grep '^DEEPSEEK_API_KEY=' "$ENV_FILE" 2>/dev/null | cut -d= -f2- | tr -d '"' | tr -d "'")
|
||||
|
||||
if [ -z "$KEY" ]; then
|
||||
echo "❌ 未在 $ENV_FILE 找到 DEEPSEEK_API_KEY" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "🔍 查询 DeepSeek 余额 ..." >&2
|
||||
curl -s --max-time 20 https://api.deepseek.com/user/balance \
|
||||
-H "Accept: application/json" \
|
||||
-H "Authorization: Bearer $KEY"
|
||||
echo
|
||||
Reference in New Issue
Block a user