
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
One-command setup to proxy Claude Code, Codex, and Gemini CLI as API endpoints (Windows/macOS/Linux)
将 Claude Code CLI / Codex CLI / Gemini CLI 转换为标准 API 端点的本地代理服务。
apixcode 在本地启动一个 HTTP 代理服务,将标准 API 请求转换为 CLI 调用:
客户端 (n8n/程序) → HTTP API 请求 → apixcode 代理 → CLI 命令 → AI 响应
| CLI 工具 | API 端点 | API 格式 | 模型名称 |
|---|---|---|---|
| Claude Code | /v1/messages | Anthropic | claude-* |
| Codex | /v1/chat/completions | OpenAI | codex, gpt-* |
| Gemini | /v1/chat/completions | OpenAI | gemini-* |
至少安装以下 CLI 工具之一:
# Claude Code CLI
npm i -g @anthropic-ai/claude-code
# Codex CLI
npm i -g @openai/codex
# Gemini CLI
npm i -g @google/gemini-cli
Python 要求:
python3python (Python 3.x)npm i -g apixcode
| 平台 | 状态 | 服务管理 |
|---|---|---|
| Linux | ✓ 完全支持 | systemd 服务 |
| macOS | ✓ 完全支持 | 后台进程 |
| Windows | ✓ 完全支持 | 后台进程 (可配合任务计划程序) |
apixcode
交互式菜单:
| 模式 | 绑定地址 | 用途 |
|---|---|---|
| 仅本地 | 127.0.0.1 | 只能本机访问 |
| 本地+远程 | 0.0.0.0 | 允许外部设备访问 |
curl -X POST http://127.0.0.1:18080/v1/messages \
-H "Content-Type: application/json" \
-H "x-api-key: sk-placeholder" \
-d '{
"model": "claude-opus-4-5-20251101",
"max_tokens": 1024,
"messages": [{"role": "user", "content": "Hello"}]
}'
# Codex
curl -X POST http://127.0.0.1:18080/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-placeholder" \
-d '{
"model": "codex",
"messages": [{"role": "user", "content": "Hello"}]
}'
# Gemini (模型名包含 "gemini" 自动路由)
curl -X POST http://127.0.0.1:18080/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-placeholder" \
-d '{
"model": "gemini-2.5-pro",
"messages": [{"role": "user", "content": "Hello"}]
}'
Clawdbot 是一个 Discord AI 机器人网关,通过 apixcode 暴露的本地 API 端点调用 Claude:
Discord 用户消息 → Clawdbot → apixcode API (127.0.0.1:18080) → Claude CLI → AI 响应 → Discord
服务器实际配置 (~/.clawdbot/clawdbot.json):
{
"agents": {
"defaults": {
"model": {
"primary": "anthropic/claude-opus-4-5-20251101"
},
"workspace": "/home/ubuntu/clawd"
}
},
"plugins": {
"entries": {
"discord": {
"enabled": true
}
}
},
"channels": {
"discord": {
"enabled": true,
"token": "YOUR_DISCORD_BOT_TOKEN"
}
},
"models": {
"providers": {
"anthropic": {
"baseUrl": "http://127.0.0.1:18080"
}
}
}
}
关键配置:
models.providers.anthropic.baseUrl 指向 apixcode 代理地址相关服务:
# Clawdbot 服务
sudo systemctl status clawdbot.service
# apixcode 代理服务
sudo systemctl status codecli-hostapi.service
sk-placeholder)http://你的IP:18080sk-placeholder)http://你的IP:18080/v1codex 或 gpt-4ogemini-2.5-pro 或 gemini-2.5-flash⚠️ 注意: n8n 的 "Google Gemini" 原生节点无法使用,因为它期望 Google 原生 API 格式。请使用 OpenAI 节点。
┌─────────────────────────────────────────────────────────┐
│ apixcode 代理 │
│ │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
│ │ /v1/messages│ │/v1/chat/ │ │/v1/chat/ │ │
│ │ (Anthropic) │ │completions │ │completions │ │
│ └──────┬──────┘ │(model:gpt-*)│ │(model: │ │
│ │ └──────┬──────┘ │gemini-*) │ │
│ │ │ └──────┬──────┘ │
│ ▼ ▼ ▼ │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
│ │ Claude CLI │ │ Codex CLI │ │ Gemini CLI │ │
│ │ --print │ │ --full-auto │ │ -p -o text │ │
│ │ --output- │ │ --quiet │ │ --yolo │ │
│ │ format text │ │ │ │ │ │
│ └─────────────┘ └─────────────┘ └─────────────┘ │
└─────────────────────────────────────────────────────────┘
# 端点路由
if path == "/v1/messages":
# Anthropic API → Claude CLI
run_claude(prompt)
elif path == "/v1/chat/completions":
# OpenAI API → 根据模型名路由
if "gemini" in model.lower():
run_gemini(prompt)
else:
run_codex(prompt)
| CLI | 命令 | 说明 |
|---|---|---|
| Claude | claude --print --output-format text --permission-mode bypassPermissions <prompt> | 非交互模式,绕过权限确认 |
| Codex | codex --full-auto --quiet <prompt> | 全自动模式,静默输出 |
| Gemini | gemini -p <prompt> -o text --yolo | 非交互模式,自动批准操作 |
Linux/macOS:
~/.local/share/codecli-hostapi/
├── proxy.py # 代理脚本(自动生成)
└── backups/ # 配置备份
~/.config/codecli-hostapi/
└── config.json # 配置文件
/etc/systemd/system/
└── codecli-hostapi.service # systemd 服务(仅 Linux)
Windows:
%LOCALAPPDATA%\codecli-hostapi\
├── proxy.py # 代理脚本(自动生成)
├── config\
│ └── config.json # 配置文件
└── backups\ # 配置备份
~/.config/codecli-hostapi/config.json:
{
"installed": true,
"installedAt": "2026-01-30T11:00:00.000Z",
"proxyHost": "0.0.0.0",
"proxyPort": 18080,
"claudePath": "/home/ubuntu/.npm-global/bin/claude",
"codexPath": "/home/ubuntu/.npm-global/bin/codex",
"geminiPath": "/home/ubuntu/.npm-global/bin/gemini"
}
# 查看状态
sudo systemctl status codecli-hostapi.service
# 启动/停止/重启
sudo systemctl start codecli-hostapi.service
sudo systemctl stop codecli-hostapi.service
sudo systemctl restart codecli-hostapi.service
# 查看日志
sudo journalctl -u codecli-hostapi.service -f
使用 apixcode 命令的交互式菜单进行启动/停止管理。
Windows 开机自启(可选):
taskschd.msc)python%LOCALAPPDATA%\codecli-hostapi\proxy.pyLinux/macOS:
# 查看占用进程
sudo lsof -i :18080
# 杀掉进程
sudo kill -9 <PID>
Windows (PowerShell/CMD):
# 查看占用进程
netstat -ano | findstr :18080
# 杀掉进程 (PID 为上一步输出的最后一列)
taskkill /PID <PID> /F
代理使用完整路径调用 CLI。如果 CLI 安装位置变化,需要重新运行 apixcode 选择"安装"。
确保 Gemini CLI 已完成 Google OAuth 登录:
gemini # 首次运行会打开浏览器登录
如果之前安装过其他代理服务(如 anthropic-proxy.service),需要先禁用:
sudo systemctl stop anthropic-proxy.service
sudo systemctl disable anthropic-proxy.service
MIT
FAQs
One-command setup to proxy Claude Code, Codex, and Gemini CLI as API endpoints (Windows/macOS/Linux)
We found that apixcode demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.