CaIon
e2037ad756
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
fdb6a3ce16
✨ 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
f0f277dc2a
🔧 refactor(auth, channel, context): improve context setup and validation for multi-key channels
2025-07-06 12:37:56 +08:00
Calcium-Ion
5ec421d8e6
Merge pull request #1321 from iszcz/main
...
支持Midjourney视频任务和图片编辑
2025-07-05 15:28:33 +08:00
iszcz
660180ea1b
支持Midjourney视频任务和图片编辑
2025-06-30 22:31:12 +08:00
CaIon
048a625181
🚀 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
2509f644bc
✨ feat(middleware): add HTTP statistics middleware
2025-06-10 19:29:32 +08:00
creamlike1024
738a9a4558
gemini text generation
2025-05-26 13:34:41 +08:00
creamlike1024
425feb88d8
feat: support /v1/responses API
2025-05-02 13:59:46 +08:00
xyfacai
f9f32a0158
feat: support /images/edit
...
(cherry picked from commit 1c0a1238787d490f02dd9269b616580a16604180)
2025-04-26 15:44:56 +08:00
1808837298@qq.com
bd48f43410
feat: claude relay
2025-03-12 21:31:46 +08:00
1808837298@qq.com
83a37e4653
feat: Add model request rate limiting functionality
2025-02-24 16:20:55 +08:00
CalciumIon
4c809277aa
feat: support br
2024-12-04 23:53:02 +08:00
CalciumIon
3089af6b08
feat: support gzip
2024-12-04 23:24:46 +08:00
1808837298@qq.com
e3c85572d4
Update dto
...
(cherry picked from commit 030187ff75c64c40017cda2fa98ef2b3c01f0bd5)
2024-11-05 19:23:56 +08:00
1808837298@qq.com
9a4ca1e210
feat: playground
2024-09-26 00:59:09 +08:00
kakingone
2100d8ee0c
addupload
2024-07-31 15:48:51 +08:00
CalciumIon
8af4e28f75
feat: support cohere rerank
2024-07-06 17:09:22 +08:00
Xiangyuan Liu
c993ab2746
feat: suno api 支持
...
feat: 调试 suno
feat: 补充suno 文档
2024-06-13 10:35:48 +08:00
Xiangyuan Liu
49df4b6eed
feat: 支持 /mj-{mode} 路径
2024-03-29 16:48:50 +08:00
CaIon
9b5353a81a
feat: support InsightFace ( close #60 )
2024-03-14 18:09:57 +08:00
CaIon
d704902b70
feat: 兼容自定义变焦,完善modal操作
2024-03-14 16:42:37 +08:00
CaIon
2ad591411e
feat: support shorten
2024-03-13 17:46:34 +08:00
CaIon
37c0c8ebdd
feat: 初步兼容midjourney-proxy-plus
2024-03-13 15:37:01 +08:00
1808837298@qq.com
5b18cd6b0a
feat: 初步重构
2024-02-29 01:08:18 +08:00
CaIon
075b1ac113
fix: delete RelayPanicRecover
2024-01-12 13:48:13 +08:00
CaIon
bba6174745
fix: fix gemini panic
2024-01-07 21:27:28 +08:00
Xyfacai
5c747dfee2
optimize: MJ 部分调整、优化
...
MJ
增加simple-change、list接口,
变换和重试操作区别出来,价格与绘图一样
优化图片返回
2024-01-01 22:46:05 +08:00
CaIon
c75a92f6a4
Merge branch 'main' into latest
2023-11-15 21:07:37 +08:00
CaIon
63cd3f05f2
support tts
2023-11-15 21:05:14 +08:00
luxl-1379
d0e2cd9f22
Update relay-router.go
2023-11-14 08:55:45 +08:00
CaIon
985e26fd1b
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
25c4c111ab
fix: only enable cors for relay routers to avoid csrf attack
2023-09-17 11:44:38 +08:00
CaIon
84645128c3
feat: 改为转发的方式获取midjourney图片
2023-09-12 03:46:05 +08:00
CaIon
9c08d78349
Merge remote-tracking branch 'origin/main'
...
# Conflicts:
# controller/relay.go
# main.go
# middleware/distributor.go
2023-09-09 03:15:55 +08:00
JustSong
d09d317459
feat: supper whisper now ( close #197 )
2023-08-27 15:28:23 +08:00
CaIon
8f2119e410
add epay
2023-08-14 22:16:32 +08:00
mrhaoji
dce8bbe1ca
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
b520b54625
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
玩牛牛
81c5901123
feat: add support for /v1/engines/text-embedding-ada-002/embeddings ( #224 , close #222 )
2023-07-15 12:03:23 +08:00
JustSong
9b178a28a3
feat: support /v1/edits now ( close #196 )
2023-06-25 11:46:23 +08:00
JustSong
4339f45f74
feat: support /v1/moderations now ( close #117 )
2023-06-11 09:37:36 +08:00
JustSong
4b6adaec0b
feat: support /v1/completions ( close #115 )
2023-06-08 14:54:02 +08:00
JustSong
2ad22e1425
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
efc744ca35
feat: API /models & /models/:model implemented ( close #68 )
2023-05-17 10:42:52 +08:00
JustSong
6e1ef75009
feat: support /v1/embeddings now ( close #50 )
2023-05-11 21:00:09 +08:00
JustSong
3071300c0c
feat: support API /dashboard/billing/credit_grants now ( #45 )
2023-05-10 09:28:41 +08:00
JustSong
053bb85a1c
feat: now use token as the unit of quota ( close #33 )
2023-04-28 16:58:55 +08:00
JustSong
fd149c242f
fix: remove rate limit for relay api
2023-04-26 21:50:09 +08:00
JustSong
05dd7dfd2a
feat: able to relay dashboard api now
2023-04-25 22:18:27 +08:00