Skip to content

Releases

Sub2API 0.1.205

Choose a tag to compare

@github-actions github-actions released this 14 Oct 15:07

订阅分组新增 5 小时用量窗口,可与每日、每周、每月限额同时配置。

新功能

  • 创建、编辑和复制订阅分组时可配置「5 小时限额(USD)」。留空表示不限制,已有分组默认不启用。
  • 5 小时窗口为会话式窗口:窗口结束后的首次请求开启新窗口,持续 5 小时,到期后由下一次请求重新计时。
  • 5 小时用量达到上限后拒绝新请求,返回 5-hour usage limit exceeded。限额同时作用于 HTTP 网关、Gemini 网关和 OpenAI WebSocket 请求。
  • 订阅管理的用量列显示 5 小时用量、进度和重置倒计时;「重置配额」会同时清空 5 小时窗口。
  • 用户「我的订阅」、顶部订阅进度、套餐卡片、购买确认、套餐编辑和 API Key 用量查询页均显示 5 小时限额与用量。
  • /v1/usage、/api/v1/subscriptions 和 /api/v1/subscriptions/progress 返回 5 小时窗口的用量、限额、起点和重置时间;剩余额度取所有已配置窗口的最小值。

升级说明

  • 新增数据库迁移 232_subscription_five_hour_window.sql,为 groups 增加 five_hour_limit_usd,为 user_subscriptions 增加 five_hour_window_start 和 five_hour_usage_usd。升级时自动执行,无需手动操作。
  • 未配置 5 小时限额的分组不开启 5 小时窗口,也不累计 5 小时用量,计费与限额行为保持不变。为已有分组启用 5 小时限额后,用户的 5 小时用量从 0 开始计算。
  • 认证缓存快照版本升级为 v21,升级后旧缓存自动失效并重新加载。

验证

  • 后端单元测试、集成测试(PostgreSQL + Redis,含迁移 232)及 golangci-lint v2.9 全部通过。
  • 前端 243 个测试文件、1,729 个测试,以及 ESLint、TypeScript 检查和生产构建全部通过。
  • 本地环境端到端验证:首次请求开启窗口、超限拒绝、窗口到期后重新开启且不影响日用量、未配置限额的分组不累计 5 小时用量,用户订阅页面正确显示 5 小时进度。
  • GitHub CI 通过,提交 22875d2fd2e75695508f1338c971b4b569c117e2。

安装

docker pull forever94yu/sub2api:0.1.205

下方提供 Linux amd64/arm64、macOS amd64/arm64 和 Windows amd64 安装包,以及 checksums.txt。

安装指南

Sub2API 0.1.204

Choose a tag to compare

@github-actions github-actions released this 08 Oct 03:30

Claude Haiku 5.5

  • 新增 claude-haiku-5-5,支持模型列表、账号白名单、模型映射及 Bedrock 预设。
  • 支持自适应思考、关闭思考、五档推理强度及强制工具调用,完善 Messages、Responses 和 Chat Completions 的流式与非流式兼容性。
  • 更新 Haiku 5.5 默认价格,并按包含缓存的提示长度应用 100,000 token 分档;保留自定义价格及区间定价。
  • 完善 Haiku 5.5 和 Sonnet 5.5 的 Bedrock 原生 Messages 路由、鉴权、思考签名和流式用量记录。
  • 将 Sonnet 5.5 默认缓存读取价格更新为每百万 token $0.10。
  • 修复 Claude 账号成本统计中的 1 小时缓存写入计费。
  • 修复 Claude 缓存及倍率叠加场景的金额精度,保持余额、配额与用量记录的扣费一致性。

Sub2API 0.1.203

Choose a tag to compare

@github-actions github-actions released this 07 Oct 05:13

Maintenance release covering the 12 audited issues in payments, storage, authentication, expiration, and dashboard time ranges.

