HTTP Server
When the server feature is enabled, forgetless-server exposes a multipart API on port 8080 with POST / and GET /health.
Start the server#
cargo run --features server --bin forgetless-serverThe server uses Axum, enables permissive CORS through tower-http, and raises the multipart body limit to 50 MB.
Request shape#
| Field | Type | Meaning |
|---|---|---|
| metadata | JSON string | Contains max_tokens, optional query, and inline text contents. |
| file | Multipart file | Uploaded with medium priority. |
| file:critical | Multipart file | Uploaded with critical priority. |
| file:high | Multipart file | Uploaded with high priority. |
| file:low | Multipart file | Uploaded with low priority. |
{
"max_tokens": 128000,
"query": "Summarize the main architectural changes",
"contents": [
{ "content": "You are preparing release notes.", "priority": "critical" },
{ "content": "Keep the answer short.", "priority": "high" }
]
}Response shape#
{
"content": "## system.md\nInstructions...\n\n---\n\n## review.pdf\nKey findings...",
"total_tokens": 45211,
"compression_ratio": 2.79,
"stats": {
"input_tokens": 126000,
"output_tokens": 45211,
"chunks_processed": 89,
"chunks_selected": 32,
"processing_time_ms": 1250
}
}Related#
Configuration
Configure Forgetless token budgets, scoring weights, chunk behavior, local model options, and feature toggles to tune LLM context for your workload.
Tokenizer
Count LLM tokens in Rust with cl100k_base or a custom chars-per-token mode, plus truncation helpers and image token estimation to plan context budgets.
Results
Read the Forgetless result types: OptimizedContext, selected chunks, score breakdowns, token statistics, and the compression ratio returned after each run.