GitHub repo xịn · Vui Coding chọn
headroomlabs-ai/headroom
Headroom là công cụ nén dữ liệu đầu ra, nhật ký, đoạn dữ liệu RAG và tập tin trước khi gửi tới mô hình LLM, giúp giảm lượng tokens tiêu thụ. Phù hợp để tối ưu phí và tăng hiệu suất cho các tác vụ AI agents.
Tóm tắt nhanh
Repo này làm được gì?
Headroom là công cụ nén dữ liệu đầu ra, nhật ký, đoạn dữ liệu RAG và tập tin trước khi gửi tới mô hình LLM, giúp giảm lượng tokens tiêu thụ. Phù hợp để tối ưu phí và tăng hiệu suất cho các tác vụ AI agents.
Mô tả từ GitHub
Compress tool outputs, logs, files, and RAG chunks before they reach the LLM. 20% fewer tokens for coding agents, 60-95% fewer tokens for JSON, same answers. Library, proxy, MCP server.
Bắt đầu với repo
Cài đặt và sử dụng
Hướng dẫn cài đặt
Bước 1 — Cài đặt với lệnh: - pip install "headroom-ai[all]" - npm install headroom-ai Bước 2 — Chọn chế độ: - headroom deploy - headroom wrap claude - headroom proxy --port 8787 Bước 3 — Kiểm tra và theo dõi: - headroom doctor - headroom perf - headroom dashboard
Hướng dẫn sử dụng
Sử dụng thư viện Python: - from headroom import compress - messages = [{"role": "user", "content": "Phân tích kết quả này"}] - result = compress(messages, model="gpt-4o") - response = client.chat.completions.create(model="gpt-4o", messages=result.messages) - print(f"Tiết kiệm {result.tokens_saved} tokens ({result.compression_ratio:.0%})")
