跳转到主要内容

Documentation Index

Fetch the complete documentation index at: https://apidoc.cometapi.com/llms.txt

Use this file to discover all available pages before exploring further.

当你需要 CometAPI 文档页面的精简索引时,请使用 llms.txt。当你的工具可以摄取完整文档文本以用于检索、问答或编码辅助时,请使用 llms-full.txt

获取精简索引

以下请求会下载 CometAPI 的 llms.txt 索引:
curl https://apidoc.cometapi.com/llms.txt
响应会以文档标题和链接页面列表开头:
# CometAPI Documentation

> CometAPI developer documentation for unified API access...

## Docs

- [Create a new API key](https://apidoc.cometapi.com/api/api-keys/create-api-key.md)

获取全文文本

以下请求会下载全文导出:
curl https://apidoc.cometapi.com/llms-full.txt
响应包含按源 URL 分组的页面内容:
# Create a new API key
Source: https://apidoc.cometapi.com/api/api-keys/create-api-key

Create a new CometAPI API key for the authenticated account.

将文档添加到检索任务

以下 Python 示例会下载全文文本,并将其写入本地文件以便建立索引:
from pathlib import Path

import requests

url = "https://apidoc.cometapi.com/llms-full.txt"
response = requests.get(url, timeout=60)
response.raise_for_status()

Path("cometapi-docs.txt").write_text(response.text, encoding="utf-8")
print(len(response.text))
结果是已保存的字符数。这只是示例输出;每当文档发生变化时,你的值都会不同:
449946

常见错误

错误解决方法
工具上下文太小先使用 llms.txt,然后只获取相关的链接页面。
全文文本太大在建立索引之前,按标题或源 URL 对 llms-full.txt 进行分块。
本地缓存损坏在你的文档同步任务期间刷新该文件。
AI 结果中缺少页面确认该页面出现在导航中,并且也包含在 llms.txt 中。

相关链接

Last modified on May 28, 2026