### Start the Service Source: https://github.com/znlsl/antigravity2api/blob/main/README.md Recommended command to start the service from the project root. ```bash npm run start ``` -------------------------------- ### Install project dependencies Source: https://github.com/znlsl/antigravity2api/blob/main/README.md Execute this command in the project root to install necessary dependencies. If proxy is enabled, this ensures fetch compatibility. ```bash npm install ``` -------------------------------- ### Alternative Start Command Source: https://github.com/znlsl/antigravity2api/blob/main/README.md Alternative command to start the service using node directly. ```bash node src/server.js ``` -------------------------------- ### Example .env configuration file Source: https://github.com/znlsl/antigravity2api/blob/main/README.md A template for the .env file used to configure service host, port, API keys, and model mappings. ```bash AG2API_HOST=0.0.0.0 AG2API_PORT=3000 AG2API_API_KEYS=sk-your-secret-key-1,sk-your-secret-key-2 AG2API_PROXY_ENABLED=false AG2API_PROXY_URL= AG2API_DEBUG=false AG2API_LOG_RETENTION_DAYS=3 AG2API_RETRY_DELAY_MS=1200 AG2API_QUOTA_REFRESH_S=300 AG2API_CLAUDE_MODEL_MAP={"claude-haiku-4-5":"gemini-3-flash","claude-haiku-4-5-20251001":"gemini-3-flash"} AG2API_GEMINI_MODEL_MAP={"gemini-3-flash-preview":"gemini-3-flash"} AG2API_MCP_XML_ENABLED=true # Deprecated: # AG2API_SWITCH_TO_MCP_MODEL=gemini-3-flash AG2API_UPDATE_REPO=znlsl/Antigravity2Api ``` -------------------------------- ### MCP XML Tool Call Example Source: https://github.com/znlsl/antigravity2api/blob/main/README.md Example of the XML format used for MCP tool calls when the XML bridge is enabled. ```xml {} ``` -------------------------------- ### 命令行添加账号 Source: https://github.com/znlsl/antigravity2api/blob/main/README.md 通过命令行方式添加账号,授权成功后会自动启动服务。 ```bash npm run add ``` -------------------------------- ### 手动启动容器 Source: https://github.com/znlsl/antigravity2api/blob/main/README.md 使用 docker run 手动启动容器并挂载数据卷。 ```bash docker run -d --name antigravity2api \ -p 3000:3000 \ --env-file .env \ -v "$(pwd)/auths:/app/auths" \ -v "$(pwd)/log:/app/log" \ antigravity2api:latest ``` -------------------------------- ### 本地构建与启动 Source: https://github.com/znlsl/antigravity2api/blob/main/README.md 使用 docker-compose 进行本地构建并启动服务。 ```bash docker compose up -d --build ``` -------------------------------- ### 使用 GHCR 镜像启动与更新 Source: https://github.com/znlsl/antigravity2api/blob/main/README.md 使用 docker-compose 启动或更新 GHCR 镜像。 ```bash docker compose -f docker-compose.ghcr.yml up -d ``` ```bash docker compose -f docker-compose.ghcr.yml up -d --pull always ``` -------------------------------- ### 复制环境变量文件 Source: https://github.com/znlsl/antigravity2api/blob/main/README.md 在部署前复制示例环境变量文件。 ```bash cp .env.example .env ``` -------------------------------- ### Enable MCP XML Bridge via Environment Variable Source: https://github.com/znlsl/antigravity2api/blob/main/README.md Set this environment variable in your .env file to enable the MCP XML bridge. ```bash AG2API_MCP_XML_ENABLED=true ``` -------------------------------- ### 手动构建镜像 Source: https://github.com/znlsl/antigravity2api/blob/main/README.md 手动构建 antigravity2api 镜像。 ```bash docker build -t antigravity2api:latest . ``` -------------------------------- ### OpenCode 配置文件示例 Source: https://github.com/znlsl/antigravity2api/blob/main/README.md 位于 C:\Users\你的用户名\.config\opencode\opencode.json 的配置文件,用于指定 Anthropic 提供商的 baseURL。 ```json { "$schema": "https://opencode.ai/config.json", "provider": { "anthropic": { "options": { "baseURL": "http://localhost:3000/v1" } } } } ``` -------------------------------- ### Claude Code 设置文件示例 Source: https://github.com/znlsl/antigravity2api/blob/main/README.md 参考 .claude/settings.json 的配置示例,用于定义默认模型和禁用非必要流量。 ```json { "ANTHROPIC_MODEL": "claude-opus-4-5-thinking", "ANTHROPIC_DEFAULT_HAIKU_MODEL": "gemini-3-flash", "ANTHROPIC_DEFAULT_SONNET_MODEL": "claude-sonnet-4-5-thinking", "ANTHROPIC_DEFAULT_OPUS_MODEL": "claude-opus-4-5-thinking", "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1", } ``` -------------------------------- ### 更新 GHCR 部署 Source: https://github.com/znlsl/antigravity2api/blob/main/README.md 在服务器上拉取并更新 GHCR 镜像。 ```bash docker compose -f docker-compose.ghcr.yml pull docker compose -f docker-compose.ghcr.yml up -d ``` -------------------------------- ### Bypass PowerShell execution policy for npm Source: https://github.com/znlsl/antigravity2api/blob/main/README.md Use this command if you encounter errors regarding npm.ps1 execution policies in PowerShell. ```bash cmd /c npm install ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.