Containerized deployment is the most recommended deployment method for geminicli2api and is divided into three steps:
1. Building mirrors::
Execute in the project directory docker build -t geminicli2api . command, Dockerfile has built-in FastAPI environment configuration
2. Configuration of environmental variables::
The container must be run with the-eParameter Passing:GEMINI_AUTH_PASSWORD(API access password)GEMINI_CREDENTIALS(Google OAuth JSON string)
or mounting the file containing the credentials of thecredentialscatalogs
3. Port mapping::
Standard deployment utilization-p 8888:8888If you want to change the port to 7860, Hugging Face Spaces needs to change to port 7860.
Full Example:docker run -p 8888:8888 -e GEMINI_AUTH_PASSWORD=xxx -e GEMINI_CREDENTIALS='{...}' geminicli2api
This answer comes from the articlegeminicli2api: Proxy tool to convert Gemini CLI to OpenAI-compatible APIsThe































