Skills apify-keys
Rotating Apify API key manager. Returns the least-recently-used active Apify key from the ColdCore database. Use before any Apify API call to get a fresh key with available credits.
install
source · Clone the upstream repo
git clone https://github.com/openclaw/skills
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/openclaw/skills "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/aces1up/apify-keys" ~/.claude/skills/openclaw-skills-apify-keys && rm -rf "$T"
OpenClaw · Install into ~/.openclaw/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/openclaw/skills "$T" && mkdir -p ~/.openclaw/skills && cp -r "$T/skills/aces1up/apify-keys" ~/.openclaw/skills/openclaw-skills-apify-keys && rm -rf "$T"
manifest:
skills/aces1up/apify-keys/SKILL.mdsource content
Apify Key Rotator
Get a rotating Apify API key from the ColdCore database. Keys are rotated by least-recently-used with balance checking.
Usage
Get next available API key:
python3 ~/.openclaw/workspace/skills/apify-keys/scripts/get_key.py
Get key as JSON (for piping to other scripts):
python3 ~/.openclaw/workspace/skills/apify-keys/scripts/get_key.py --json
Check balance on a specific key:
python3 ~/.openclaw/workspace/skills/apify-keys/scripts/get_key.py --check-balance --key "apify_api_xxxxx"
List all available keys with balances:
python3 ~/.openclaw/workspace/skills/apify-keys/scripts/get_key.py --list
How It Works
- Connects to ColdCore MySQL database
- Queries
for active Apify accountsscrape_sm_accounts - Returns the account with the oldest
timestamp (least recently used)last_used - Updates
to current timestamp after selectionlast_used - Skips accounts with zero balance
Environment Variables
The script reads database credentials from these environment variables (falls back to defaults):
— MySQL hostCOLDCORE_HOST
— MySQL usernameCOLDCORE_USER
— MySQL passwordCOLDCORE_PASS
— Database name (default:COLDCORE_DB
)lead_generator
Output
Default mode: prints just the API key string (for easy piping)
apify_api_xxxxx
JSON mode (
):--json
{"id": 68, "api_key": "apify_api_xxxxx", "email": "user@example.com", "balance": 4.95}
Integration with Other Skills
Other skills that need Apify access should call this script to get a key:
APIFY_KEY=$(python3 ~/.openclaw/workspace/skills/apify-keys/scripts/get_key.py) # Then use $APIFY_KEY in your API calls
Or in Python:
import subprocess result = subprocess.run( ["python3", os.path.expanduser("~/.openclaw/workspace/skills/apify-keys/scripts/get_key.py"), "--json"], capture_output=True, text=True ) key_data = json.loads(result.stdout) api_key = key_data["api_key"]