使用该工具时需要特别注意:
- 认证安全::
GEMINI_AUTH_PASSWORD
必须设置为非空值,否则所有API请求将返回401错误 - 配额监控::
Google Cloud免费层有每分钟60次的调用限制,建议通过gcloud quota metrics
监控使用量 - Streaming Response::
客户端需实现分块数据接收逻辑,普通HTTP库可能无法直接处理SSE格式响应 - OAuth时效::
refresh_token默认有效期为7天,长期运行的服务需要实现自动续期机制
推荐的生产环境实践:
• 使用Docker Compose管理服务生命周期
• 通过Nginx添加HTTPS和速率限制
• 定期轮换API访问密码
This answer comes from the articlegeminicli2api: Proxy tool to convert Gemini CLI to OpenAI-compatible APIsThe