YLS Codex usage query skill for Codex and Claude Code
SaferSkills independently audited ylsusage (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
Query YLS Codex account usage, quota, and package status via API.
YLSCODE_API_KEY is missing, output only: 请先设置环境变量 YLSCODE_API_KEY.~/.codex/auth.json or any other local Codex auth file.GET https://codex.ylsagi.com/codex/info
Authorization: Bearer <YLSCODE_API_KEY>Read API key from the YLSCODE_API_KEY environment variable:
export YLSCODE_API_KEY="<key>"Use YLSCODE_API_KEY as the Bearer token. Never read the key from local Codex auth files.
Always save the response to a temporary file first, parse it from disk, then delete the file.
: "${YLSCODE_API_KEY:?Set YLSCODE_API_KEY first}"
TMP_JSON=$(mktemp "${TMPDIR:-/tmp}/yls_info.XXXXXX")
trap 'rm -f "$TMP_JSON"' EXIT
curl --fail --silent --show-error \
-H "Authorization: Bearer $YLSCODE_API_KEY" \
https://codex.ylsagi.com/codex/info \
-o "$TMP_JSON"
jq . "$TMP_JSON": "${YLSCODE_API_KEY:?Set YLSCODE_API_KEY first}"
TMP_JSON=$(mktemp "${TMPDIR:-/tmp}/yls_info.XXXXXX")
trap 'rm -f "$TMP_JSON"' EXIT
curl --fail --silent --show-error \
-H "Authorization: Bearer $YLSCODE_API_KEY" \
https://codex.ylsagi.com/codex/info \
-o "$TMP_JSON"
jq . "$TMP_JSON"if (-not $env:YLSCODE_API_KEY) { throw "Set YLSCODE_API_KEY first" }
$tmp = New-TemporaryFile
try {
Invoke-WebRequest -Uri "https://codex.ylsagi.com/codex/info" `
-Headers @{ Authorization = "Bearer $env:YLSCODE_API_KEY" } `
-OutFile $tmp.FullName
Get-Content $tmp.FullName -Raw | ConvertFrom-Json | ConvertTo-Json -Depth 20
} finally {
Remove-Item $tmp.FullName -ErrorAction SilentlyContinue
}| Field | Meaning |
|---|---|
state.user | User info: uid, email |
state.toDay | Current date (server) |
state.package.total_quota | Monthly total quota |
state.package.weeklyQuota | Weekly total quota |
state.package.package_level | Package level (2 = Pro) |
state.package.packages[] | Active package details: type, quota, expiry |
state.userPackgeUsage | Monthly usage stats |
state.userPackgeUsage_week | Weekly usage stats |
state.userAccountInfo | Account balance info |
Monthly (`userPackgeUsage`) / Weekly (`userPackgeUsage_week`):
| Field | Meaning |
|---|---|
input_tokens | Total input tokens |
input_tokens_cached | Cached input tokens |
output_tokens | Output tokens |
output_tokens_reasoning | Reasoning tokens |
total_cost | Total cost ($) |
input_cost / output_cost / cache_read_cost | Cost breakdown |
request_count | Number of requests |
total_quota | Quota cap |
remaining_quota | Remaining quota |
used_percentage | Usage percentage string |
: "${YLSCODE_API_KEY:?Set YLSCODE_API_KEY first}"
TMP_JSON=$(mktemp "${TMPDIR:-/tmp}/yls_info.XXXXXX")
trap 'rm -f "$TMP_JSON"' EXIT
curl --fail --silent --show-error \
-H "Authorization: Bearer $YLSCODE_API_KEY" \
https://codex.ylsagi.com/codex/info \
-o "$TMP_JSON"
jq '{package: .state.package.packages[0].package_type, level: "Lv" + (.state.package.package_level|tostring), expires: .state.package.packages[0].expires_at[:10], monthly: {remaining: .state.userPackgeUsage.remaining_quota, total: .state.userPackgeUsage.total_quota, used: .state.userPackgeUsage.used_percentage + "%", requests: .state.userPackgeUsage.request_count, cost: .state.userPackgeUsage.total_cost}, weekly: {remaining: .state.userPackgeUsage_week.remaining_quota, total: .state.userPackgeUsage_week.total_quota, used: .state.userPackgeUsage_week.used_percentage + "%", requests: .state.userPackgeUsage_week.request_count, cost: .state.userPackgeUsage_week.total_cost}}' "$TMP_JSON"if (-not $env:YLSCODE_API_KEY) { throw "Set YLSCODE_API_KEY first" }
$tmp = New-TemporaryFile
try {
Invoke-WebRequest -Uri "https://codex.ylsagi.com/codex/info" `
-Headers @{ Authorization = "Bearer $env:YLSCODE_API_KEY" } `
-OutFile $tmp.FullName
$r = Get-Content $tmp.FullName -Raw | ConvertFrom-Json
$m = $r.state.userPackgeUsage; $w = $r.state.userPackgeUsage_week; $p = $r.state.package
Write-Host "Package: $($p.packages[0].package_type) (Lv$($p.package_level)) Expires: $($p.packages[0].expires_at.Substring(0,10))"
Write-Host "Monthly: `$$($m.remaining_quota) / `$$($m.total_quota) ($($m.used_percentage)%) Requests: $($m.request_count) Cost: `$$($m.total_cost)"
Write-Host "Weekly: `$$($w.remaining_quota) / `$$($w.total_quota) ($($w.used_percentage)%) Requests: $($w.request_count) Cost: `$$($w.total_cost)"
} finally {
Remove-Item $tmp.FullName -ErrorAction SilentlyContinue
}Format the response concisely with emojis. Match the user's conversation language: Chinese in Chinese, English in English.
✨ {package_type} Lv{package_level} · 🎀 到期 {expires_at}
───────────────
📋 今日用量
📊 进度 [████████░░░░░░░░░░] {used_percentage}%
💰 余额 ${remaining} / ${total}
📨 请求 {requests} 次
💸 花费 $${cost}
📥 输入 {input_tokens:,} tokens
📤 输出 {output_tokens:,} tokens
🧠 推理 {reasoning_tokens:,} tokens
───────────────
📋 周度用量
📊 进度 [████████░░░░░░░░░░] {used_percentage}%
💰 余额 ${remaining} / ${total}
📨 请求 {requests} 次
💸 花费 $${cost}
📥 输入 {input_tokens:,} tokens
📤 输出 {output_tokens:,} tokens
🧠 推理 {reasoning_tokens:,} tokens
───────────────
💧 缓存命中 {cache_rate}%
🍵 今日推理 {reasoning_tokens:,} tokens█ filled + ░ empty.input_tokens_cached / input_tokens.userPackgeUsage as today's data, userPackgeUsage_week as weekly data.userAccountInfo unless the user asks for balance.-o first, then parse the file.YLSCODE_API_KEY.userPackgeUsage (missing a in Package); this is intentional.~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.