cpa-codex-free
技能描述
此技能用于生成 CLI Proxy API 的认证文件,请确保已为openai域名分流至非中国地区。
环境变量
优先从工作空间下的.env获取,其次从系统环境变量获取。未配置时向用户索取并更新.env。
MAIL_API_KEY: 邮箱服务API密钥,默认gpt-test为官方测试密钥(每天20万额度),获取地址: https://shop.chatgpt.org.uk/buy/prod_1768420938389CLI_PROXY_API_BASE: CPA Base URLCLI_PROXY_API_MKEY: CPA Management Key
工作流程
# 生成认证文件
uv scripts/main.py > {tempdir}/{temp-name}.json
# 上传至CPA服务
curl -X POST -H 'Content-Type: application/json' \
-H "Authorization: Bearer $CLI_PROXY_API_MKEY" \
"$CLI_PROXY_API_BASE/v0/management/auth-files?name=codex-<email>.json" \
-d "@{tempdir}/{temp-name}.json"
# 检查认证文件
curl "${CLI_PROXY_API_BASE}/v0/management/auth-files" \
-H "Authorization: Bearer ${CLI_PROXY_API_MKEY}" \
| jq '.files[] | select(.provider == "codex" and .email == "<email>") | {auth_index, id_token, status}'
# 查询剩余额度
curl "$CLI_PROXY_API_BASE/v0/management/api-call" \
-H "Authorization: Bearer $CLI_PROXY_API_MKEY" \
-H 'Content-Type: application/json' \
-d '{
"authIndex":"<auth_index>",
"method":"GET",
"url":"https://chatgpt.com/backend-api/wham/usage",
"header":{
"Authorization":"Bearer $TOKEN$",
"Content-Type":"application/json",
"User-Agent":"codex_cli_rs/0.76.0 (Debian 13.0.0; x86_64) WindowsTerminal",
"Chatgpt-Account-Id":"<chatgpt_account_id>"
}
}'
# 清理临时文件
rm {tempdir}/{temp-name}.json
清理流程
# 获取失效的认证文件列表
curl "${CLI_PROXY_API_BASE}/v0/management/auth-files" \
-H "Authorization: Bearer ${CLI_PROXY_API_MKEY}" \
| jq '.files[] | select(.provider == "codex" and .status == "error") | {name, status_message}'
# 删除认证文件
curl -X DELETE "${CLI_PROXY_API_BASE}/v0/management/auth-files?name=<name.json>" \
-H "Authorization: Bearer ${CLI_PROXY_API_MKEY}"
清理规则
只清理明确失效的认证文件。
不清理(网络/瞬时错误)
i/o timeoutEOF/unexpected EOFcontext canceled
可清理(明确失效)
usage_limit_reachedinvalid authrevokedmalformed token
More from aahl/skills
edge-tts
Text-to-speech conversion using `uvx edge-tts` for generating audio from text. Use when (1) User requests audio/voice output with the "tts" trigger or keyword. (2) Content needs to be spoken rather than read (multitasking, accessibility, driving, cooking). (3) User wants a specific voice, speed, pitch, or format for TTS output.
2.1Kmaishou
商品价格全网对比技能,获取商品在淘宝(Taobao)、天猫(TMall)、京东(JD.com)、拼多多(PinDuoDuo)、抖音(Douyin)、快手(KaiShou)的最优价格、优惠券,当用户想购物或者获取优惠信息时使用。Get the best price, coupons for goods on Chinese e-commerce platforms, compare product prices, and use when users want to shop or get discount information.
1.9Kcrypto-report
Get cryptocurrency market data. Get Binance AI analysis report. Get blockchain news updates.
1.6Kmcp-duckgo
Skills for web search and content scraping via DuckDuckGo MCP Server. Used when users need online searching and web scraping.
1.3Kmcp-hass
The skill for control Home Assistant smart home devices and query states using MCP protocol.
1.3Kmcp-vods
用于追剧/追番的技能,为AI提供搜索影视播放地址的能力,并支持在小米电视上直接播放。当用户想搜索影视、动漫、短剧、综艺等节目信息或更新进度时使用此技能。
1.2K