x402

Context Window Optimize (x402)

Rank and select document chunks by relevance to fit within a token budget. Returns selected/excluded chunks with scores.

get/x402/v2/context-window-optimize

Request

  • Base URL: https://api.strale.io
  • URL: https://api.strale.io/x402/v2/context-window-optimize
  • Auth: none required

Query parameters

querystring required
unknown required
max_tokensinteger

Response

Success

tokens_remaininginteger
total_tokens_usedinteger

Example response

{
  "query": "SELECT * FROM users WHERE active = true LIMIT 10",
  "excluded": [
    {
      "reason": "low relevance"
    }
  ],
  "selected": [],
  "max_tokens": 4000,
  "selected_count": 0,
  "total_documents": 1,
  "tokens_remaining": 4000,
  "total_tokens_used": 0
}

Changes

No recorded changes to this operation across all 1 revision of this API.