# Twitch 热门游戏 API (twitch.top_games)

- Canonical page: [https://everyinfra.com/twitch-api/top_games](https://everyinfra.com/twitch-api/top_games?utm_medium=ai_doc&utm_campaign=page_md)
- Endpoint: POST https://api.everyinfra.com/api/v1/social with {"platform": "twitch", "action": "top_games", "params": {...}}
- Price: $0.001389 per call ($1.39 per 1,000 requests); failed calls and empty results are not charged
- Returns: list, default 10, max 200 per call
- Mode: sync; add "mode": "async" for slow tasks

## Health

- Live health (24h percent, hourly and daily trends): https://api.everyinfra.com/api/v1/social/availability?platform=twitch&action=top_games

## Parameters

| name | type | required | default | description |
|---|---|---|---|---|
| limit | integer (1–200) | no | 10 | 这次调用最多返回的条数，整数，1–200；不传按默认值，实际返回可能少于这个数。超过上限会在扣费前返回 422。 |

## Response fields (items in `results`)

| field | meaning |
|---|---|
| id | 该记录在原平台上的唯一标识。仅在同一平台内唯一，跨平台可能重复。 |
| name | 名称。用于账号/商品/商家类能力，指该对象本身的名字。 |
| viewer_count | 观看人数。 |
| broadcaster_count | 主播数量（游戏维度统计用）。 |
| box_art_url | 游戏封面图。 |
| url | 该记录在原平台上的可访问链接。 |
| platform | 数据来源平台标识，与请求里的 platform 一致（如 xiaohongshu、tiktok）。 |

## Example

```bash
curl -X POST 'https://api.everyinfra.com/api/v1/social' \
  -H "Authorization: Bearer $EVERYINFRA_API_KEY" \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "platform": "twitch",
  "action": "top_games",
  "params": {}
}'
```

```python
import os
import requests

response = requests.post(
    "https://api.everyinfra.com/api/v1/social",
    headers={"Authorization": f"Bearer {os.environ['EVERYINFRA_API_KEY']}"},
    json={
        "platform": "twitch",
        "action": "top_games",
        "params": {},
    },
    timeout=120,
)
print(response.status_code)
print(response.json())
```

## Response example

Real response to the example request above, captured 2026-09-26T08:56:04Z. `results` and `count` are real with personal information (names, handles, avatars, profile links, contact details) removed; the list keeps the first 2 of 10. `id`, `billing` and `quota` differ on every call, so only their shape is shown.

```text
{
  "id": "req_…",
  "platform": "twitch",
  "action": "top_games",
  "results": [
    {
      "id": "516575",
      "name": "VALORANT",
      "viewer_count": 185229,
      "broadcaster_count": 2116,
      "box_art_url": "https://static-cdn.jtvnw.net/ttv-boxart/516575-272x380.jpg",
      "url": "https://www.twitch.tv/directory/game/VALORANT",
      "platform": "twitch"
    },
    {
      "id": "509658",
      "name": "Just Chatting",
      "viewer_count": 160724,
      "broadcaster_count": 3074,
      "box_art_url": "https://static-cdn.jtvnw.net/ttv-boxart/509658-272x380.jpg",
      "url": "https://www.twitch.tv/directory/game/Just%20Chatting",
      "platform": "twitch"
    }
  ],
  "count": 10,
  "billing": {
    "charged": …,
    "charged_usd": …,
    "balance_after_usd": …,
    …
  },
  "quota": { … }
}
```

## Also

- Capability catalog (no key): https://api.everyinfra.com/api/v1/social/catalog?platform=twitch
- OpenAPI: https://everyinfra.com/openapi.json · Agents guide: https://everyinfra.com/agents.md
