LAPIS: Lightweight API Specification for Intelligent Systems
New lightweight spec reduces GitHub API description from thousands of tokens to hundreds for AI consumption.
A new research paper introduces LAPIS (Lightweight API Specification for Intelligent Systems), a format specifically designed to reduce the token overhead when LLMs consume API documentation. Created by researcher Daniel Garcia, LAPIS addresses a critical bottleneck in AI agent workflows where current standards like OpenAPI generate excessive context that drives up costs and slows processing.
The technical breakthrough comes from domain-specific optimizations. In empirical testing against five real-world APIs including GitHub (1,080 endpoints), Twilio (197 endpoints), and DigitalOcean (545 endpoints), LAPIS achieved average token reductions of 85.5% compared to OpenAPI YAML and 88.6% compared to OpenAPI JSON when measured with the cl100k_base tokenizer. The format introduces structural innovations that OpenAPI either duplicates redundantly or cannot represent at all, including centralized error definitions, webhook trigger conditions, structured rate limit descriptions, and operation flow declarations.
For developers and AI engineers, LAPIS offers practical advantages beyond token savings. The format is fully convertible from existing OpenAPI 3.x specifications via an automated converter and requires no special parser for LLM consumption. This means teams can maintain their existing OpenAPI documentation while generating LAPIS versions specifically for AI agent use cases. Released as an open specification under CC BY 4.0, LAPIS represents a significant step toward more efficient AI-agent interactions with web services, potentially enabling more complex agent workflows within existing context windows and reducing API integration costs for AI applications.
- Achieves 88.6% token reduction vs OpenAPI JSON in tests with production APIs like GitHub's 1,080 endpoints
- Introduces structural innovations OpenAPI lacks: centralized errors, webhook triggers, and operation flow declarations
- Fully convertible from OpenAPI 3.x via automated tool with no special parser needed for LLMs
Why It Matters
Dramatically reduces costs and latency for AI agents interacting with APIs, enabling more complex workflows within existing context limits.