Daily cron that exports Claude Code usage via ccusage and uploads to aicoder.guru.
cp .env.template .env
# edit .env — set AICODER_API_KEY
./setup-cron.shVerify: crontab -l | grep aicoder
Remove: ./setup-cron.sh --remove
./aicoder-sync.sh| Var | Default | Description |
|---|---|---|
AICODER_API_KEY |
(required) | API key from aicoder.guru |
AICODER_INGESTION_URL |
https://europe-west2-aicoder-guru.cloudfunctions.net/ingestUsageFileViaApi |
Ingestion endpoint |
AICODER_CCUSAGE_SINCE |
20260101 |
Start date for usage export |
AICODER_SOURCE_LABEL |
ccusage-cron |
Label sent with upload |
AICODER_CRON_HOUR |
12 |
Hour (0-23) for daily cron |
- Runs
npx ccusage@latest daily --json --breakdownto export usage - Uploads to aicoder.guru API as
multipart/form-data - Retries on 429/5xx (3 attempts, exponential backoff)
- Treats 409 (duplicate) as success
- Uses date-based idempotency key (
ccusage-daily-YYYY-MM-DD)
- Node.js (for
npx) curl