| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
将 Google Antigravity API 转换为 OpenAI 兼容格式的代理服务,支持流式响应、工具调用和多账号管理。
npm install编辑 config.json 配置服务器和 API 参数:
{
"server": {
"port": 8045,
"host": "0.0.0.0"
},
"security": {
"apiKey": "sk-text"
}
}npm run login浏览器会自动打开 Google 授权页面,授权后 Token 会保存到 data/accounts.json。
npm start服务将在 http://localhost:8045 启动。
curl http://localhost:8045/v1/models \
-H "Authorization: Bearer sk-text"curl http://localhost:8045/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-text" \
-d '{
"model": "gemini-2.0-flash-exp",
"messages": [{"role": "user", "content": "你好"}],
"stream": true
}'curl http://localhost:8045/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-text" \
-d '{
"model": "gemini-2.0-flash-exp",
"messages": [{"role": "user", "content": "你好"}],
"stream": false
}'curl http://localhost:8045/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-text" \
-d '{
"model": "gemini-2.0-flash-exp",
"messages": [{"role": "user", "content": "北京天气怎么样"}],
"tools": [{
"type": "function",
"function": {
"name": "get_weather",
"description": "获取天气信息",
"parameters": {
"type": "object",
"properties": {
"location": {"type": "string", "description": "城市名称"}
}
}
}
}]
}'支持 Base64 编码的图片输入,兼容 OpenAI 的多模态格式:
curl http://localhost:8045/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-text" \
-d '{
"model": "gemini-2.0-flash-exp",
"messages": [{
"role": "user",
"content": [
{"type": "text", "text": "这张图片里有什么?"},
{
"type": "image_url",
"image_url": {
"url": "data:image/jpeg;base64,/9j/4AAQSkZJRg..."
}
}
]
}],
"stream": true
}'支持的图片格式:
data/accounts.json 支持多个账号,服务会自动轮换使用:
[
{
"access_token": "ya29.xxx",
"refresh_token": "1//xxx",
"expires_in": 3599,
"timestamp": 1234567890000,
"enable": true
},
{
"access_token": "ya29.yyy",
"refresh_token": "1//yyy",
"expires_in": 3599,
"timestamp": 1234567890000,
"enable": true
}
]| 配置项 | 说明 | 默认值 |
|---|---|---|
| server.port | 服务端口 | 8045 |
| server.host | 监听地址 | 0.0.0.0 |
| security.apiKey | API 认证密钥 | sk-text |
| security.maxRequestSize | 最大请求体大小 | 50mb |
| defaults.temperature | 默认温度参数 | 1 |
| defaults.top_p | 默认 top_p | 0.85 |
| defaults.top_k | 默认 top_k | 50 |
| defaults.max_tokens | 默认最大 token 数 | 8096 |
| systemInstruction | 系统提示词 | - |
# 启动服务
npm start
# 开发模式(自动重启)
npm run dev
# 登录获取 Token
npm run login. ├── data/ │ └── accounts.json # Token 存储(自动生成) ├── scripts/ │ └── oauth-server.js # OAuth 登录服务 ├── src/ │ ├── api/ │ │ └── client.js # API 调用逻辑 │ ├── auth/ │ │ └── token_manager.js # Token 管理 │ ├── config/ │ │ └── config.js # 配置加载 │ ├── server/ │ │ └── index.js # 主服务器 │ └── utils/ │ ├── logger.js # 日志模块 │ └── utils.js # 工具函数 ├── config.json # 配置文件 └── package.json # 项目配置
MIT
| Back | FazBrowse Home | New Git URL |