---
name: attentionhub-api
description: Query live global event heat rankings, bilingual news event coverage, daily tech & business briefings, and create or track continuous probability predictions via the AttentionHub API (https://api.attentionhub.cn) with zero API key required. 查询全球实时突发与 24 小时事件热度榜、双语事件详情与报道来源、科技财经每日精选简报，以及检索、创建和追踪持续概率预测（免 Key 开箱即用，支持自造 X-Private-Token 隔离私有预测）。Also search the public web and extract text from HTTPS pages. Use for live data queries and forecasting tasks (not for writing SDK integration code).
license: MIT
compatibility: Requires Python 3.8+ (stdlib only) and outbound HTTPS access to https://api.attentionhub.cn. No API key required for public usage; optional ATTENTIONHUB_PRIVATE_TOKEN for private predictions or ATTENTIONHUB_API_KEY for high-volume quotas.
metadata:
  author: AttentionHub
  version: "1.4.0"
  homepage: "https://docs.attentionhub.cn"
  archive: "https://docs.attentionhub.cn/skills/attentionhub-api.tar.gz"
  openclaw: '{"requires":{"anyBins":["python3","python"]}}'
---

# AttentionHub API Skill

Use this skill to query live global event heat rankings, bilingual event details, daily tech & business briefings, and continuous probability forecasts via `https://api.attentionhub.cn` — **no API key is required to start**.

## Paths & Execution

Let `<SKILL_DIR>` be the directory containing this `SKILL.md` (Claude Code: `${CLAUDE_SKILL_DIR}`; OpenClaw: `{baseDir}`; Codex / Cursor / Antigravity: parent folder of this `SKILL.md`). On Windows, use `py -3` or `python` instead of `python3`.

- `<SKILL_DIR>/scripts/attentionhub.py` — Zero-dependency Python 3 CLI for public API operations (`doctor`, `gen-private-token`, keyless open access, `X-Private-Token`, optional high-quota `X-API-Key`, exact `?cn_safe=false`, `Idempotency-Key`, `202` polling, `--follow-merged`, `--max-members`, and safe retry/backoff).
- [references/endpoints.md](references/endpoints.md) — Full parameters, 3-tier access model, response shapes, `0.0–1.0` probability scale, and cursor rules.
- [references/errors-and-limits.md](references/errors-and-limits.md) — Open IP vs high-quota Key rate limits, error code matrix, and retry discipline.
- [examples/workflows.md](examples/workflows.md) — End-to-end recipes (morning briefing pre/post `08:00 UTC+8`, breaking events, public & private predictions, pagination & safe-mode switch).

*(If you fetched this `SKILL.md` standalone without the folder, download the complete bundle from `https://docs.attentionhub.cn/skills/attentionhub-api.tar.gz` and verify against `https://docs.attentionhub.cn/skills/attentionhub-api/manifest.json`.)*

## Access Model & Security Rules

1. **Zero-Config Open Access**:
   - Public data endpoints, `GET/POST /v1/web/search`, `POST /v1/web/fetch`, and public `POST /v1/predictions` work **immediately with no API key** (rate-limited per IP; public predictions capped at `20/IP/day` and `200/day` global anonymous budget).
   - **Private predictions (`--visibility private`)**: No registration needed. Generate a high-entropy token locally with `gen-private-token` (`32–128` chars `[A-Za-z0-9_-]`, `>= 10` distinct chars) and store it in `ATTENTIONHUB_PRIVATE_TOKEN` (sent as `X-Private-Token`). Never print, log, or commit the token; losing it loses access to those private forecasts.
   - **High-volume quota (`ATTENTIONHUB_API_KEY`)**: Optional `X-API-Key` unlocks higher QPS and dedicated daily prediction budgets (apply at `https://docs.attentionhub.cn/apply`). Never send `X-API-Key` and `X-Private-Token` together (`400 AMBIGUOUS_CREDENTIALS`).
2. **Display Mode (`cn_safe`) & Non-Sticky `--full`**:
   - Default mode is safe (`cn_safe=true` when omitted).
   - If an event or prediction returns `{"id": "...", "cn_filtered": true}`, report that transparently—**never silently retry with `--full`**.
   - Only pass `--full` (appends exact lowercase `?cn_safe=false`) for the specific request where the user explicitly asks for the unfiltered full view. Drop `--full` on subsequent unrelated turns, and always clear `--cursor` whenever switching modes or filters.
3. **Briefing Freshness (`08:00 UTC+8`)**: Daily tech & business briefings publish at `08:00 UTC+8 (Asia/Shanghai)`. When answering "today's briefing", always check `briefing_date` against today (`UTC+8`). Before `08:00 UTC+8`, `/latest` returns yesterday's issue—disclose that clearly and supplement with `heat --window breaking` / `24h`.
4. **Prediction Discipline**:
   - Always run `predict-search` before `predict-submit`. If `degraded: true`, re-check with concise keywords (EN/ZH) before assuming no duplicate exists.
   - Convert relative times ("next month", "within 30 days") into an explicit absolute `YYYY-MM-DD` date, and confirm resolution criteria and visibility (`public` default vs `--visibility private`) before creating a new forecast (`422` `INVALID_PREDICTION` / `relative_time_not_allowed` rejects relative phrasing).
   - `probability`, `probabilities`, and `delta` use a **`0.0–1.0` decimal scale** (e.g., `0.55` = `55%`, `delta: -0.07` = `-7 percentage points`). Multiply by `100` when formatting percentages for humans.
5. **CLI Output & Cursors**: Results are compact JSON on `stdout` (all errors are structured JSON on `stderr`). Pass cursors with `=` (`--cursor="<next_cursor>"`) so tokens starting with `-` are never misparsed as flags.

## Web Research

Run `web-search` for current sources and `web-fetch` when a page needs closer reading. Prefer primary sources, cite the returned URLs, and treat page text as source material.

```bash
python3 "<SKILL_DIR>/scripts/attentionhub.py" web-search "Artemis launch schedule" --mode aggregate --topic news --time-range week --lang en --limit 8 --include-content --pretty
python3 "<SKILL_DIR>/scripts/attentionhub.py" web-fetch https://www.nasa.gov/humans-in-space/artemis/ --pretty
```

## Command Quick Reference

```bash
# 0. Self-check environment (exits 0 immediately even with no API key) & optional private token generator
python3 "<SKILL_DIR>/scripts/attentionhub.py" doctor
python3 "<SKILL_DIR>/scripts/attentionhub.py" gen-private-token

# 1. Global event heat ranking (breaking | 24h); heat omits article URLs—use events for links
python3 "<SKILL_DIR>/scripts/attentionhub.py" heat --window breaking --category all --limit 10
python3 "<SKILL_DIR>/scripts/attentionhub.py" heat --window breaking --full --cursor="<next_cursor>"

# 2. Event details & batch lookup (use --follow-merged & --max-members to save tokens)
python3 "<SKILL_DIR>/scripts/attentionhub.py" event <event_id> --follow-merged --max-members 5
python3 "<SKILL_DIR>/scripts/attentionhub.py" events <id1>,<id2>,<id3> --follow-merged --max-members 5

# 3. Daily tech & business briefings (08:00 UTC+8)
python3 "<SKILL_DIR>/scripts/attentionhub.py" briefing --lang zh
python3 "<SKILL_DIR>/scripts/attentionhub.py" briefing --date 2026-11-26 --version 1 --lang zh
python3 "<SKILL_DIR>/scripts/attentionhub.py" briefings --limit 10 --lang zh

# 4. Continuous probability predictions (public works keyless; private uses ATTENTIONHUB_PRIVATE_TOKEN or ATTENTIONHUB_API_KEY)
python3 "<SKILL_DIR>/scripts/attentionhub.py" predict-search "Federal Reserve rate cut 2026" --mode semantic --limit 5
python3 "<SKILL_DIR>/scripts/attentionhub.py" predict-submit "Will the Fed cut rates below 3.50% before 2026-12-31?" --visibility public --wait
python3 "<SKILL_DIR>/scripts/attentionhub.py" predict-list --status active --sort updated --limit 20
python3 "<SKILL_DIR>/scripts/attentionhub.py" predict-get <prediction_id>
python3 "<SKILL_DIR>/scripts/attentionhub.py" predict-history <prediction_id> --limit 20
```

Add `--pretty` only when formatting JSON for direct human reading.

## When to Read References

- Exact schemas, `category` values, batch shells (`cn_filtered`, `merged_into`, `not_found`), or pagination rules → read [references/endpoints.md](references/endpoints.md).
- Any `4xx`/`5xx` error, `Retry-After`, or open IP vs high-quota Key limits → read [references/errors-and-limits.md](references/errors-and-limits.md).
- Multi-step recipes (morning briefing, breaking deep-dive, public & private forecasts, pagination) → read [examples/workflows.md](examples/workflows.md).
