跳转到主要内容

Documentation Index

Fetch the complete documentation index at: https://docs.llmgenerator.com/llms.txt

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

本指南将引导您完成使用 LLMGenerator API 的基本步骤。完成后,您将能够生成第一个 llms.txt 文件。

1. 创建账户并获取 API 密钥

在使用 API 之前,您需要创建一个 LLMGenerator 账户并获取 API 密钥。
  1. 注册: 在 LLMGenerator 控制台创建账户
  2. 进入 API 设置: 登录后,在账户设置中找到”API 密钥”部分。
  3. 创建密钥: 生成新的 API 密钥。请务必复制并安全保存,之后将无法再次查看。
您的 API 密钥格式如下:llmgen_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

2. 发送第一个 API 请求

现在可以使用 API 密钥向 LLMGenerator API 发送请求了。创建 llms.txt 文件的主要端点是 /api/v1/generate 您需要发送 POST 请求,并在 Authorization 请求头中以 Bearer token 形式传入 API 密钥。
curl -X POST https://api.llmgenerator.com/api/v1/generate \
  -H "Authorization: Bearer 您的API密钥" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://www.example.com",
    "options": {
      "maxUrls": 10,
      "showFullText": true,
      "generationMethod": "simple"
    }
  }'
请将 您的API密钥 替换为第一步中获取的实际 API 密钥。

3. 检查响应

如果请求成功,您将收到包含网站详情和文件 URL 的 JSON 响应:
{
  "success": true,
  "message": "llms.txt 文件生成成功",
  "site": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "url": "https://example.com",
    "status": "completed"
  },
  "fileUrl": "https://api.llmgenerator.com/api/v1/file/550e8400-e29b-41d4-a716-446655440000",
  "fullTextUrl": "https://api.llmgenerator.com/api/v1/file/550e8400-e29b-41d4-a716-446655440000?full=true",
  "creditsUsed": 10,
  "creditsRemaining": 490
}

4. 访问您的文件

生成的文件可以通过以下几种方式访问:
# 在浏览器中查看
curl https://api.llmgenerator.com/api/v1/file/您的网站ID

# 下载为文件
curl https://api.llmgenerator.com/api/v1/file/您的网站ID/download -o llms.txt

# 获取完整文本版本
curl "https://api.llmgenerator.com/api/v1/file/您的网站ID?full=true"

后续步骤

您已成功生成了第一个 llms.txt 文件!以下是您接下来可以做的事情: