CaIon
97ea8b6560
refactor: Introduce pre-consume quota and unify relay handlers
...
This commit introduces a major architectural refactoring to improve quota management, centralize logging, and streamline the relay handling logic.
Key changes:
- **Pre-consume Quota:** Implements a new mechanism to check and reserve user quota *before* making the request to the upstream provider. This ensures more accurate quota deduction and prevents users from exceeding their limits due to concurrent requests.
- **Unified Relay Handlers:** Refactors the relay logic to use generic handlers (e.g., `ChatHandler`, `ImageHandler`) instead of provider-specific implementations. This significantly reduces code duplication and simplifies adding new channels.
- **Centralized Logger:** A new dedicated `logger` package is introduced, and all system logging calls are migrated to use it, moving this responsibility out of the `common` package.
- **Code Reorganization:** DTOs are generalized (e.g., `dalle.go` -> `openai_image.go`) and utility code is moved to more appropriate packages (e.g., `common/http.go` -> `service/http.go`) for better code structure.
2025-08-14 20:05:06 +08:00
nekohy
4cf1ffa801
✨ feat: Enhance model listing and retrieval with support for Anthropic and Gemini models; refactor routes for better API key handling
2025-08-10 11:44:38 +08:00
CaIon
cf11a22c3a
🔧 refactor(auth, channel, context): improve context setup and validation for multi-key channels
2025-07-06 12:37:56 +08:00
Calcium-Ion
aa0edd8dce
Merge pull request #1321 from iszcz/main
...
支持Midjourney视频任务和图片编辑
2025-07-05 15:28:33 +08:00
iszcz
d4f2f4dbbe
支持Midjourney视频任务和图片编辑
2025-06-30 22:31:12 +08:00
CaIon
04d525e317
🚀 feat(auth): support new model API paths in authentication and routing
...
- Updated TokenAuth middleware to handle requests for both `/v1beta/models/` and `/v1/models/`.
- Adjusted distributor middleware to recognize the new model path.
- Enhanced relay mode determination to include the new model path.
- Added route for handling POST requests to `/models/*path`.
These changes ensure compatibility with the new model API structure, improving the overall routing and authentication flow.
2025-06-25 00:19:38 +08:00
CaIon
ad4d3efd2e
✨ feat(middleware): add HTTP statistics middleware
2025-06-10 19:29:32 +08:00
creamlike1024
75d859dce2
gemini text generation
2025-05-26 13:34:41 +08:00
creamlike1024
8ea4c76f2b
feat: support /v1/responses API
2025-05-02 13:59:46 +08:00
xyfacai
873ebcf0c7
feat: support /images/edit
...
(cherry picked from commit 1c0a1238787d490f02dd9269b616580a16604180)
2025-04-26 15:44:56 +08:00
1808837298@qq.com
78fc3a191c
feat: claude relay
2025-03-12 21:31:46 +08:00
1808837298@qq.com
1763145fea
feat: Add model request rate limiting functionality
2025-02-24 16:20:55 +08:00
CalciumIon
270857e370
feat: support br
2024-12-04 23:53:02 +08:00
CalciumIon
407d03a0ba
feat: support gzip
2024-12-04 23:24:46 +08:00
1808837298@qq.com
698b6ed7d7
Update dto
...
(cherry picked from commit 030187ff75c64c40017cda2fa98ef2b3c01f0bd5)
2024-11-05 19:23:56 +08:00
1808837298@qq.com
07fa9205cb
feat: playground
2024-09-26 00:59:09 +08:00
kakingone
442a2f0f4d
addupload
2024-07-31 15:48:51 +08:00
CalciumIon
c7ba4a245b
feat: support cohere rerank
2024-07-06 17:09:22 +08:00
Xiangyuan Liu
05a4646b44
feat: suno api 支持
...
feat: 调试 suno
feat: 补充suno 文档
2024-06-13 10:35:48 +08:00
Xiangyuan Liu
d30187e24f
feat: 支持 /mj-{mode} 路径
2024-03-29 16:48:50 +08:00
CaIon
afa1748591
feat: support InsightFace ( close #60 )
2024-03-14 18:09:57 +08:00
CaIon
8a632b7825
feat: 兼容自定义变焦,完善modal操作
2024-03-14 16:42:37 +08:00
CaIon
62bca310e3
feat: support shorten
2024-03-13 17:46:34 +08:00
CaIon
259c7fcdb0
feat: 初步兼容midjourney-proxy-plus
2024-03-13 15:37:01 +08:00
1808837298@qq.com
1735981217
feat: 初步重构
2024-02-29 01:08:18 +08:00
CaIon
f8b7286341
fix: delete RelayPanicRecover
2024-01-12 13:48:13 +08:00
CaIon
d9107379e9
fix: fix gemini panic
2024-01-07 21:27:28 +08:00
Xyfacai
825f59e162
optimize: MJ 部分调整、优化
...
MJ
增加simple-change、list接口,
变换和重试操作区别出来,价格与绘图一样
优化图片返回
2024-01-01 22:46:05 +08:00
CaIon
a7bac4f1fd
Merge branch 'main' into latest
2023-11-15 21:07:37 +08:00
CaIon
9d68527654
support tts
2023-11-15 21:05:14 +08:00
luxl-1379
227711b263
Update relay-router.go
2023-11-14 08:55:45 +08:00
CaIon
23d9554415
Merge remote-tracking branch 'origin/main'
...
# Conflicts:
# controller/log.go
# controller/relay-audio.go
# controller/relay-image.go
# controller/relay-text.go
# controller/relay.go
# middleware/distributor.go
# model/log.go
# web/src/components/OperationSetting.js
2023-09-17 20:59:12 +08:00
JustSong
437b35e161
fix: only enable cors for relay routers to avoid csrf attack
2023-09-17 11:44:38 +08:00
CaIon
59b4bc37ea
feat: 改为转发的方式获取midjourney图片
2023-09-12 03:46:05 +08:00
CaIon
c0636950c0
Merge remote-tracking branch 'origin/main'
...
# Conflicts:
# controller/relay.go
# main.go
# middleware/distributor.go
2023-09-09 03:15:55 +08:00
JustSong
1966eb712e
feat: supper whisper now ( close #197 )
2023-08-27 15:28:23 +08:00
CaIon
68b24da6a6
add epay
2023-08-14 22:16:32 +08:00
mrhaoji
292a3d8037
fix: relay router typo for List models ( #320 )
...
via: https://platform.openai.com/docs/api-reference/models/list
2023-07-24 22:28:16 +08:00
ckt
b1cb2602dc
feat: initial support of Dall-E ( #148 , #266 )
...
* feat: initial support of Dall-E
* fix: fix N not timed
---------
Co-authored-by: JustSong <songquanpeng@foxmail.com >
Co-authored-by: JustSong <39998050+songquanpeng@users.noreply.github.com >
2023-07-15 12:30:06 +08:00
玩牛牛
ab437eb663
feat: add support for /v1/engines/text-embedding-ada-002/embeddings ( #224 , close #222 )
2023-07-15 12:03:23 +08:00
JustSong
44a78a755f
feat: support /v1/edits now ( close #196 )
2023-06-25 11:46:23 +08:00
JustSong
e479f43c52
feat: support /v1/moderations now ( close #117 )
2023-06-11 09:37:36 +08:00
JustSong
33cb8e4b8c
feat: support /v1/completions ( close #115 )
2023-06-08 14:54:02 +08:00
JustSong
cbf339284c
feat: support group now ( close #17 , close #72 , close #85 , close #104 , close #136 )
...
Co-authored-by: quzard <1191890118@qq.com >
2023-06-07 23:26:00 +08:00
JustSong
a0923067dc
feat: API /models & /models/:model implemented ( close #68 )
2023-05-17 10:42:52 +08:00
JustSong
b358248529
feat: support /v1/embeddings now ( close #50 )
2023-05-11 21:00:09 +08:00
JustSong
ac2a56f9cd
feat: support API /dashboard/billing/credit_grants now ( #45 )
2023-05-10 09:28:41 +08:00
JustSong
bcdfb7d0d9
feat: now use token as the unit of quota ( close #33 )
2023-04-28 16:58:55 +08:00
JustSong
25ff9ebbe1
fix: remove rate limit for relay api
2023-04-26 21:50:09 +08:00
JustSong
e779c3a6a0
feat: able to relay dashboard api now
2023-04-25 22:18:27 +08:00