> ## 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.

# llms.txt の生成

> 指定 URL の llms.txt を生成するエンドポイントです。

## POST /generate

`llms.txt` の生成を開始します。ユーザーのプランに応じて `simple` または `enhanced` を利用できます。

<Note>
  Enhanced は AI でタイトル・説明の品質を高めます。消費クレジットは Simple の約 2 倍です。
</Note>

### リクエストボディ

<ParamField body="url" type="string" required>
  生成対象サイトの URL。http / https を含む有効な URL である必要があります。
</ParamField>

<ParamField body="options" type="object">
  生成オプション。

  <Expandable title="options のプロパティ">
    <ParamField body="maxUrls" type="number" default="50">
      含める URL の最大件数。範囲: 1〜1000。
    </ParamField>

    <ParamField body="showFullText" type="boolean" default="false">
      各ページの全文を出力に含めるかどうか。
    </ParamField>

    <ParamField body="includeModificationDate" type="boolean" default="false">
      URL に最終更新日を含めるかどうか。
    </ParamField>

    <ParamField body="generationMethod" type="string" default="enhanced">
      `simple` または `enhanced`。Simple はメタデータ、Enhanced は AI によりタイトル・説明を改善します。
    </ParamField>

    <ParamField body="cacheAge" type="number" default="3600000">
      キャッシュの有効期間（ミリ秒）。既定は 1 時間でスクレイピングを高速化します。
    </ParamField>
  </Expandable>
</ParamField>

### レスポンス

<ResponseField name="jobId" type="string">
  生成ジョブの一意な識別子。
</ResponseField>

<ResponseField name="status" type="string">
  ジョブの状態: `queued`、`processing`、`completed`、`failed`。
</ResponseField>

<ResponseField name="progress" type="number">
  進捗率（0〜100）。
</ResponseField>

<ResponseField name="message" type="string">
  人が読めるステータスメッセージ。
</ResponseField>

<ResponseField name="fileUrl" type="string">
  生成済み `llms.txt` にアクセスできる URL。
</ResponseField>

<ResponseField name="fullTextUrl" type="string">
  `showFullText` を有効にした場合の全文版 URL。
</ResponseField>

<ResponseField name="siteId" type="string">
  今回の生成で作成または更新されたサイトの ID。
</ResponseField>

<ResponseField name="creditsUsed" type="number">
  今回の生成で差し引かれたクレジット数。
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST https://api.llmgenerator.com/api/v1/generate \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
          "url": "https://www.example.com",
          "options": {
            "maxUrls": 25,
            "generationMethod": "enhanced",
            "showFullText": true
          }
        }'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://api.llmgenerator.com/api/v1/generate', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer YOUR_API_KEY',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      url: 'https://www.example.com',
      options: {
        maxUrls: 25,
        generationMethod: 'enhanced'
      }
    })
  });

  const data = await response.json();
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      'https://api.llmgenerator.com/api/v1/generate',
      headers={
          'Authorization': 'Bearer YOUR_API_KEY',
          'Content-Type': 'application/json'
      },
      json={
          'url': 'https://www.example.com',
          'options': {
              'maxUrls': 25,
              'generationMethod': 'enhanced'
          }
      }
  )

  data = response.json()
  ```
</RequestExample>

<ResponseExample>
  ```json 成功レスポンス theme={null}
  {
    "jobId": "550e8400-e29b-41d4-a716-446655440000",
    "status": "completed",
    "progress": 100,
    "message": "File generated successfully",
    "fileUrl": "https://api.llmgenerator.com/api/v1/file/site_xxxxx",
    "fullTextUrl": "https://api.llmgenerator.com/api/v1/file/site_xxxxx?full=true",
    "siteId": "site_xxxxx",
    "creditsUsed": 50
  }
  ```

  ```json クレジット不足 (402) theme={null}
  {
    "message": "Insufficient credits. Required: 50, Available: 10. Please purchase more credits to continue."
  }
  ```
</ResponseExample>
