{
  "id": 534624,
  "title": "Optimizing LLM Context for OpenAPI: A Deterministic Approach to Token Reduction",
  "url": "https://urgent.news/2026/08/11/optimizing-llm-context-for-openapi-a-deterministic-approach-to-token",
  "topic": "ai",
  "section": "AI",
  "published": "2026-08-11T05:09:11.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/theanshulprakash/optimizing-llm-context-for-openapi-a-deterministic-approach-to-token-reduction-da2"
  },
  "original_language": "en",
  "account": "An agentic API testing prototype was developed to optimize the use of large OpenAPI specifications when interacting with large language models (LLMs). The original goal was for an AI agent to read the OpenAPI specification, generate test plans, and analyze API failures. However, large OpenAPI specifications are problematic for LLMs because they require thousands of tokens per session, causing the model to hallucinate and become overwhelmed. To solve this issue, the author developed a deterministic approach called OpenAPI Context Batching, which reduces approximate token usage by ~81.7%. The algorithm splits the specification by domains, resolves recursive references, extracts only the required schemas, and creates a focused context map for specific endpoints. This reduces the token usage from ~50,000 to ~9,200 tokens, making the AI more efficient and responsive.",
  "summary": "How deterministic context batching reduced approximate token usage by ~81.7% while building an agentic API testing prototype See It in Action I also recorded a short demo showing the complete workflow, from loading the OpenAPI specification to generating and executing tests, and auto healing: Watch the demo on YouTube I originally built this as part of my GSoC 2026 proposal for foss42 . I wasn't…",
  "key_points": [],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}