Bug fixes

  1. Make non-forced balance refunds deduct the full required balance atomically, preventing concurrent spending from producing an under-deducted cash refund.
  2. Preserve the stored S3 secret ciphertext when backup settings are saved with an empty secret field.
  3. Invalidate authentication and billing balance caches after refund deductions or compensation, respecting transaction commits.
  4. Preserve the exact API key expiration selected in the UI. The new expires_at field takes precedence; existing expires_in_days clients remain supported.
  5. Apply the configured default RPM limit when an OAuth user completes registration by providing an email address.
  6. Preserve partial remaining subscription days when redeeming a negative-day adjustment.
  7. Apply the registration email whitelist only to new OAuth accounts so existing users can still sign in.
  8. Preserve and encrypt the config-file image-storage secret on the first admin settings save.
  9. Rebuild the image uploader after reused backup S3 credentials change. Other application instances refresh their configuration within 60 seconds.
  10. Validate recharge channel limits against the total including fees. Align fee calculations, amount precision, and display with backend currency rules.
  11. Make the image-storage connection test send an authenticated S3 bucket request and report connection or permission errors.
  12. Initialize the operations dashboard custom time range in local time, avoiding UTC offset shifts.

Refund confirmation

  • Pending refunds now retain their original balance or subscription deduction until a confirmed outcome. A confirmed failure restores the retained deduction; a confirmed success does not deduct twice.
  • Add Alipay refund queries using the original refund request number, signed SDK requests, and order, merchant, trade, request, and amount validation. Uncertain query results do not restore the reserved balance.
  • Legacy pending records that already returned their balance are settled without silently reducing the deduction after a confirmed cash refund.

Upgrade notes

  • Existing backup S3 secrets saved as plaintext by an older release cannot be safely distinguished from undecryptable legacy ciphertext. Re-enter the S3 secret once in backup settings with a persistent encryption key configured to ensure encrypted storage. Blank-secret edits preserve the existing stored value exactly.
  • Older pending Alipay refunds may have discarded the original refund request number. These records require reconciliation with Alipay before manual correction; the application reports the missing request number instead of guessing a final outcome.

Validation

  • Backend unit and integration tests, including refund, OAuth, API key, subscription, and S3 regression coverage.
  • Frontend full test suite: 241 test files and 1,719 tests passed, plus lint, TypeScript checks, and production build.
  • Go static analysis and embedded server build.
  • GitHub CI and security checks passed for commit f3021daec7f1a3c189221f505262be99a307d303.
  • Make integration-test email fixtures unique independently of Windows clock resolution.

Installation

docker pull forever94yu/sub2api:0.1.203

Linux amd64/arm64, macOS amd64/arm64, and Windows amd64 archives are available below, along with checksums.txt.

Installation guide

Sub2API 0.1.202

Choose a tag to compare

@github-actions github-actions released this 07 Oct 03:56

AI API Gateway Platform - 将 AI 订阅配额分发和管理

同步 上游 Sub2API v0.2.14 中适用于本分支的安全修复,沿用本仓库的独立版本序列。

Bug 修复

  • 修复全新安装使用固定管理员邮箱的问题:未指定 ADMIN_EMAIL 时生成随机登录邮箱,自动生成的凭据在首次启动日志中显示。一键部署脚本同步生成随机邮箱并保存到 .env。
  • 统一自动安装、CLI 和 Web 安装的管理员凭据校验:邮箱必须能通过登录接口校验,显式密码必须为 8-72 字节,符合 bcrypt 的输入上限。
  • 修复 EasyPay 下单签名被重放为支付成功回调的问题:清除客户端 return_url 查询参数,回调验签拒绝非标准通知字段;保留服务端生成的订单和支付恢复参数。
  • 同步 Compose 模板、部署示例及中英日文安装说明,补充管理员初始化和 EasyPay 回调的回归测试。

