Commit Graph

59 Commits

Author SHA1 Message Date
Seefs
d9321b7da3 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
Seefs
9a7fa9d139 feat: customizable automatic retry status codes 2026-01-14 14:34:12 +08:00
Seefs
ac04c802a7 Merge pull request #2647 from seefs001/feature/status-code-auto-disable
feat: status code auto-disable configuration
2026-01-12 18:47:45 +08:00
CaIon
d340112ce2 feat(checkin): add check-in functionality with status retrieval and user quota rewards 2026-01-02 23:00:33 +08:00
Seefs
25de94e292 fix: test channel frequency (#2119) 2025-10-28 23:23:24 +08:00
CaIon
d43751f262 feat: support free model setting 2025-10-12 13:31:03 +08:00
Seefs
5010f2d004 format: package name -> github.com/QuantumNous/new-api (#2017) 2025-10-11 15:30:09 +08:00
Seefs
b65e271971 Merge branch 'main-upstream' into pr/custom-currency-1923
# Conflicts:
#	web/src/components/settings/personal/cards/AccountManagement.jsx
#	web/src/components/table/channels/modals/EditChannelModal.jsx
#	web/src/hooks/channels/useChannelsData.jsx
#	web/src/hooks/common/useSidebar.js
#	web/src/i18n/locales/fr.json
#	web/src/pages/Setting/Operation/SettingsGeneral.jsx
2025-10-02 20:30:48 +08:00
creamlike1024
eeef719f3a feat: 支持 gemini-robotics-er-1.5-preview 2025-10-01 17:33:54 +08:00
t0ng7u
8294a76bc2 💱 feat(settings): introduce site-wide quota display type (USD/CNY/TOKENS/CUSTOM)
Replace the legacy boolean “DisplayInCurrencyEnabled” with an injected, type-safe
configuration `general_setting.quota_display_type`, and wire it through the
backend and frontend.

Backend
- Add `QuotaDisplayType` to `operation_setting.GeneralSetting` with injected
  registration via `config.GlobalConfig.Register("general_setting", ...)`.
  Helpers: `IsCurrencyDisplay()`, `IsCNYDisplay()`, `GetQuotaDisplayType()`.
- Expose `quota_display_type` in `/api/status` and keep legacy
  `display_in_currency` for backward compatibility.
- Logger: update `LogQuota` and `FormatQuota` to support USD/CNY/TOKENS. When
  CNY is selected, convert using `operation_setting.USDExchangeRate`.
- Controllers:
  - `billing`: compute subscription/usage amounts based on the selected type
    (USD: divide by `QuotaPerUnit`; CNY: USD→CNY; TOKENS: keep raw tokens).
  - `topup` / `topup_stripe`: treat inputs as “amount” for USD/CNY and as
    token-count for TOKENS; adjust min topup and pay money accordingly.
  - `misc`: include `quota_display_type` in status payload.
- Compatibility: in `model/option.UpdateOption`, map updates to
  `DisplayInCurrencyEnabled` → `general_setting.quota_display_type`
  (true→USD, false→TOKENS). Keep exporting the legacy key in `OptionMap`.

Frontend
- Settings: replace the “display in currency” switch with a Select
  (`general_setting.quota_display_type`) offering USD / CNY / Tokens.
  Provide fallback mapping from legacy `DisplayInCurrencyEnabled`.
- Persist `quota_display_type` to localStorage (keep `display_in_currency`
  for legacy components).
- Rendering helpers: base all quota/price rendering on `quota_display_type`;
  use `usd_exchange_rate` for CNY symbol/values.
- Pricing page: default view currency follows site display type (USD/CNY),
  while TOKENS mode still allows per-view currency toggling when needed.

Notes
- No database migrations required.
- Legacy clients remain functional via compatibility fields.
2025-09-29 23:23:31 +08:00
creamlike1024
f6984272bf fix: openai responses api 未统计图像生成调用计费 2025-09-16 12:47:59 +08:00
CaIon
1a8d781721 Revert "feat: gemini-2.5-flash-image-preview 文本和图片输出计费"
This reverts commit a45513a7a6.
2025-09-13 12:53:28 +08:00
CaIon
c47d9fb5b5 feat(payment): add payment settings configuration and update payment methods handling 2025-09-12 19:29:34 +08:00
Seefs
80cfa0d0df Merge pull request #1677 from QuantumNous/gemini-2.5-flash-image-preview-billing
feat: gemini-2.5-flash-image-preview 文本和图片输出计费
2025-09-07 14:15:24 +08:00
CaIon
1bbabda081 feat(monitor_setting): implement automatic channel testing configuration 2025-09-03 14:00:52 +08:00
creamlike1024
a45513a7a6 feat: gemini-2.5-flash-image-preview 文本和图片输出计费 2025-08-27 21:30:52 +08:00
creamlike1024
f8c2c78ee2 feat: update openai websearch price 2025-08-10 13:37:49 +08:00
Seefs
3b34afa8c9 Revert "feat: add Claude Code channel support with OAuth integration" 2025-07-31 22:08:16 +08:00
Seefs
a4afa3a11f chore: claude code automatic disable 2025-07-26 18:40:18 +08:00
creamlike1024
e7f5d02147 refactor: simplify WebSearchPrice const 2025-07-22 13:22:47 +08:00
ZhangYichi
df57ca83ed fix: 根据OpenAI最新的计费规则,更新其Web Search Tools价格 2025-07-20 18:25:43 +08:00
creamlike1024
e351642db9 feat: claude web search tool 计费 2025-07-15 18:57:22 +08:00
RedwindA
50907a5758 Merge remote-tracking branch 'upstream/alpha' into update-gemini-ratio 2025-06-19 20:02:27 +08:00
Apple\Apple
175ea56fdd 🚚 Refactor(ratio_setting): refactor ratio management into standalone ratio_setting package
Summary
• Migrated all ratio-related sources into `setting/ratio_setting/`
  – `model_ratio.go` (renamed from model-ratio.go)
  – `cache_ratio.go`
  – `group_ratio.go`
• Changed package name to `ratio_setting` and relocated initialization (`ratio_setting.InitRatioSettings()` in main).
• Updated every import & call site:
  – Model / cache / completion / image ratio helpers
  – Group ratio helpers (`GetGroupRatio*`, `ContainsGroupRatio`, `CheckGroupRatio`, etc.)
  – JSON-serialization & update helpers (`*Ratio2JSONString`, `Update*RatioByJSONString`)
• Adjusted controllers, middleware, relay helpers, services and models to reference the new package.
• Removed obsolete `setting` / `operation_setting` imports; added missing `ratio_setting` imports.
• Adopted idiomatic map iteration (`for key := range m`) where value is unused.
• Ran static checks to ensure clean build.

This commit centralises all ratio configuration (model, cache and group) in one cohesive module, simplifying future maintenance and improving code clarity.
2025-06-18 18:00:49 +08:00
RedwindA
33e46cabb6 feat(gemini): add pricing for Gemini 2.5 Flash Lite preview audio input 2025-06-18 03:38:58 +08:00
RedwindA
9bc9d40891 feat(gemini): update audio input pricing and adjust model handling logic 2025-06-18 03:25:59 +08:00
RedwindA
49592897d5 feat(ratio): add new Gemini model ratios and enhance flash model handling 2025-06-18 01:09:09 +08:00
RedwindA
9209355f7d refactor: replace inline closure with a helper function 2025-06-16 19:41:42 +08:00
RedwindA
1e1a6aae55 feat: implement thinking budget control in model name 2025-06-15 23:20:41 +08:00
creamlike1024
0e9a193ed8 feat: gemini audio input billing 2025-06-07 12:26:23 +08:00
CaIon
3cc1a79449 feat: add new model entries for Claude Sonnet 4 and Claude Opus 4 across multiple components, including constants and cache settings 2025-05-23 15:20:16 +08:00
CaIon
4978d63f46 feat: add new model ratios for Claude Sonnet 4 and Claude Opus 4; update ratio retrieval logic for improved handling of model names 2025-05-23 02:02:21 +08:00
creamlike1024
8cebbde4a0 chore: move file search tool price to operation_setting 2025-05-06 23:57:22 +08:00
creamlike1024
1db30c55af chore: move web search tool price to operation_setting 2025-05-06 23:25:16 +08:00
CaIon
8b9ba91184 fix: update audio ratio logic for model names in GetAudioRatio function 2025-04-28 20:55:40 +08:00
CaIon
5bf1f2f275 refactor: rename InitModelSettings to InitRatioSettings 2025-04-26 17:15:34 +08:00
CaIon
e24d9bd8db fix: update cacheRatioMap initialization in InitModelSettings function 2025-04-26 17:09:23 +08:00
CaIon
f4dcf8d6b6 feat: initialize cacheRatioMap in InitModelSettings function 2025-04-26 17:06:03 +08:00
xyfacai
873ebcf0c7 feat: support /images/edit
(cherry picked from commit 1c0a1238787d490f02dd9269b616580a16604180)
2025-04-26 15:44:56 +08:00
CaIon
d378543819 feat: add gemini thinking suffix support #981 2025-04-18 19:36:18 +08:00
CaIon
e3b262da1d feat: 添加流模式下的SSE保活机制 #945 2025-04-14 19:40:23 +08:00
HynoR
4622c17c83 feat: add xai channel
feat: add xai channel

feat: add xai channel
2025-04-10 13:04:43 +08:00
CaIon
32db85607e fix: Update model ratios for gemini-2.5-pro 2025-04-10 00:09:11 +08:00
CaIon
9dc851d6ef feat: Initialize model settings and improve concurrency control in operation settings 2025-04-07 22:20:47 +08:00
CaIon
69d790b47a Update model-ratio.go 2025-04-04 23:43:14 +08:00
CaIon
1e95160293 Update model-ratio.go 2025-04-04 23:41:41 +08:00
CaIon
ad7a64e585 Update model-ratio.go 2025-04-04 00:31:24 +08:00
1808837298@qq.com
638950c230 feat: Add new cache ratios for o3-mini and gpt-4.5-preview models 2025-03-27 18:47:50 +08:00
1808837298@qq.com
3b047b18fd update model ratio 2025-03-27 17:02:09 +08:00
1808837298@qq.com
a696cf5832 feat: Enhance GetCompletionRatio function 2025-03-27 16:38:29 +08:00