mayrain 65e3b6f3da fix(codex): trigger image override only on explicit tool_choice
The codex `apply_codex_openai_responses_special_body_edits` override
previously triggered whenever the `tools` array contained an
`image_generation` entry, regardless of whether the caller actually
asked to use it. Codex CLI advertises `image_generation` alongside
~20 other tools under `tool_choice: "auto"`, so every routine codex
conversation was being rewritten into image-generation-only form:

  - `model` forced to `gpt-5.4-mini` (CODEX_OPENAI_IMAGE_INTERNAL_MODEL)
  - `stream` forced to `true`
  - `tools` truncated to a single `image_generation` entry
  - `tool_choice` overwritten to `{"type":"image_generation"}`

The upstream ChatGPT codex backend then rejected the request with
`400 Tool choice 'image_generation' not found in 'tools' parameter`,
which the gateway surfaced as a retryable 503 to clients. The bug
reproduced on every codex CLI session that included the image tool
in its tool catalogue, even though the user never requested image
generation.

Narrow the trigger to the caller's actual selection. The new helper
`codex_openai_responses_tool_choice_references_image_generation`
matches only the explicit string `"image_generation"` or the object
form `{"type":"image_generation"}`. The pre-existing
`is_openai_image_request(provider_api_format)` branch still handles
genuine `openai:image` traffic, so true image-generation flows are
unaffected.

Tests:
  - lock the regression: `tool_choice: "auto"` with image_generation
    in tools must not trigger the override (model/tools preserved)
  - lock variants: string `"image_generation"` and object form both
    still trigger; other tool_choice values and an absent
    `tool_choice` do not
2026-05-20 09:52:39 +08:00
2026-05-19 03:16:35 +08:00
2026-05-15 11:29:16 +08:00

Aether Logo

Aether

一站式 AI 基础设施平台
支持 Claude / OpenAI / Gemini 及其 CLI 客户端的统一接入、格式转换、正/反向代理, 致力于成为用户驱动AI服务的底座

简介部署API 文档环境变量Q&A


简介

Aether 是一个自托管的 AI API 网关,为团队和个人提供多租户管理、智能负载均衡、成本配额控制和健康监控能力。通过统一的 API 入口,可以无缝对接 Claude、OpenAI、Gemini 等主流 AI 服务及其 CLI 工具。

Aether Architecture

页面预览: https://fawney19.github.io/Aether/

部署

Docker Compose推荐预构建镜像

# 1. 克隆代码
git clone https://github.com/fawney19/Aether.git
cd Aether

# 2. 配置环境变量
cp .env.example .env
# 生成 JWT_SECRET_KEY / ENCRYPTION_KEY, 并填入 .env
./generate_keys.sh
# 编辑 .env 设置 ADMIN_PASSWORD

# 3. 首次部署 / 更新 (从以下部署形态任选其一)
# Postgres + Redis (适用于企业或多人使用)
docker compose pull && docker compose up -d
# Single Node (适用于个人用户或朋友分享)
docker compose -f docker-compose.single-node.yml pull && docker compose -f docker-compose.single-node.yml up -d

一键安装(默认 Single NodeLinux systemd / macOS launchd + SQLite

cd Aether && cd Aether
curl -fsSL https://raw.githubusercontent.com/fawney19/Aether/main/install.sh | sudo bash

本地开发

依赖 Docker、Rust toolchain、Node.js 和 make。

make dev

make dev 会同时启动后端 aether-gateway 和前端 frontend 的 Vite dev server。需要单独启动时可使用 make dev-backendmake dev-frontend。 Postgres / Redis 本地依赖未就绪时,make dev 会自动执行 docker compose up -d postgres redis

Aether Tunnel (可选)

Aether Tunnel 是配套的正向代理节点,部署在海外 VPS 上,为墙内的 Aether 实例中转 API 流量。

  • Docker Compose 部署或下载预编译二进制直接运行
  • 提供 macOS/Linux 与 Windows 一键脚本,自动下载最新 tunnel-v* 制品并向现有 aether-tunnel.toml 追加 [[servers]]
  • 通过 aether-tunnel setup 完成交互式配置,自动注册为系统服务
  • 详细文档见 apps/aether-tunnel/README.md

API 文档

环境变量

  • APP_PORTaether-gateway 唯一监听端口,固定绑定 0.0.0.0:${APP_PORT}
  • DATABASE_URL数据库连接串SQLite 例如 sqlite:///opt/aether/data/aether.dbPostgres 例如 postgresql://postgres:aether@postgres:5432/aether
  • REDIS_URLRedis 连接串;仅 Postgres + Redis 的 Docker Compose 部署需要配置
  • AETHER_RUNTIME_BACKEND=memory|redis:运行时缓存/协调后端。SQLite 默认用 memory,不会连接 Redis
  • AETHER_GATEWAY_AUTO_PREPARE_DATABASE:常规启动前自动执行挂起的 schema migration 和 backfill仓库自带的 docker-compose.yml 默认开启
  • JWT_SECRET_KEY / ENCRYPTION_KEY:认证和敏感数据加密所需密钥
  • API_KEY_PREFIX:用户和管理员新建 API Key 时使用的前缀,默认 sk
  • ADMIN_USERNAME / ADMIN_PASSWORD / ADMIN_EMAIL:首次启动时自举首个本地管理员;install.sh 会提示输入管理员密码
  • CORS_ORIGINS / CORS_ALLOW_CREDENTIALS:前端跨域来源控制;如果要跨域带登录 CookieCORS_ORIGINS 不能写 *
  • RUST_LOGRust 日志过滤,例如 aether_gateway=infoaether_gateway=debug,sqlx=warn
  • Docker Compose 的 DB_PASSWORD / REDIS_PASSWORD 默认使用 aether

许可证

本项目采用 Aether 非商业开源许可证。允许个人学习、教育研究、非盈利组织及企业内部非盈利性质的使用;禁止用于盈利目的。商业使用请联系获取商业许可。

联系作者

QQ二维码      QQ群二维码

Star History

Star History Chart

Description
No description provided
Readme 168 MiB
Languages
Python 68.3%
Vue 21.7%
TypeScript 7.3%
Rust 2%
CSS 0.3%
Other 0.2%