兼容性说明

  • 已有管理员或已有用户的数据库会跳过首次管理员创建及凭据校验,升级不会因为旧环境变量中的凭据而阻断启动。
  • 全新自动安装若显式提供不合法的邮箱或长度不合要求的密码,将直接报错;未指定邮箱时,请从首次启动日志或一键部署生成的 .env 获取登录邮箱。
  • 本分支 Codex 配置使用本地 model_catalog_json,没有上游远程模型目录的受影响路径;现有 Codex 配置测试全部通过。
  • 上游依赖修复要求的 Vue/server-renderer 3.5.42 和 source-map-js 1.2.2 下限,本分支已满足。

验证

  • 后端单元测试、集成测试、golangci-lint,以及带嵌入前端的发布构建。
  • govulncheck 未发现应用可调用路径中的已知漏洞。
  • 前端 ESLint、TypeScript 检查、239 个文件中的 1684 项测试及生产构建。
  • Codex 模型目录导出的 16 项 Python 测试,以及部署脚本语法、Compose 安全、资源限制、镜像地址、GitHub Token 和 Caddy 缓存测试。
  • GitHub CI 六个任务全部通过,包含 macOS 部署生命周期测试;安全扫描 通过。

已知依赖例外

xlsx 的两项既有高危公告继续按仓库规则记录临时例外,有效期至 2027-01-06。当前功能仅用于管理员导出,不提供工作簿导入或解析路径;此项为例外续期,不表示底层依赖漏洞已经修复。


安装

Docker Hub(amd64 / arm64):

docker pull forever94yu/sub2api:0.1.202

Linux 一键安装:

curl -sSL https://raw.githubusercontent.com/forever94yu/sub2api/main/deploy/install.sh | sudo bash

手动下载: 从下方附件选择对应平台的安装包,使用 checksums.txt 核对 SHA-256。

文档

Sub2API 0.1.201

Choose a tag to compare

@github-actions github-actions released this 06 Oct 14:03

AI API Gateway Platform - 将 AI 订阅配额分发和管理

This release closes three billing gaps in completed-request settlement, persistent WebSocket sessions, and Live calls.

  • Preserve balance and subscription charges when an API key is deleted before completed usage is settled. Other database failures still roll back the transaction, and duplicate settlement remains idempotent.
  • Recheck key validity, user and group access, balance, subscription limits, and key limits before each additional WebSocket turn. Complete the preceding settlement before admitting the next turn, including passthrough connections and disconnect cleanup. Reject ambiguous event-type envelopes before routing.
  • Preserve API key quota and rate-limit metadata for Live calls, and apply the same key accounting and cache invalidation used by other billable requests. Existing Live records remain compatible.
  • Update Axios to 1.20.0, Vue to 3.5.42, and source-map-js to 1.2.2 for dependency security fixes.
  • Keep all 210 bundled model pricing entries unchanged from v0.1.200. No database schema migration is required.

Validation completed before publication:

  • Full local backend unit and integration suites, golangci-lint, and govulncheck passed. The 202 focused regression tests also passed under the Linux race detector.
  • Frontend lint, production build, and all 1684 tests passed. The existing dependency-audit exception policy was preserved.
  • Native application acceptance passed 119 billable requests and four no-charge rejections. The Linux container candidate passed another 22 checks. PostgreSQL usage, balance, API key quota, and account quota records reconciled exactly.
  • All 210 model pricing entries remain byte-identical to v0.1.200. No production provider traffic was used in these tests.

Docker Hub: docker pull forever94yu/sub2api:0.1.201


📥 Installation

Docker:

# Docker Hub
docker pull forever94yu/sub2api:0.1.201

One-line install (Linux):

curl -sSL https://raw.githubusercontent.com/forever94yu/sub2api/main/deploy/install.sh | sudo bash

Manual download:
Download the appropriate archive for your platform from the assets below.

📚 Documentation

Sub2API 0.1.200

Choose a tag to compare

