Files
atlas/llm-provider-billing/scripts/deepseek-balance.sh

19 lines
594 B
Bash
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/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