Install
openclaw skills install chanjing-credentials-guardGuide users to configure local Chanjing credentials safely via local commands only, and validate local token status when needed.
openclaw skills install chanjing-credentials-guard仅通过本地命令引导用户配置/校验蝉镜 AK/SK 与 Token,打开登录页;不在对话中索取密钥。可配合其它 Chanjing 技能使用。
scripts/chanjing_config.py、scripts/open_login_page.py、scripts/chanjing_get_token.py 等manifest.yaml(environment 段)及本文manifest.yamlclawhub run chanjing-credentials-guardpython skills/chanjing-credentials-guard/scripts/chanjing_config.py --statusThis skill is a local credential guide, not a cross-skill runtime dependency.
1. Check if local AK/SK exists
└─ No → Run open_login_page.py (open login in browser) → Ask user to run local config command
└─ Yes → Continue
2. Check if local Token exists and is not expired
└─ No → Call API to request/refresh Token → Save
└─ Yes → Continue
3. Prompt user to continue target action
AK/SK and Token are read from the same config file. Path and format follow the script scripts/chanjing_config.py in this skill.
~/.chanjing/credentials.json(目录由 CHANJING_OPENAPI_CREDENTIALS_DIR 覆盖,兼容 CHANJING_CONFIG_DIR){
"app_id": "Your Access Key",
"secret_key": "Your Secret Key",
"access_token": "Optional, auto-generated",
"expire_in": 1721289220
}
expire_in is a Unix timestamp. Token is valid for about 24 hours; refresh 5 minutes before expiry.
When local app_id or secret_key is missing:
open_login_page.py script to open the Chanjing sign-in page in the default browser (https://www.chanjing.cc/openapi/login).Commands to set AK/SK (use either):
python scripts/chanjing_config.py --ak <your_app_id> --sk <your_secret_key>
python skills/chanjing-credentials-guard/scripts/chanjing_config.py --ak <your_app_id> --sk <your_secret_key>
To open the login page manually: python skills/chanjing-credentials-guard/scripts/open_login_page.py
When the user clearly wants to generate chanjing keys, get keys, or configure AK/SK, follow this flow:
Check if local AK/SK already exists (read ~/.chanjing/credentials.json for non-empty app_id and secret_key, or run python skills/chanjing-credentials-guard/scripts/chanjing_config.py --status).
If already configured: ask whether user wants to overwrite local config.
If not configured: Run the “Guide steps” below directly.
open_login_page.py to open the Chanjing login page in the default browser.App ID and Secret Key with copy buttons.python skills/chanjing-credentials-guard/scripts/chanjing_config.py --ak <your_app_id> --sk <your_secret_key>
python skills/chanjing-credentials-guard/scripts/chanjing_config.py --statusPOST https://open-api.chanjing.cc/open/v1/access_token
Content-Type: application/json
Request body:
{
"app_id": "{{app_id}}",
"secret_key": "{{secret_key}}"
}
Response (success code: 0):
{
"code": 0,
"msg": "success",
"data": {
"access_token": "xxx",
"expire_in": 1721289220
}
}
expire_in: Unix timestamp for token expirycode !== 0, AK/SK is invalid or the request failedchanjing_config.py); ensure app_id and secret_key are non-empty.access_token exists and expire_in > current_time + 300 (refresh 5 minutes early).access_token and expire_in back to the file.Shortcut: Run python skills/chanjing-credentials-guard/scripts/chanjing_get_token.py; on success it prints access_token, on failure it prints guidance.
| Script | Description |
|---|---|
open_login_page.py | Opens the Chanjing login page and explains how new/existing users obtain AK/SK |
chanjing_config.py | Set or view AK/SK and Token status |
chanjing_get_token.py | Print a valid access_token to stdout (or guidance on failure) |
# Open login page (also runs automatically when AK/SK is missing)
python skills/chanjing-credentials-guard/scripts/open_login_page.py
# Set AK/SK manually
python skills/chanjing-credentials-guard/scripts/chanjing_config.py --ak <app_id> --sk <secret_key>
# View status
python skills/chanjing-credentials-guard/scripts/chanjing_config.py --status
/access_token, dto.OpenAccessTokenReq, dto.OpenAccessTokenResp