Ylsusage
Use only when the user explicitly asks about YLS Codex usage, quota, token consumption, package status, or account balance. Trigger on ylsusage, YLS Codex 用量, yls 用量, YLS 额度, YLS 配额, or YLS 余额. Do not trigger on generic Codex/OpenAI quota or token questions unless YLS is named.From its SKILL.md
npx -y skills add Asuka0411/ylsusage --skill ylsusageAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
7.0 KB, ~2.0k tokens by cl100k_base, as published. Nobody here has run it
YLS Codex Usage
Query YLS Codex account usage, quota, and package status via API.
Rules
- Output only the final formatted result. No preamble, no explanation.
- If
YLSCODE_API_KEYis missing, output only:请先设置环境变量 YLSCODE_API_KEY. - Do not show raw JSON, API calls, Bearer token, or tool execution steps.
- Do not read
~/.codex/auth.jsonor any other local Codex auth file.
API Endpoint
GET https://codex.ylsagi.com/codex/info
Authorization: Bearer <YLSCODE_API_KEY>
Authentication
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.
Request Pattern
Always save the response to a temporary file first, parse it from disk, then delete the file.
macOS
: "${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"
Linux
: "${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"
Windows (PowerShell)
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
}
Response Shape
| 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 |
Key Usage Fields
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 |
Quick Check
macOS / Linux
: "${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"
Windows (PowerShell)
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
}
Display Format
Format the response concisely with emojis. Match the user's conversation language: Chinese in Chinese, English in English.
Template
✨ {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
Rules
- Progress bar: 20 chars,
█filled +░empty. - Token numbers: comma-separated.
- Costs: 2 decimal places.
- Usage warning: >80% append 🔴, 50-80% append ⚠️.
- Cache hit rate =
input_tokens_cached / input_tokens. - Use
userPackgeUsageas today's data,userPackgeUsage_weekas weekly data. - Omit
userAccountInfounless the user asks for balance. - Keep each metric on its own line with emoji prefix.
Common Mistakes
- Don't pipe curl directly to jq; save with
-ofirst, then parse the file. - Don't hardcode the API key; always read from
YLSCODE_API_KEY. - Don't read Codex auth files; this skill must not use local Codex auth files as credential sources.
- The API uses
userPackgeUsage(missingain Package); this is intentional.
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.