CaIon
eca4eff5f0
feat: Improve backend multilingual support
2026-02-12 14:29:56 +08:00
CaIon
d814d62e2f
refactor: enhance API security with read-only token authentication and improved rate limiting
2026-02-06 21:26:26 +08:00
Calcium-Ion
053699fa98
Merge commit from fork
...
fix: harden token search with pagination, rate limiting and input validation
2026-02-06 17:54:40 +08:00
CaIon
3e1be18310
fix: harden token search with pagination, rate limiting and input validation
...
- Add configurable per-user token creation limit (max_user_tokens)
- Sanitize search input patterns to prevent expensive queries
- Add per-user search rate limiting (by user ID)
- Add pagination to search endpoint with strict page size cap
- Skip empty search fields instead of matching nothing
- Hide internal errors from API responses
- Fix Interface2String float64 formatting causing config parse failures
- Add float-string fallback in config system for int/uint fields
2026-02-06 17:52:19 +08:00
CaIon
67613e0642
fix(i18n): prioritize user settings over Accept-Language header
...
The i18n middleware runs before UserAuth, so user settings weren't
available when language was detected. Now GetLangFromContext checks
user settings first (set by UserAuth) before falling back to the
language set by middleware or Accept-Language header.
2026-02-05 00:37:18 +08:00
CaIon
f60fce6584
feat(i18n): add backend multi-language support with user language preference
...
- Add go-i18n library for internationalization
- Create i18n package with translation keys and YAML locale files (zh/en)
- Implement i18n middleware for language detection from user settings and Accept-Language header
- Add Language field to UserSetting DTO
- Update API response helpers with i18n support (ApiErrorI18n, ApiSuccessI18n)
- Migrate hardcoded messages in token, redemption, and user controllers
- Add frontend language preference settings component
- Sync language preference across header selector and user settings
- Auto-restore user language preference on login
2026-02-05 00:09:32 +08:00
CaIon
7a4fc68bcc
feat(performance): implement system performance monitoring with configurable thresholds
2026-02-04 21:26:07 +08:00
CaIon
9ef7740fe7
feat(file): unify file handling with a new FileSource abstraction for URL and base64 data
2026-02-04 18:23:17 +08:00
Calcium-Ion
1c983a04d3
feat: disk request body cache ( #2780 )
...
* feat: 引入通用 HTTP BodyStorage/DiskCache 缓存配置与管理
- 新增 common/body_storage.go 提供 HTTP 请求体存储抽象和文件缓存能力
- 增加 common/disk_cache_config.go 支持全局磁盘缓存配置
- main.go 挂载缓存初始化流程
- 新增和补充 controller/performance.go (及 unix/windows) 用于缓存性能监控接口
- middleware/body_cleanup.go 自动清理缓存文件
- router 挂载相关接口
- 前端 settings 页面新增性能监控设置 PerformanceSetting
- 优化缓存开关状态和模块热插拔能力
- 其他相关文件同步适配缓存扩展
* fix: 修复 BodyStorage 并发安全和错误处理问题
- 修复 diskStorage.Close() 竞态条件,先获取锁再执行 CAS
- 为 memoryStorage 添加互斥锁和 closed 状态检查
- 修复 CreateBodyStorageFromReader 在磁盘存储失败时的回退逻辑
- 添加缓存命中统计调用 (IncrementDiskCacheHits/IncrementMemoryCacheHits)
- 修复 gin.go 中 Seek 错误被忽略的问题
- 在 api-router 添加 BodyStorageCleanup 中间件
- 修复前端 formatBytes 对异常值的处理
Co-authored-by: Cursor <cursoragent@cursor.com >
---------
Co-authored-by: Cursor <cursoragent@cursor.com >
2026-01-30 01:00:49 +08:00
Seefs
cc1da72d10
feat: openai response /v1/response/compact ( #2644 )
...
* feat: openai response /v1/response/compact
* feat: /v1/response/compact bill
* feat: /v1/response/compact
* feat: /v1/responses/compact -> codex channel
* feat: /v1/responses/compact -> codex channel
* feat: /v1/responses/compact -> codex channel
* feat: codex channel default models
* feat: compact model price
* feat: /v1/responses/comapct test
2026-01-26 20:20:16 +08:00
Seefs
d7d3a2f763
feat: channel affinity ( #2669 )
...
* feat: channel affinity
* feat: channel affinity -> model setting
* fix: channel affinity
* feat: channel affinity op
* feat: channel_type setting
* feat: clean
* feat: cache supports both memory and Redis.
* feat: Optimise ui/ux
* feat: Optimise ui/ux
* feat: Optimise codex usage ui/ux
* feat: Optimise ui/ux
* feat: Optimise ui/ux
* feat: Optimise ui/ux
* feat: If the affinitized channel fails and a retry succeeds on another channel, update the affinity to the successful channel
2026-01-26 19:57:41 +08:00
CaIon
d2df342f4e
fix: update abortWithOpenAiMessage function to use types.ErrorCode
2026-01-19 17:35:28 +08:00
Hackerxiao
ae2ca945f3
Merge branch 'QuantumNous:main' into main
2025-12-30 11:44:15 +08:00
Seefs
14c58aea77
fix: 支持小写bearer和Bearer后带多个空格 && 修复 WSS预扣费错误提取key的问题
2025-12-24 15:52:56 +08:00
t0ng7u
8cb56fc319
🧹 fix: harden request-body size handling and error unwrapping
...
Tighten oversized request handling across relay paths and make error matching reliable.
- Align `MAX_REQUEST_BODY_MB` fallback to `32` in request body reader and decompression middleware
- Stop ignoring `GetRequestBody` errors in relay retry paths; return consistent **413** on oversized bodies (400 for other read errors)
- Add `Unwrap()` to `types.NewAPIError` so `errors.Is/As` can match wrapped underlying errors
- `go test ./...` passes
2025-12-16 18:10:00 +08:00
t0ng7u
8e3f9b1faa
🛡️ fix: prevent OOM on large/decompressed requests; skip heavy prompt meta when token count is disabled
...
Clamp request body size (including post-decompression) to avoid memory exhaustion caused by huge payloads/zip bombs, especially with large-context Claude requests. Add a configurable `MAX_REQUEST_BODY_MB` (default `32`) and document it.
- Enforce max request body size after gzip/br decompression via `http.MaxBytesReader`
- Add a secondary size guard in `common.GetRequestBody` and cache-safe handling
- Return **413 Request Entity Too Large** on oversized bodies in relay entry
- Avoid building large `TokenCountMeta.CombineText` when both token counting and sensitive check are disabled (use lightweight meta for pricing)
- Update READMEs (CN/EN/FR/JA) with `MAX_REQUEST_BODY_MB`
- Fix a handful of vet/formatting issues encountered during the change
- `go test ./...` passes
2025-12-16 17:00:19 +08:00
CaIon
e16e7d6fb9
feat(auth): refactor IP restriction handling to use clearer variable naming
2025-12-15 20:13:09 +08:00
CaIon
39593052b6
feat(auth): enhance IP restriction handling with CIDR support
2025-12-15 17:24:09 +08:00
CaIon
c51936e068
refactor(channel_select): enhance retry logic and context key usage for channel selection
2025-12-13 16:43:38 +08:00
CaIon
1c167c1068
refactor(auth): replace direct token group setting with context key retrieval
2025-12-13 01:38:12 +08:00
Calcium-Ion
147659fb6e
Merge pull request #2426 from QuantumNous/feat/auto-cross-group-retry
...
feat(token): add cross-group retry option for token processing
2025-12-12 20:45:54 +08:00
CaIon
01b4039e96
feat(token): add cross-group retry option for token processing
2025-12-12 17:59:21 +08:00
hackerxiao
8e629a2a11
feat: 支持仅使用x-api-key获取anthropic格式的模型列表 注释增加
2025-12-12 17:27:24 +08:00
hackerxiao
2a16c37aab
feat: 支持仅使用x-api-key获取anthropic格式的模型列表
2025-12-12 16:53:10 +08:00
Seefs
4e69c98b42
Merge pull request #2412 from seefs001/pr-2372
...
feat: add openai video remix endpoint
2025-12-11 23:35:23 +08:00
Leon
50e8639a40
feat: add environment variable switch for critical rate limit
2025-11-06 15:23:34 +08:00
CaIon
52d9b8cc78
refactor(group): update user group handling to utilize userUsableGroups directly and add GetUserGroupRatio function
2025-10-30 21:16:42 +08:00
Seefs
1f419a3c71
Merge pull request #2121 from QuantumNous/feat/special_group
...
feat: add special user usable group setting
2025-10-29 18:54:51 +09:00
CaIon
1ded19795a
feat: add special user usable group setting
2025-10-28 23:25:43 +08:00
CaIon
2b70095b47
feat: implement audio duration retrieval without ffmpeg dependencies
2025-10-28 15:50:45 +08:00
feitianbubu
95a2d02df9
fix: fail get moel by
...
multipart/form-data; boundary
2025-10-23 22:15:02 +08:00
feitianbubu
3ac9ff6028
feat: doubao-seedream support image edit
2025-10-23 21:19:33 +08:00
CaIon
b3f50e9dd0
fix: remove redundant error message details for channel retrieval failures
2025-10-14 13:53:33 +08:00
Seefs
e1c7a4f41f
format: package name -> github.com/QuantumNous/new-api ( #2017 )
2025-10-11 15:30:09 +08:00
feitianbubu
5f36e32821
feat: add openai sdk create
2025-10-11 02:44:01 +08:00
feitianbubu
2479da4986
feat: add sora video fetch task
2025-10-10 15:25:29 +08:00
feitianbubu
3c57cfbf71
fix: avoid get model consuming body
2025-10-10 14:19:49 +08:00
feitianbubu
9f4a2d64a3
feat: add sora video submit task
2025-10-09 15:00:02 +08:00
Seefs
3d1433dd70
Merge branch 'alpha' into pr/fix-video-get-task
2025-10-02 14:43:11 +08:00
Seefs
e8425addf0
feat: 通用二步验证
2025-09-30 12:12:50 +08:00
Seefs
6a34d365ec
Merge branch 'alpha' into feat-vertex-veo
2025-09-13 13:10:39 +08:00
feitianbubu
465830945b
fix: get video task err when Content-Type=json
2025-09-11 12:53:19 +08:00
t0ng7u
cdef6da9e9
🎨 style(go): format entire codebase
...
- Apply canonical Go formatting to all .go files
- No functional changes; whitespace/import/struct layout only
- Improves consistency, reduces diff noise, and aligns with standard tooling
2025-08-31 13:08:34 +08:00
Sh1n3zZ
81e29aaa3d
feat: vertex veo ( #1450 )
2025-08-27 18:06:47 +08:00
creamlike1024
95b487c51e
feat: add disable cache middleware
2025-08-27 01:30:01 +08:00
CaIon
d374a22b70
feat: support qwen-image-edit
2025-08-25 14:33:12 +08:00
Nekohy
abcb353793
feats:add custom headers override
2025-08-24 01:02:23 +08:00
CaIon
2579b3c0ba
refactor: move anthropicKey retrieval to improve authorization handling
2025-08-15 16:08:55 +08:00
CaIon
edeb4791c9
Merge branch 'alpha' into refactor_relay
...
# Conflicts:
# dto/openai_image.go
2025-08-15 13:46:34 +08:00
CaIon
44e9b02b3f
refactor: enhance error handling and masking for model not found scenarios
2025-08-15 12:41:05 +08:00