# GitHub 仓库分叉 API (github.forks)

- Canonical page: https://everyinfra.com/github-api/forks
- Endpoint: POST /api/v1/social with {"platform": "github", "action": "forks", "params": {...}}
- Price: $0.000958 per call ($0.96 per 1,000 requests); failed and empty results are not charged
- Returns: list, default 30, max 100 per call
- Mode: sync; add "mode": "async" for slow tasks

GitHub 仓库分叉按仓库 `url` 列出这个仓库被分叉出去的副本，每个分叉带主人用户名和类型 `owner_type`（个人或组织）、描述、星标数、它自己的分叉数、默认分支，以及创建和最近推送时间。它回答「谁在基于这个项目做二次开发」，适合寻找活跃的下游分支、粗看有哪些组织分叉了它，或者在原项目停更后找接手维护的分叉。

`url` 填仓库链接或 owner/repo 写法，单次默认 30 条，最多 100 条。用 `sort` 按最新、最早、星标数或关注数排序，默认最新分叉在前。用户的仓库按用户名列一个账号名下的仓库，单次最多 30 条，多出开源许可证和是否分叉的标记，这一页没有这两项。

## Health

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

## Parameters

| name | type | required | default | description |
|---|---|---|---|---|
| url | not declared | yes | not declared | GitHub 仓库链接或 owner/repo。 |
| sort | enum: newest / oldest / stargazers / watchers | no | not declared | newest（默认，最新分叉在前）、oldest、stargazers（按星标）、watchers。 |
| limit | integer (1–100) | no | 30 | 这次调用最多返回的条数，整数，1–100；不传按默认值，实际返回可能少于这个数。超过上限会在扣费前返回 422。 |

## Response fields (items in `results`)

| field | meaning |
|---|---|
| id | GitHub 内部数字 ID（字符串）。 |
| full_name | 仓库全名 owner/repo；仓库改过名或转过主人时是新名字。 |
| name | 仓库名（不含 owner）。 |
| owner_username | 仓库主人（用户或组织）的用户名。 |
| owner_url | 仓库主人的 GitHub 主页链接。 |
| owner_avatar_url | 仓库主人的头像链接。 |
| owner_type | 仓库主人类型：User 或 Organization（forks）。 |
| url | 该记录在原平台上的可访问链接。 |
| description | 简介或描述，通常比 text 短。 |
| homepage | 仓库填写的项目主页；没填时没有这个字段。 |
| language | 内容语言代码（如 zh、en），由平台判定，可能不准。 |
| topics | 仓库主题标签列表；没有时没有这个字段。 |
| star_count | 星标数。 |
| fork_count | 分叉数。 |
| open_issue_count | 未关闭的 Issue 加 PR 数（GitHub 口径）。 |
| default_branch | 默认分支名。 |
| is_archived | 仓库是否已归档（只读）。 |
| size_kb | 仓库大小，单位 KB（GitHub 口径）。 |
| created_at | 创建时间，格式同 posted_at。 |
| updated_at | 最近更新时间，ISO 8601 UTC。 |
| pushed_at | 最近一次推送代码的时间，ISO 8601 UTC（repository / user_repositories / forks）。 |
| 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": "github",
  "action": "forks",
  "params": {
    "url": "https://github.com/facebook/react"
  }
}'
```

```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": "github",
        "action": "forks",
        "params": {
            "url": "https://github.com/facebook/react",
        },
    },
    timeout=120,
)
print(response.status_code)
print(response.json())
```

## Response example

No real sample for these example parameters yet: structure only, every value is a placeholder (…).

```text
{
  "id": "req_…",
  "platform": "github",
  "action": "forks",
  "results": [
    {
      "id": …,
      "full_name": …,
      "name": …,
      "owner_username": …,
      "owner_url": …,
      "owner_avatar_url": …,
      "owner_type": …,
      "url": …,
      "description": …,
      "homepage": …,
      "language": …,
      "topics": …,
      "star_count": …,
      "fork_count": …,
      "open_issue_count": …,
      "default_branch": …,
      "is_archived": …,
      "size_kb": …,
      "created_at": …,
      "updated_at": …,
      "pushed_at": …,
      "platform": …
    }
  ],
  "count": …,
  "billing": {
    "charged": …,
    "charged_usd": …,
    "balance_after_usd": …,
    …
  },
  "quota": { … }
}
```

## FAQ

### 原项目停更了，怎么找还在维护的分叉？

`sort` 传 `stargazers`，把星标多的分叉排在前面，再看每个分叉的 `pushed_at`：星标多、推送时间近的分叉更值得先看。最好再打开仓库确认它的提交和原项目有实质差异。已归档的分叉 `is_archived` 为 true，是只读的，可以先排除。`fork_count` 是这个分叉自己被再次分叉的次数，二级下游也能顺着找。

### 能看出哪些公司在用这个项目吗？

能找到一部分线索。按 `owner_type` 筛出 Organization，就是以组织名义分叉的副本；这只代表有人分叉过，不等于正式使用。`owner_type` 的取值只有 User 和 Organization。`owner_username` 是分叉主人的用户名，`owner_url` 是主页链接，想看这个组织名下还有哪些仓库，把用户名交给用户的仓库那一页。

### 分叉列表和仓库详情的字段有什么不同？

分叉列表多一个 `owner_type`，但不返回开源许可证，也不标这个仓库本身是不是分叉。要看某个分叉的许可证，把它的 `full_name` 传给仓库详情。仓库详情一次只读一个仓库，分叉列表一次最多列 100 个分叉，先在这里挑出值得看的，再逐个读详情。`pushed_at` 是最近一次推送代码的时间，拿它和原项目的 `pushed_at` 对照，能看出谁更新得更勤。

## Also

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