@github-actions github-actions released this 30 Sep 09:28
  • 新增 GPT-6.1 Sol 模型调用、模型列表与客户端配置支持。
  • 支持标准、Priority/Fast、Flex 计费,以及超过 272K 输入的长上下文倍率;新增模型采用独立价格配置,既有模型价格保持不变。
  • 完善 Responses、Chat Completions、Messages 和 WebSocket 的推理参数兼容、工具调用限制及 usage 解析。
  • 修复模型别名下推理强度规则重复应用的问题,并统一 OpenAI 用量日志与实际扣款精度。
  • 修复协议转换时缓存 usage 别名丢失及原生 Chat 响应模型漏记的问题。

Sub2API 0.1.199

Choose a tag to compare

@github-actions github-actions released this 29 Sep 02:36

Claude Sonnet 5.5

  • 新增 claude-sonnet-5-5,支持模型列表、账号白名单、模型映射及 Bedrock 预设。
  • 更新 Sonnet 5.5 默认价格:每百万 token 输入 $2、输出 $10、5 分钟缓存写入 $2.5、1 小时缓存写入 $4、缓存读取 $0.2。
  • 支持默认自适应思考、between_tools 模式,以及 Responses 和 Chat Completions 的推理强度转换。
  • 完善思考签名、工具调用及流式响应兼容性,保留签名重试中的思考模式,避免意外改变推理行为。
  • 完善 Claude 模型别名识别、提供商自定义价格优先级,以及长上下文、缓存和地域计费处理。
  • 修复 Claude 小额费用记录与实际结算精度不一致的问题。
  • 完善 Vertex Claude token 计数接口兼容性。

Sub2API 0.1.198

Choose a tag to compare

@github-actions github-actions released this 24 Sep 16:14

Claude Models

  • Add Claude Fable 5.1 and Opus 5.5 support, including model lists and mapping presets.
  • Improve Claude model alias resolution across native, Bedrock, and Vertex model identifiers.

Claude Compatibility

  • Update Claude Code client identity handling, configurable version overrides, and automatic stable-version synchronization.
  • Fix stale Claude Code version settings after configuration changes.
  • Improve beta-field filtering, Bedrock request compatibility, and adaptive thinking support.
  • Fix signed reasoning round trips and streaming tool-call and text handling.
  • Preserve cache TTL details and returned model information across Messages, Chat Completions, and Responses.

Claude Billing and Pricing

  • Correct Claude model prices, offline fallback prices, and stale Claude 3 cache prices.
  • Reject requests for unpriced Claude models unless explicit pricing is configured.
  • Fix cache-write breakdowns, long-context pricing, Fast-mode and US-region pricing modifiers, and pricing when the returned model differs from the requested model.
  • Correct account-quota rounding for Claude usage while preserving billing retry idempotency.

Sub2API 0.1.197

Choose a tag to compare

@github-actions github-actions released this 23 Sep 01:59

AI API Gateway Platform - 将 AI 订阅配额分发和管理

Add official gpt-6-sol and gpt-6-luna across model discovery, OpenAI and Codex forwarding, and client configuration exports.

  • Add independent official token prices, including cache reads and writes, Fast/Priority, Flex, and long-context multipliers above 272,000 input tokens.
  • Preserve all existing model prices and account/group long-context billing settings.
  • Support native reasoning levels and compatible sampling, tool calling, streaming usage, and provider model metadata.
  • Add regression coverage for usage parsing, recorded costs, model aliases, service tiers, and context boundaries.

Validation includes frontend tests and production build, backend unit and database integration tests, and isolated local HTTP acceptance with a simulated upstream. Real OpenAI credentials were not available in the local test environment.


📥 Installation

Docker:

# Docker Hub
docker pull forever94yu/sub2api:0.1.197

One-line install (Linux):

curl -sSL https://raw.githubusercontent.com/forever94yu/sub2api/main/deploy/install.sh | sudo bash

Manual download:
Download the appropriate archive for your platform from the assets below.

📚 Documentation

Sub2API 0.1.196

Choose a tag to compare

@github-actions github-actions released this 09 Sep 14:47

修复

  • 修复 ChatGPT OAuth 账号生图时调用已停用模型导致请求失败的问题,覆盖后台账号测试、图片生成与编辑及 Responses 接口。