How Pi Abstracts OpenAI and Anthropic APIs
How Pi Abstracts OpenAI and Anthropic APIs This analysis is based on pi commit 588915ec71714688cee8b7153339e8bdebb3e82e . Pi supports multiple LLM APIs without forcing them into a single wire-level protocol. Its abstraction boundary is higher than the provider payload but lower than the agent itself. The design can be summarized as: Agent loop -> provider-neutral messages, tools, and stream events -> API-specific adapter -> native provider SDK or HTTP/SSE protocol The agent does not know whether a model uses Chat Completions, Responses, or Anthropic Messages. The API adapter does. What Are Pi and the Pi Coding Agent? Pi is an open-source agent harness for building and running extensible AI agents. It provides reusable components for multi-provider LLM access, agent execution, tool calling, session state, authentication, extensions, and terminal interfaces. The Pi coding agent is the project’s interactive terminal application for software dev...