arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2602.18541cs.SE
收藏

LAPIS:轻量级智能系统API规范

LAPIS: Lightweight API Specification for Intelligent Systems

Daniel Garcia

AI总结:

LAPIS是一种为LLM优化的轻量级API规范格式,通过减少token使用并保留语义信息,提升智能系统对API的处理效率。

摘要:

大型语言模型(LLMs)越来越多地作为API规范的消费者,无论用于代码生成、自主代理交互还是API辅助推理。事实上的API描述标准OpenAPI最初是为文档工具和代码生成器设计的,因此在用作LLM上下文时会产生显著的token开销。我们提出了LAPIS(轻量级智能系统API规范),一种为LLM消费优化的领域特定格式,该格式在保留API推理所需的语义信息的同时最小化token使用。通过针对五个真实生产API规范(包括GitHub(1,080个端点)、Twilio(197个端点)、DigitalOcean(545个端点)、Petstore和HTTPBin)的实证评估,我们证明与OpenAPI YAML相比平均token减少85.5%,与OpenAPI JSON相比减少88.6%,使用cl100k_base tokenizer测量。LAPIS引入了领域特定的结构创新,包括集中化的错误定义、webhook触发条件、结构化的速率限制描述以及操作流程声明信息,这些在OpenAPI中要么被冗余地重复,要么无法表示。该格式可通过自动化转换器从OpenAPI 3.x完全转换,不需要专门的解析器即可用于LLM消费,并以CC BY 4.0开放规范发布。

英文摘要:

Large Language Models (LLMs) increasingly serve as consumers of API specifications, whether for code generation, autonomous agent interaction, or API-assisted reasoning. The de facto standard for API description, OpenAPI, was designed for documentation tools and code generators, resulting in substantial token overhead when used as LLM context. We present LAPIS (Lightweight API Specification for Intelligent Systems), a domain-specific format optimized for LLM consumption that preserves the semantic information necessary for API reasoning while minimizing token usage. Through empirical evaluation against five real-world production API specifications including GitHub (1,080 endpoints), Twilio (197 endpoints), DigitalOcean (545 endpoints), Petstore, and HTTPBin we demonstrate an average token reduction of 85.5% compared to OpenAPI YAML and 88.6% compared to OpenAPI JSON, measured with the cl100k_base tokenizer. LAPIS introduces domain-specific structural innovations, including centralized error definitions, webhook trigger conditions, structured rate limit descriptions, and operation flow declarations information that OpenAPI either duplicates redundantly or cannot represent at all. The format is fully convertible from OpenAPI 3.x via an automated converter, requires no special parser for LLM consumption, and is released as an open specification under CC BY 4.0.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