Seefs
2a15e3b152
feat: codex channel ( #2652 )
...
* feat: codex channel
* feat: codex channel
* feat: codex oauth flow
* feat: codex refresh cred
* feat: codex usage
* fix: codex err message detail
* fix: codex setting ui
* feat: codex refresh cred task
* fix: import err
* fix: codex store must be false
* fix: chat -> responses tool call
* fix: chat -> responses tool call
2026-01-14 22:29:43 +08:00
Seefs
71460cba15
feat: /v1/chat/completion -> /v1/response ( #2629 )
...
* feat: /v1/chat/completion -> /v1/response
2026-01-11 21:38:07 +08:00
John Chen
6a2da31946
fix: 修复智普、Moonshot渠道在stream=true时无法拿到cachePrompt的统计数据。
...
根本原因:
1. 在OaiStreamHandler流式处理函数中,调用applyUsagePostProcessing(info, usage, nil)时传入的responseBody为nil,导致无法从响应体中提取缓存tokens。
2. 两个渠道的cached_tokens位置不同:
- 智普:标准位置 usage.prompt_tokens_details.cached_tokens
- Moonshot:非标准位置 choices[].usage.cached_tokens
处理方案:
1. 传递body信息到applyUsagePostProcessing中
2. 拆分智普和Moonshot的解析,并为Moonshot单独写一个解析方法。
2025-12-30 17:38:32 +08:00
Seefs
6526976453
fix: glm 4.7 finish reason ( #2545 )
2025-12-29 19:41:15 +08:00
John Chen
6dbe89f1cf
为Moonshot添加缓存tokens读取逻辑
...
为Moonshot添加缓存tokens读取逻辑。其与智普V4的逻辑相同,所以共用逻辑
2025-12-22 17:05:16 +08:00
CaIon
3822f4577c
fix(audio): correct TotalTokens calculation for accurate usage reporting
2025-12-13 17:49:57 +08:00
CaIon
be2a863b9b
feat(audio): enhance audio request handling with token type detection and streaming support
2025-12-13 17:24:23 +08:00
Calcium-Ion
2a01d1c996
Merge pull request #2429 from QuantumNous/feat/xhigh
...
feat(adaptor): add '-xhigh' suffix to reasoning effort options
2025-12-12 22:06:19 +08:00
CaIon
27dd42718b
feat(adaptor): add '-xhigh' suffix to reasoning effort options for model parsing
2025-12-12 20:53:48 +08:00
Calcium-Ion
3c5edc54b7
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
c87deaa7d9
feat(token): add cross-group retry option for token processing
2025-12-12 17:59:21 +08:00
Seefs
cf243588fa
Merge pull request #2229 from HynoR/chore/v1
...
fix: Set default to unsupported value for gpt-5 model series requests
2025-12-08 20:59:30 +08:00
CaIon
1fededceb3
feat: refactor token estimation logic
...
- Introduced new OpenAI text models in `common/model.go`.
- Added `IsOpenAITextModel` function to check for OpenAI text models.
- Refactored token estimation methods across various channels to use estimated prompt tokens instead of direct prompt token counts.
- Updated related functions and structures to accommodate the new token estimation approach, enhancing overall token management.
2025-12-02 21:34:39 +08:00
CaIon
c8bbf7bed8
feat: Add ContextKeyLocalCountTokens and update ResponseText2Usage to use context in multiple channels
2025-11-21 18:17:01 +08:00
HynoR
601d257b80
fix: Set default to unsupported value for gpt-5 model series requests
2025-11-15 13:28:38 +08:00
CaIon
7827828abf
fix(adaptor): Add '-none' suffix to effortSuffixes for model parsing
2025-11-14 14:04:34 +08:00
Seefs
fd55ba7f2c
feat: ShouldPreserveThinkingSuffix ( #2189 )
2025-11-07 17:43:33 +08:00
IcedTangerine
961af95ec4
fix: openai 音频模型流模式未正确计费 ( #2160 )
2025-11-04 01:43:04 +08:00
CaIon
5d12755798
refactor(relay): enhance error logging and improve multipart form handling in audio requests #2127
2025-10-29 23:33:55 +08:00
CaIon
a00c6393c5
feat: implement audio duration retrieval without ffmpeg dependencies
2025-10-28 15:50:45 +08:00
feitianbubu
f617ff8741
feat: openai tts support streaming realtime audio
2025-10-22 13:33:01 +08:00
feitianbubu
a2d34b9e47
feat: add minimax api adaptor
2025-10-20 16:26:50 +08:00
Seefs
5010f2d004
format: package name -> github.com/QuantumNous/new-api ( #2017 )
2025-10-11 15:30:09 +08:00
RedwindA
efdb1c5b46
fix(openai): account cached tokens for
...
zhipu_v4 usage
2025-10-08 16:52:49 +08:00
RedwindA
78f34bd095
fix(openai): add nil checks for web_search streaming to prevent panic
2025-10-01 22:19:22 +08:00
CaIon
6f8edd49c4
fix: streamline error handling in OpenRouter response processing
2025-09-28 15:29:01 +08:00
CaIon
6682842cbb
feat: enhance OpenRouter enterprise support with new settings and response handling
2025-09-28 15:23:27 +08:00
creamlike1024
f6984272bf
fix: openai responses api 未统计图像生成调用计费
2025-09-16 12:47:59 +08:00
HynoR
23a82b9646
fix: enhance tool usage parsing with additional nil checks and error logging
2025-09-07 07:42:25 +08:00
HynoR
ab5351c270
fix: add error handling for missing built-in tools and validate response in stream handler
2025-09-05 13:58:24 +08:00
feitianbubu
69e76dae34
feat: use audio token usage if return
2025-09-02 10:58:10 +08:00
CaIon
906f797be5
refactor: replace json.Marshal with common.Marshal for consistency and error handling
2025-08-28 13:51:07 +08:00
CaIon
b0f86bd82e
fix: update PromptTokens assignment logic in relay_responses
2025-08-26 14:21:10 +08:00
CaIon
3e5bc637de
fix: Invalid type for 'input[x].summary': expected an array of objects, but got null instead
2025-08-26 13:17:31 +08:00
CaIon
f249cf9acc
fix: ensure reasoning is not nil before setting effort in OpenAI responses
2025-08-25 22:46:45 +08:00
CaIon
858585d974
fix: update response body handling in OpenAI relay format
2025-08-22 17:33:20 +08:00
Calcium-Ion
d09b99c1f0
Merge pull request #1606 from funnycups/patch-1
...
fix: prompt calculation
2025-08-22 17:30:53 +08:00
CaIon
3e61e6eb52
refactor: extract FlushWriter function for improved stream flushing
2025-08-17 15:30:31 +08:00
funnycups
2f176cff7f
fix: prompt calculation
...
User will correctly get estimated prompt usage when upstream returns either zero or nothing.
2025-08-16 22:54:00 +08:00
CaIon
4e3f008ae9
fix: update token usage calculation
2025-08-16 19:11:15 +08:00
wzxjohn
269bb0c896
feat(relay): add OpenAI gpt-4.1 o3 o4 gpt-image-1 models
2025-08-15 17:10:16 +08:00
CaIon
63e7fb697f
Merge remote-tracking branch 'origin/alpha' into alpha
2025-08-15 16:47:36 +08:00
Calcium-Ion
30e4679384
Merge pull request #1577 from nekohy/feats-better-adaptor-for-openrouter
...
Fix reasoning adaptor for openrouter
2025-08-15 16:19:24 +08:00
CaIon
8284cff9b7
refactor: set prompt tokens when not provided in usage
2025-08-15 15:55:01 +08:00
CaIon
5084a43aa9
refactor: ensure graceful closure of response body in relay responses
2025-08-15 15:10:54 +08:00
CaIon
c9e9a24e99
refactor: centralize logging and update resource initialization
...
This commit refactors the logging mechanism across the application by replacing direct logger calls with a centralized logging approach using the `common` package. Key changes include:
- Replaced instances of `logger.SysLog` and `logger.FatalLog` with `common.SysLog` and `common.FatalLog` for consistent logging practices.
- Updated resource initialization error handling to utilize the new logging structure, enhancing maintainability and readability.
- Minor adjustments to improve code clarity and organization throughout various modules.
This change aims to streamline logging and improve the overall architecture of the codebase.
2025-08-14 21:10:04 +08:00
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
ebb624148b
feats:the Openrouter Claude thinking
2025-08-12 22:39:32 +08:00
Nekohy
4a49a80d10
fix:Delete the excess ReasoningEffort from the Openrouter OpenAI thinking model.
2025-08-12 21:37:12 +08:00
CaIon
1382ec4f20
fix(adaptor): optimize multipart form handling and resource management
2025-08-12 19:57:56 +08:00