Loading

AxonHub 轻量部署实录[1]-安装篇

一、AxonHub 是干什么的

新版 Codex CLI用的是 OpenAI Responses API,不是老版的 Chat Completions。但国内厂商——DeepSeek、Kimi、GLM、火山引擎——目前基本只提供 Chat Completions 接口。直接填这些 endpoint 进 Codex,它会报格式不兼容的错误。

AxonHub 的核心价值就在这里:它把国内模型的 Completions API 自动转换成 Responses API 格式。Codex 以为自己连的是 OpenAI,实际上 AxonHub 在背后把请求拆给 DeepSeek 或 Kimi,再把返回结果包成 Responses 的格式塞回去。你一行代码不用改,就能让 Codex 跑在国内模型上。

除此之外,它还能做渠道路由(多个 Key 自动切换)、故障检测(某个厂商挂了自动切到另一个)、用量统计(看每个模型烧了多少钱)。项目地址:https://github.com/looplj/axonhub Go语言开发的,单容器就能跑。

二、安装:SQLite 单容器方案

官方默认 docker compose 带了 PostgreSQL,个人用太重。这里用 SQLite 方案,只有一个容器,内存 50~100MB,WSL 里跑起来毫无压力。

1. 准备目录

mkdir -p ~/axonhub && cd ~/axonhub

2. 写 docker-compose.yml

services:
  axonhub:
    image: looplj/axonhub:latest
    container_name: axonhub
    environment:
      AXONHUB_DB_DIALECT: sqlite3
      AXONHUB_DB_DSN: "file:/data/axonhub.db?cache=shared&_fk=1&_pragma=journal_mode(WAL)"
    ports:
      - "8090:8090"
    volumes:
      - ./data:/data
      - ./config.yml:/app/config.yml:ro
    restart: unless-stopped
    healthcheck:
      test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8090/health"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 40s

3. 写 config.yml

server:
  host: "0.0.0.0"
  port: 8090
  name: "AxonHub"
  request_timeout: "30s"
  llm_request_timeout: "600s"
  debug: false
  cors:
    enabled: true
    allowed_origins:
      - "http://localhost:3000"
      - "http://localhost:5173"
      - "http://localhost:8090"
    allowed_methods: ["GET", "POST", "DELETE", "PATCH", "PUT", "OPTIONS", "HEAD"]
    allowed_headers: ["Content-Type", "Authorization", "X-API-Key", "AH-Thread-Id", "AH-Trace-Id"]
    allow_credentials: true

db:
  dialect: "sqlite3"
  dsn: "file:/data/axonhub.db?cache=shared&_fk=1&_pragma=journal_mode(WAL)"
  max_open_conns: 10
  max_idle_conns: 5

cache:
  mode: "memory"
  memory:
    expiration: "5s"
    cleanup_interval: "10m"

log:
  level: "info"
  encoding: "console"
  output: "stdio"

4. 启动

mkdir -p data
chmod 777 data
docker compose up -d

等 healthcheck 通过,访问 http://localhost:8090 ,第一次会跳初始化向导,设管理员账号密码。按提示设置之后登录即可。

登录之后能看到仪表盘,就说明已经安装好了,写一篇,我们继续介绍如何配置。

下图是我运行起来后的界面:

1

posted @ 2026-05-24 01:08  拓荒者IT  阅读(582)  评论(0)    收藏  举报