Gemini-CLI-2-API enables seamless compatibility between Google Gemini CLI and OpenAI APIs through a modular design. Based on the Node.js technology stack, the project encapsulates the command line interface of the Gemini 2.5 Pro model into a standardized RESTful API service. Developers can access Gemini's AI capabilities without modifying their existing toolchain, which is of significant migration value to teams already using the OpenAI ecosystem.
The core advantages are: 1) complete support for /v1/models and /v1/chat/completions endpoint protocols; 2) automatic bi-directional conversion of OpenAI and Gemini data formats; and 3) a modular code structure to facilitate customized development. Compared with the direct use of Gemini CLI, this program can reduce the access cost by more than 90%.
This answer comes from the articleGemini-CLI-2-API: Converting the Gemini CLI to an OpenAI-compatible Native API ServiceThe