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

# Sử dụng tài liệu CometAPI với LLM

> Sử dụng CometAPI llms.txt và llms-full.txt với trợ lý lập trình, hệ thống truy xuất và prompt model.

Sử dụng `llms.txt` khi bạn cần một chỉ mục gọn nhẹ của các trang tài liệu CometAPI. Sử dụng `llms-full.txt` khi công cụ của bạn có thể nạp toàn bộ văn bản tài liệu để truy xuất, hỏi đáp hoặc hỗ trợ lập trình.

## Tải chỉ mục rút gọn

Yêu cầu sau sẽ tải chỉ mục `llms.txt` của CometAPI:

```bash theme={null}
curl https://apidoc.cometapi.com/llms.txt
```

Phản hồi bắt đầu bằng tiêu đề tài liệu và danh sách các trang được liên kết:

```text theme={null}
# 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)
```

## Tải toàn bộ văn bản

Yêu cầu sau sẽ tải bản xuất toàn bộ văn bản:

```bash theme={null}
curl https://apidoc.cometapi.com/llms-full.txt
```

Phản hồi chứa nội dung trang được nhóm theo URL nguồn:

```text theme={null}
# 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.
```

## Thêm tài liệu vào một job truy xuất

Ví dụ Python sau tải toàn bộ văn bản và ghi vào một tệp cục bộ để lập chỉ mục:

```python theme={null}
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))
```

Kết quả là số lượng ký tự đã được lưu. Đây chỉ là đầu ra ví dụ; giá trị của bạn sẽ khác bất cứ khi nào tài liệu thay đổi:

```text theme={null}
449946
```

## Các lỗi thường gặp

| Error                        | Fix                                                                                    |
| ---------------------------- | -------------------------------------------------------------------------------------- |
| Ngữ cảnh của công cụ quá nhỏ | Dùng `llms.txt` trước, sau đó chỉ tải những trang được liên kết có liên quan.          |
| Toàn bộ văn bản quá lớn      | Chia `llms-full.txt` thành các phần theo heading hoặc URL nguồn trước khi lập chỉ mục. |
| Bộ nhớ đệm cục bộ bị lỗi     | Làm mới tệp trong job đồng bộ tài liệu của bạn.                                        |
| Thiếu trang trong kết quả AI | Xác nhận rằng trang xuất hiện trong điều hướng và trong `llms.txt`.                    |

## Liên kết liên quan

* [Trang chủ tài liệu CometAPI](/)
* [Trang Models](/vi/overview/models)
* [Danh mục model](https://www.cometapi.com/models/)
* [Bảng giá](https://www.cometapi.com/pricing/)
* [Hướng dẫn bắt đầu nhanh CometAPI](/vi/overview/quick-start)

<script type="application/ld+json">
  {`
    {
    "@context": "https://schema.org",
    "@graph": [
      {
        "@type": "TechArticle",
        "@id": "https://apidoc.cometapi.com/guides/how-to-use-cometapi-docs-with-llms",
        "headline": "Làm cách nào để sử dụng tài liệu CometAPI với LLM?",
        "description": "Sử dụng CometAPI llms.txt và llms-full.txt với trợ lý lập trình, hệ thống truy xuất và prompt model.",
        "url": "https://apidoc.cometapi.com/guides/how-to-use-cometapi-docs-with-llms",
        "author": {
          "@type": "Organization",
          "name": "CometAPI"
        },
        "publisher": {
          "@type": "Organization",
          "name": "CometAPI",
          "url": "https://www.cometapi.com"
        }
      },
      {
        "@type": "BreadcrumbList",
        "itemListElement": [
          {
            "@type": "ListItem",
            "position": 1,
            "name": "Tài liệu CometAPI",
            "item": "https://apidoc.cometapi.com/"
          },
          {
            "@type": "ListItem",
            "position": 2,
            "name": "Hướng dẫn",
            "item": "https://apidoc.cometapi.com/guides/use-cometapi-with-openai-sdk"
          },
          {
            "@type": "ListItem",
            "position": 3,
            "name": "Làm cách nào để sử dụng tài liệu CometAPI với LLM?",
            "item": "https://apidoc.cometapi.com/guides/how-to-use-cometapi-docs-with-llms"
          }
        ]
      }
    ]
    }
    `}
</script>
