Search Github Code
Search GitHub code across public repositories via the GitHub REST API — search by keyword, filter by language, and get matched files with repo name, path, and relevance score. Built for AI coding agents looking for real-world implementations and similar code patterns.
通过 GitHub 官方 REST API 搜索公开仓库中的代码,支持关键词搜索、按编程语言过滤,返回匹配文件的仓库名、路径与相关度评分。适合寻找真实代码实现和相似模式的 AI 编程 Agent。
Endpoint: GET /search/github/code?q=YOUR_QUERY&language=python&limit=10
Important (重要提示): This endpoint requires you to supply your own valid GitHub personal access token (classic or fine-grained, starting with ghp_ or gh_) as the GITHUB_TOKEN environment variable — GitHub's code search API mandates authentication, so requests fail without a configured token. 本端点需要买家自备有效的 GitHub 个人访问令牌并配置为 GITHUB_TOKEN 环境变量,未配置令牌时请求会失败。