Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
653 commits
Select commit Hold shift + click to select a range
936b1f8
🐛 fix: group-ratio display & deduplicate price logic in model-pricing…
t0ng7u Aug 12, 2025
0082b87
Merge remote-tracking branch 'origin/alpha' into alpha
t0ng7u Aug 12, 2025
63b9457
🔍 fix(pricing): synchronize search term with sidebar filters & reset …
t0ng7u Aug 12, 2025
196e2a0
🐛 fix: Always update `searchValue` during IME composition to enable C…
t0ng7u Aug 12, 2025
3b26810
fix(adaptor): missing first text delta while convert OpenAI to Claude
wzxjohn Aug 13, 2025
01cd279
feat: use proxy HTTP client fetch models
feitianbubu Aug 13, 2025
223f0d0
🐛 fix(tokens): correct main Chat button navigation to prevent 404
t0ng7u Aug 13, 2025
d75e198
fix: prevent OpenRouter cache calculation with custommodel ratios
yyhhyyyyyy Aug 14, 2025
e2037ad
refactor: Introduce pre-consume quota and unify relay handlers
Calcium-Ion Aug 14, 2025
baf086d
Add files via upload
fatcat-ww Aug 14, 2025
6748b00
refactor: centralize logging and update resource initialization
Calcium-Ion Aug 14, 2025
89caccd
refactor: enhance quota handling and logging for pre-consume operations
Calcium-Ion Aug 14, 2025
7f1f368
refactor: improve channel base URL handling and enhance RelayInfo log…
Calcium-Ion Aug 14, 2025
44e9b02
refactor: enhance error handling and masking for model not found scen…
Calcium-Ion Aug 15, 2025
03fc89d
refactor: add email masking function and enhance RelayInfo logging
Calcium-Ion Aug 15, 2025
5fe1ce8
refactor: improve request type validation and enhance sensitive infor…
Calcium-Ion Aug 15, 2025
2f25e44
refactor: update token type handling and improve token counting logic
Calcium-Ion Aug 15, 2025
edeb479
Merge branch 'alpha' into refactor_relay
Calcium-Ion Aug 15, 2025
067be37
refactor: simplify domain masking logic by removing URL check
Calcium-Ion Aug 15, 2025
cc4f73d
refactor: enhance logging messages for user quota handling in pre-con…
Calcium-Ion Aug 15, 2025
1d4850e
refactor: improve logging for channel operations with detailed context
Calcium-Ion Aug 15, 2025
50dafea
Merge pull request #1594 from QuantumNous/refactor_relay
Calcium-Ion Aug 15, 2025
5671503
Merge pull request #1593 from fatcat-ww/main
t0ng7u Aug 15, 2025
1cb6306
refactor: replace json.Marshal and json.Unmarshal with common.Marshal…
Calcium-Ion Aug 15, 2025
039b00d
Merge remote-tracking branch 'origin/alpha' into fix/openrouter-custo…
yyhhyyyyyy Aug 15, 2025
5a2dad2
Merge pull request #1590 from yyhhyyyyyy/fix/openrouter-custom-ratio-…
Calcium-Ion Aug 15, 2025
726f163
refactor: ensure graceful closure of response body in relay responses
Calcium-Ion Aug 15, 2025
8b2afce
fix panic
Calcium-Ion Aug 15, 2025
d646a92
refactor: set prompt tokens when not provided in usage
Calcium-Ion Aug 15, 2025
2579b3c
refactor: move anthropicKey retrieval to improve authorization handling
Calcium-Ion Aug 15, 2025
ef1e380
Merge pull request #1577 from nekohy/feats-better-adaptor-for-openrouter
Calcium-Ion Aug 15, 2025
eeb4215
Merge remote-tracking branch 'origin/alpha' into alpha
Calcium-Ion Aug 15, 2025
b57e97d
feat: 优化ac自动机
Calcium-Ion Aug 15, 2025
68b7bad
feat(relay): add OpenAI gpt-4.1 o3 o4 gpt-image-1 models
wzxjohn Aug 15, 2025
0edc707
feat(ratio): add ratio for OpenAI models
wzxjohn Aug 15, 2025
0bb43aa
refactor: update function signatures to include context and improve f…
Calcium-Ion Aug 15, 2025
491013e
refactor: comment out SetContextKey to prevent token count meta setting
Calcium-Ion Aug 15, 2025
28bd31a
feat: initialize channel metadata in relay processing
Calcium-Ion Aug 15, 2025
c63b6b3
feat: add checks for non-empty URLs in file metadata processing
Calcium-Ion Aug 15, 2025
f6a4843
feat: initialize channel metadata in mjproxy and relay processing
Calcium-Ion Aug 15, 2025
f70cac5
feat: implement concurrent top-up locking mechanism to prevent race c…
Calcium-Ion Aug 15, 2025
dd497d5
feats: the flexable params override and compatible format
nekohy Aug 16, 2025
b591b4e
fix:moveValue bug
nekohy Aug 16, 2025
5829bc6
Merge pull request #1597 from wzxjohn/feature/add_openai_models
Calcium-Ion Aug 16, 2025
0ad918c
Merge pull request #1584 from feitianbubu/pr/use-proxy-fetch-models
Calcium-Ion Aug 16, 2025
64a752a
Merge remote-tracking branch 'origin/alpha' into alpha
Calcium-Ion Aug 16, 2025
73a7b33
Merge pull request #1603 from nekohy/feats-the-flexable-params-override
Calcium-Ion Aug 16, 2025
5654d08
feat: set API version for Azure and Vertex AI channel types
Calcium-Ion Aug 16, 2025
5d6fac6
feat: implement file type detection from URL with enhanced MIME type …
Calcium-Ion Aug 16, 2025
732e5d2
fix: correct argument passing in DoDownloadRequest for MIME type retr…
Calcium-Ion Aug 16, 2025
f8ca8d7
fix: refactor processChannelError to use goroutine for asynchronous h…
Calcium-Ion Aug 16, 2025
cbce487
feats:use the types of gjson,the error expection,the invert of the co…
nekohy Aug 16, 2025
11a7ac9
feats:custom the key missing condition
nekohy Aug 16, 2025
5696a62
feats:the error of gjson.True and gjson.False
nekohy Aug 16, 2025
9b09133
feat: add support for Midjourney relay mode based on path prefix
Calcium-Ion Aug 16, 2025
206ed55
Merge pull request #1605 from nekohy/feats-the-flexable-params-override
Calcium-Ion Aug 16, 2025
2d28fb3
💄 refactor(settings): redesign 2FA settings UI with unified Semi UI c…
t0ng7u Aug 16, 2025
aa1f5c6
Merge remote-tracking branch 'origin/alpha' into alpha
t0ng7u Aug 16, 2025
c834694
fix: update token usage calculation
Calcium-Ion Aug 16, 2025
9934cdc
🌐 feat(i18n): add internationalization support for TwoFASetting compo…
t0ng7u Aug 16, 2025
a1cab15
Merge remote-tracking branch 'origin/alpha' into alpha
t0ng7u Aug 16, 2025
e3473e3
fix: prompt calculation
funnycups Aug 16, 2025
9805d35
♻️ refactor(personal-settings): Break down PersonalSetting.js into mo…
t0ng7u Aug 16, 2025
b67a42e
⚡️ perf: Defer Visactor chart libs to dashboard; minimize home bundle
t0ng7u Aug 16, 2025
3749be3
💳 feat(TopUp): unify payment cards, add header stats, brand icons, an…
t0ng7u Aug 16, 2025
a6ad49d
Revert "⚡️ perf: Defer Visactor chart libs to dashboard; minimize hom…
t0ng7u Aug 17, 2025
c123ea3
✨ style(Account UX): resilient binding layout, copyable popovers, pas…
t0ng7u Aug 17, 2025
49ab1a3
fix: remove unnecessary option from error handling in image request c…
Calcium-Ion Aug 17, 2025
998305f
fix: improve error handling for image edit form request parsing
Calcium-Ion Aug 17, 2025
c18414c
refactor: extract FlushWriter function for improved stream flushing
Calcium-Ion Aug 17, 2025
11a81c2
🎨 refactor: Setup Wizard UI & Clean Up Redundant Code
t0ng7u Aug 17, 2025
d34e4f1
Merge remote-tracking branch 'origin/alpha' into alpha
t0ng7u Aug 17, 2025
2be4489
✨ feat: unify skeleton loading behavior for Midjourney logs actions
t0ng7u Aug 17, 2025
94d9607
♻️ refactor: HeaderBar into modular, maintainable components & polish…
t0ng7u Aug 17, 2025
85f81df
fix: remove redundant reasoning assignment in ChatCompletionsStreamRe…
Calcium-Ion Aug 17, 2025
0a053ee
feat: 完善gemini格式转换
Calcium-Ion Aug 17, 2025
795cfd4
🎨 refactor: UserInfoHeader layout and styling
t0ng7u Aug 17, 2025
a0e6a72
Merge remote-tracking branch 'origin/alpha' into alpha
t0ng7u Aug 17, 2025
1074f8a
🎛️ refactor: HeaderBar into modular components, add shared skeletons,…
t0ng7u Aug 17, 2025
da802ec
🤔style(ui): remove `large` size in auth components
t0ng7u Aug 17, 2025
cfc6bc8
✨ feat(ui): add hover scale animation to header logo
t0ng7u Aug 17, 2025
adc7fbd
♻️ refactor(web): migrate React modules from .js to .jsx and align en…
t0ng7u Aug 17, 2025
f6d4c58
fix: add nil check for Writer in FlushWriter function
Calcium-Ion Aug 18, 2025
652d71d
feats:Standardize ClaudeHandler, add zhipu_4v Anthropic native support
nekohy Aug 18, 2025
974b93a
feat: imagen for vertex channel
Sh1n3zZ Aug 18, 2025
57f1015
🍎 style(ui): remove `transparent' style in model-pricing search input
t0ng7u Aug 18, 2025
e02e1e8
fix: Guard against negative or zero n from ExtraBody to prevent uint …
creamlike1024 Aug 18, 2025
03a257b
Merge branch 'Sh1n3zZ-alpha' into alpha
creamlike1024 Aug 18, 2025
6c94573
♻️ refactor(InvitationCard): restructure cards with title prop and cl…
t0ng7u Aug 18, 2025
13aee98
Merge remote-tracking branch 'origin/alpha' into alpha
t0ng7u Aug 18, 2025
003246f
🤝 docs: add Alibaba Cloud as trusted partner
t0ng7u Aug 18, 2025
ba50b6f
🍭 style(ui): update the `README.md` style
t0ng7u Aug 18, 2025
c3481f5
🤝 docs: add IO.NET as trusted partner
t0ng7u Aug 18, 2025
cb53ade
🍭 style(ui): update the `README.md` style
t0ng7u Aug 18, 2025
2b862f6
🔧 fix: adjust IO.NET logo viewBox for proper display size
t0ng7u Aug 18, 2025
518763c
🍭 style(ui): update the `README.md` style
t0ng7u Aug 18, 2025
0837747
🍭 style(ui): update the `README.md` style
t0ng7u Aug 18, 2025
3133e91
🤝 docs(README): Enhancing Partner Layout
t0ng7u Aug 21, 2025
b5040e0
fix: channel type nil point
feitianbubu Aug 22, 2025
ad151bb
Merge pull request #1606 from funnycups/patch-1
Calcium-Ion Aug 22, 2025
e581422
fix: update response body handling in OpenAI relay format
Calcium-Ion Aug 22, 2025
d47190f
🧹 refactor(settings): remove models API usage from Personal Settings
t0ng7u Aug 22, 2025
60dc032
✨ refactor: unify layout, adopt Semi UI Forms, dynamic presets, and f…
t0ng7u Aug 22, 2025
8b7384e
♻️ refactor(home): build serverAddress using `${window.location.origin}`
t0ng7u Aug 22, 2025
bd166b2
🚀 perf(vite): remove visactor manual chunk to avoid preloading on Home
t0ng7u Aug 22, 2025
08add53
💄 style(ui): enhance table scroll card scrollbar visibility and appea…
t0ng7u Aug 22, 2025
61ae19a
🌓 feat(ui): add auto theme mode, refactor ThemeToggle, optimize heade…
t0ng7u Aug 22, 2025
def4d16
🎨 refactor(ui): harden iframe messaging
t0ng7u Aug 22, 2025
43c6bbb
📱 fix(ui/topup): make stats numbers responsive on mobile
t0ng7u Aug 22, 2025
005e965
🐛 fix(header): prevent NotificationButton from shrinking when unread …
t0ng7u Aug 22, 2025
4f23e53
feat: 修复重试后请求结构混乱,修复rerank端点无法使用
Calcium-Ion Aug 23, 2025
fc18a3c
fix: improve request handling by deep copying OpenAIResponsesRequest
Calcium-Ion Aug 23, 2025
2c6a924
refactor: rename relay-text.go to compatible_handler.go for clarity
Calcium-Ion Aug 23, 2025
94536be
fix: enhance error handling for invalid request types in relay handlers
Calcium-Ion Aug 23, 2025
4226746
Merge pull request #1642 from QuantumNous/fix-retry-and-rerank
Calcium-Ion Aug 23, 2025
754498a
Merge pull request #1635 from feitianbubu/pr/fix-task-info-channel-type
Calcium-Ion Aug 23, 2025
e3a38d2
Merge pull request #1611 from nekohy/feats-zhipu_4v-anthropic
Calcium-Ion Aug 23, 2025
df1ec48
Merge branch 'alpha' into main
Calcium-Ion Aug 23, 2025
93ce48a
feat: restructure token usage routes and enhance token retrieval logic
Calcium-Ion Aug 23, 2025
4200edb
Merge pull request #1161 from lollipopkit/main
Calcium-Ion Aug 23, 2025
8a329f6
🎨 refactor(ui): use lucide-react for search/refresh and chevron icons
t0ng7u Aug 23, 2025
5d7ab19
Merge remote-tracking branch 'origin/alpha' into alpha
t0ng7u Aug 23, 2025
f246c12
🎨 refactor(model-pricing/header): unify header design, extract Search…
t0ng7u Aug 23, 2025
a50288c
🤓 style: add `outline` theme in pricingcard copy button
t0ng7u Aug 23, 2025
97c52a6
🐛 fix(model-pricing/header): pass sidebarProps to PricingFilterModal …
t0ng7u Aug 23, 2025
7969df3
🤖 style: Make some changes
t0ng7u Aug 23, 2025
d7c2a9f
✨ feat(model-pricing): enhance pricing vendor intro components with p…
t0ng7u Aug 23, 2025
abcb353
feats:add custom headers override
nekohy Aug 23, 2025
53f7a79
fix: log name
nekohy Aug 23, 2025
524f6d6
Merge pull request #1644 from nekohy/feats-custom-request-headers
Calcium-Ion Aug 24, 2025
eedb57b
📱 feat(header): add mobile filter skeleton; align mobile tag layout
t0ng7u Aug 24, 2025
1e36218
Merge remote-tracking branch 'origin/alpha' into alpha
t0ng7u Aug 24, 2025
cb6fa7d
Update channel.go
aotsukiqx Aug 24, 2025
6dcf954
🕒 feat(ui): standardize Timelines to left mode and unify time display
t0ng7u Aug 24, 2025
808f5c4
💄 style(topup): align container width with PersonalSetting (w-full ma…
t0ng7u Aug 24, 2025
7fbf9c4
feat: enhance image request handling and add async support
Calcium-Ion Aug 24, 2025
da516af
feat: 在新增&编辑渠道时添加点击模型复制名称功能
AAEE86 Aug 23, 2025
de23ccd
feat: update ali image response handling
Calcium-Ion Aug 24, 2025
f96a733
Merge pull request #1647 from aotsukiqx/main
Calcium-Ion Aug 25, 2025
ee6dd91
feat: adapt Volcengine adaptor for deepseek3.1 model with thinking s…
HynoR Aug 25, 2025
caaa988
fix: correct logic for handling nil OpenAI error codes. (close #1609)
Calcium-Ion Aug 25, 2025
43efc21
feat: add SaveWithoutKey method to Channel and update status saving l…
Calcium-Ion Aug 25, 2025
af18dec
🤓 feat: When adding or editing channels, add the function of clicking…
t0ng7u Aug 25, 2025
70de381
🧹 chore: remove useless i18n file
t0ng7u Aug 25, 2025
b27b9a1
🍎 chore(EditChannelModal.jsx): Format code file
t0ng7u Aug 25, 2025
bef5992
fix: update model ratio handling for GPT versions
Calcium-Ion Aug 25, 2025
522f2d9
Merge remote-tracking branch 'origin/alpha' into alpha
Calcium-Ion Aug 25, 2025
c9f5b1d
fix: improve model ratio handling for reserved models in getHardcoded…
Calcium-Ion Aug 25, 2025
595ed6b
Merge remote-tracking branch 'origin/feat/dalle-extra' into alpha
Calcium-Ion Aug 25, 2025
d374a22
feat: support qwen-image-edit
Calcium-Ion Aug 25, 2025
dc4f575
feat(channel): 添加2FA验证后查看渠道密钥功能
AAEE86 Aug 25, 2025
b1cc905
fix: 添加接口速率限制中间件,优化验证码输入框交互体验
AAEE86 Aug 25, 2025
98db907
Merge pull request #1549 from QuantumNous/update-openai-websearch-price
creamlike1024 Aug 25, 2025
289ed24
task_relay_info
iszcz Aug 25, 2025
a3c2b28
fix: ensure reasoning is not nil before setting effort in OpenAI resp…
Calcium-Ion Aug 25, 2025
e23f01f
fix: Invalid type for 'input[x].summary': expected an array of object…
Calcium-Ion Aug 26, 2025
1cc0754
feat: replace pcopy with jinzhu/copier for deep copy functionality
Calcium-Ion Aug 26, 2025
eef73e3
fix: update PromptTokens assignment logic in relay_responses
Calcium-Ion Aug 26, 2025
33d601d
fix: update error types for upstream errors and JSON marshal failure
Calcium-Ion Aug 26, 2025
e087c9f
fix: update web search handling and request structure in adaptor and …
Calcium-Ion Aug 26, 2025
3e01dc8
Merge pull request #1652 from HynoR/feat/ds3.1
Calcium-Ion Aug 26, 2025
a95d70c
Merge pull request #1579 from wzxjohn/hotfix/openai_claude_convert
Calcium-Ion Aug 26, 2025
6a6edaa
Merge remote-tracking branch 'origin/alpha' into alpha
Calcium-Ion Aug 26, 2025
64a6168
fix(model_ratio): update return value logic for gemini-2.5-flash-lite
Calcium-Ion Aug 26, 2025
fcb0339
Merge branch 'alpha' of github.com:AAEE86/new-api into AAEE86-alpha
creamlike1024 Aug 26, 2025
95b487c
feat: add disable cache middleware
creamlike1024 Aug 26, 2025
33dd326
Merge branch 'AAEE86-alpha' into alpha
creamlike1024 Aug 26, 2025
4524f90
🐛 fix(playground): set Chat error text color to white to match Semi UI
t0ng7u Aug 27, 2025
65ed6d9
✨ feat(playground): add search functionality to group selector
t0ng7u Aug 27, 2025
034094c
Merge remote-tracking branch 'origin/alpha' into alpha
t0ng7u Aug 27, 2025
7ddf3a1
fix(relay-gemini): update media handling in candidate content processing
Calcium-Ion Aug 27, 2025
7629ad5
fix: prevent loop auto-migrate with bool default false
feitianbubu Aug 27, 2025
3521860
fix(image): add error handling for empty base64 string in image decoding
Calcium-Ion Aug 27, 2025
c5a1cbe
fix(token_counter): update token counting logic to handle media token…
Calcium-Ion Aug 27, 2025
e732c58
feat: gemini-2.5-flash-image-preview 文本和图片输出计费
creamlike1024 Aug 27, 2025
edc6679
Merge branch 'alpha' of github.com:iszcz/new-api into iszcz-alpha
creamlike1024 Aug 27, 2025
4b968d0
fix(relay): initialize TaskRelayInfo
creamlike1024 Aug 27, 2025
e69520b
Merge branch 'iszcz-alpha' into alpha
creamlike1024 Aug 27, 2025
621d2b0
refactor: replace json.Marshal with common.Marshal for consistency an…
Calcium-Ion Aug 28, 2025
b0c7039
fix(pre_consume_quota): improve error messages for insufficient user …
Calcium-Ion Aug 28, 2025
872f7a9
refactor: replace DeepCopy with Copy for request handling consistency
Calcium-Ion Aug 28, 2025
b3a99a2
Revert "refactor: replace DeepCopy with Copy for request handling con…
Calcium-Ion Aug 28, 2025
4055777
fix: update model name filtering to be case-sensitive
HynoR Aug 28, 2025
839aa40
fix: 修复openai error 错误被覆盖
xyfacai Aug 28, 2025
8cd0150
fix(channel): ensure thread-safe polling with channel-specific lock
Calcium-Ion Aug 28, 2025
fbe7f35
feat(token_counter): add mime type extraction for base64 encoded data
Calcium-Ion Aug 28, 2025
64e23f0
feat: add kling video new params support
feitianbubu Jul 14, 2025
919e693
🎨 feat: Implement responsive design for SelectableButtonGroup component
t0ng7u Aug 29, 2025
5f0db18
📱 feat(pricing-header): show only search/copy/filter on mobile; hide …
t0ng7u Aug 29, 2025
0f86c4d
⚡ chore: Increase default page size from 10 to 100 items in model pri…
t0ng7u Aug 29, 2025
af94e11
修改claude system参数为数组格式,提升API兼容性
yunayj Aug 29, 2025
c05dc07
Merge pull request #1564 from feitianbubu/pr/init-default-vendor
creamlike1024 Aug 29, 2025
86964bb
🎨 feat(ui): enhance pricing components with improved icons and respon…
t0ng7u Aug 29, 2025
ac67d50
Merge remote-tracking branch 'origin/alpha' into alpha
t0ng7u Aug 29, 2025
09cc127
Merge branch 'pr/kling-new-params' of github.com:feitianbubu/new-api …
creamlike1024 Aug 29, 2025
f5b8abc
Merge branch 'feitianbubu-pr/kling-new-params' into alpha
creamlike1024 Aug 29, 2025
9c798dc
Merge branch 'pr/fix-kling-text2image' of github.com:feitianbubu/new-…
creamlike1024 Aug 29, 2025
bc5b9a5
Merge branch 'feitianbubu-pr/fix-kling-text2image' into alpha
creamlike1024 Aug 29, 2025
b8b66c3
✨ feat(pricing): add default vendor icons with LobeHub color support
t0ng7u Aug 29, 2025
105b86c
🤓 chore: remove the useless tooltip component
t0ng7u Aug 29, 2025
6a87808
🎨 chore(web): apply ESLint and Prettier auto-fixes (baseline)
t0ng7u Aug 30, 2025
8809c44
顶栏和侧边栏管理
x-Ai Aug 30, 2025
9127449
🐛 fix(db): rename composite unique indexes to avoid drop/recreate on …
t0ng7u Aug 31, 2025
cdef6da
🎨 style(go): format entire codebase
t0ng7u Aug 31, 2025
153994f
Merge branch 'alpha' of github.com:x-Ai/new-api into x-Ai-alpha
creamlike1024 Aug 31, 2025
274da13
fix: add OptionMap RLock to GetStatus()
creamlike1024 Aug 31, 2025
3a3be21
fix(user): UpdateSelf 边栏权限检查和类型检查
creamlike1024 Aug 31, 2025
c8acbdb
fix: update sidebar modules role check
creamlike1024 Aug 31, 2025
c6f53e4
fix: revert 3a3be21
creamlike1024 Aug 31, 2025
5cfc133
Merge pull request #1672 from feitianbubu/pr/fix-mysql-default-false
creamlike1024 Aug 31, 2025
247e029
feat: bark notification #1699
seefs001 Sep 1, 2025
e174861
feat: add channel remark #1710
seefs001 Sep 1, 2025
5351c28
Merge pull request #1713 from seefs001/feature/channel_remark
seefs001 Sep 1, 2025
e98ca00
Merge pull request #1712 from seefs001/feature/bark
seefs001 Sep 1, 2025
b601d8f
Merge pull request #1680 from HynoR/fix/res
seefs001 Sep 1, 2025
1f111a1
✨ feat(ratio-sync, ui): add built‑in “Official Ratio Preset” and hard…
t0ng7u Sep 1, 2025
fbc19ab
✨ feat(models-sync): official upstream sync with conflict resolution …
t0ng7u Sep 1, 2025
a47a37d
🧹 refactor(db): remove legacy models/vendors index cleanup logic
t0ng7u Sep 1, 2025
5ac9ebd
✨ feat: Add skeleton loading states for sidebar navigation
t0ng7u Sep 1, 2025
1442666
🌏 i18n: replace to correct punctuation mark
t0ng7u Sep 1, 2025
860ab51
🐛 fix(web/layout): explicitly import headerbar/index.jsx to resolve L…
t0ng7u Sep 1, 2025
daffba3
🤖 fix(web/layout): rename HeaderBar -> headerbar (case sensitive)
t0ng7u Sep 1, 2025
5cbd9da
fix(web/layout): normalize HeaderBar -> headerbar (case)
t0ng7u Sep 1, 2025
f7ae362
feat: use audio token usage if return
feitianbubu Sep 2, 2025
1702449
Merge branch 'feitianbubu-pr/opt-audio-usage' into alpha
creamlike1024 Sep 2, 2025
203abf4
openai v1/models 完全兼容 解决接入trae时候的字段校验
Aug 19, 2025
d9f37d1
🎨 fix: sidebar skeleton background and icon spacing consistency
t0ng7u Sep 2, 2025
aeab080
Merge branch 'alpha' into base
seefs001 Sep 2, 2025
265a9ea
Merge pull request #1724 from momomobinx/base
seefs001 Sep 2, 2025
faad6bc
fix: adjust column spans in JSONEditor for better layout #1719
seefs001 Sep 2, 2025
cd4b75f
Merge pull request #1733 from seefs001/fix/jsoneditor
seefs001 Sep 2, 2025
8c65264
✨ feat(sync): multi-language sync wizard, backend locale support, and…
t0ng7u Sep 2, 2025
29983e4
Merge remote-tracking branch 'origin/alpha' into alpha
t0ng7u Sep 2, 2025
fa7ba4a
🐛 fix(models sync): send correct overwrite payload and drop fallback
t0ng7u Sep 2, 2025
ebaaecb
🐛 fix(models-sync): allow sync when no conflicts selected
t0ng7u Sep 2, 2025
56fc344
feat(monitor_setting): implement automatic channel testing configuration
Calcium-Ion Sep 3, 2025
c6cf1b9
feat(option): enhance UpdateOption to handle various value types and …
Calcium-Ion Sep 3, 2025
e2f736b
feat(readme): update format conversion feature details in README
Calcium-Ion Sep 3, 2025
91a627d
fix(channel): implement per-channel locking to ensure thread-safe upd…
Calcium-Ion Sep 3, 2025
e61c1dc
fix: allow the negative number for override.go
nekohy Sep 4, 2025
3d0bf36
Merge pull request #1749 from nekohy/feats-negative-number
seefs001 Sep 4, 2025
c0187d5
fix: add error handling for missing built-in tools and validate respo…
HynoR Sep 5, 2025
e5a5d2d
🐛 fix(models): export setActivePage to prevent tab-change TypeError
t0ng7u Sep 6, 2025
a77a883
fix: enhance tool usage parsing with additional nil checks and error …
HynoR Sep 6, 2025
d05974f
Merge pull request #1754 from HynoR/fix/dtresp
seefs001 Sep 7, 2025
b7527eb
Merge pull request #1677 from QuantumNous/gemini-2.5-flash-image-prev…
seefs001 Sep 7, 2025
b29efbd
feat(relay-claude): mapping stop reason and send text delta on block …
creamlike1024 Sep 7, 2025
1c12c73
Merge pull request #1761 from QuantumNous/openaitoclaude-improve
creamlike1024 Sep 7, 2025
a616aa3
Merge pull request #1692 from yunayj/alpha
Calcium-Ion Sep 8, 2025
028f022
Merge branch 'alpha'
Calcium-Ion Sep 9, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 2 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
.vscode
.gitignore
Makefile
docs
docs
.eslintcache
4 changes: 1 addition & 3 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
# 所有请求超时时间,单位秒,默认为0,表示不限制
# RELAY_TIMEOUT=0
# 流模式无响应超时时间,单位秒,如果出现空补全可以尝试改为更大值
# STREAMING_TIMEOUT=120
# STREAMING_TIMEOUT=300

# Gemini 识别图片 最大图片数量
# GEMINI_VISION_MAX_IMAGE_NUM=16
Expand All @@ -56,8 +56,6 @@
# SESSION_SECRET=random_string

# 其他配置
# 渠道测试频率(单位:秒)
# CHANNEL_TEST_FREQUENCY=10
# 生成默认token
# GENERATE_DEFAULT_TOKEN=false
# Cohere 安全设置
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ web/dist
.env
one-api
.DS_Store
tiktoken_cache
tiktoken_cache
.eslintcache
304 changes: 103 additions & 201 deletions LICENSE

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ New API提供了丰富的功能,详细特性请参考[特性说明](https://do
1. OpenAI Chat Completions => Claude Messages
2. Clade Messages => OpenAI Chat Completions (可用于Claude Code调用第三方模型)
3. OpenAI Chat Completions => Gemini Chat
20. 💰 缓存计费支持,开启后可以在缓存命中时按照设定的比例计费:
19. 💰 缓存计费支持,开启后可以在缓存命中时按照设定的比例计费:
1. 在 `系统设置-运营设置` 中设置 `提示缓存倍率` 选项
2. 在渠道中设置 `提示缓存倍率`,范围 0-1,例如设置为 0.5 表示缓存命中时按照 50% 计费
3. 支持的渠道:
Expand Down
2 changes: 2 additions & 0 deletions common/api_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ func ChannelType2APIType(channelType int) (int, bool) {
apiType = constant.APITypeCoze
case constant.ChannelTypeJimeng:
apiType = constant.APITypeJimeng
case constant.ChannelTypeMoonshot:
apiType = constant.APITypeMoonshot
}
if apiType == -1 {
return constant.APITypeOpenAI, false
Expand Down
1 change: 1 addition & 0 deletions common/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ var GitHubClientId = ""
var GitHubClientSecret = ""
var LinuxDOClientId = ""
var LinuxDOClientSecret = ""
var LinuxDOMinimumTrustLevel = 0

var WeChatServerAddress = ""
var WeChatServerToken = ""
Expand Down
19 changes: 19 additions & 0 deletions common/copy.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package common

import (
"fmt"

"github.com/jinzhu/copier"
)

func DeepCopy[T any](src *T) (*T, error) {
if src == nil {
return nil, fmt.Errorf("copy source cannot be nil")
}
var dst T
err := copier.CopyWithOption(&dst, src, copier.Option{DeepCopy: true, IgnoreEmpty: true})
if err != nil {
return nil, err
}
return &dst, nil
}
5 changes: 5 additions & 0 deletions common/custom-event.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"io"
"net/http"
"strings"
"sync"
)

type stringWriter interface {
Expand Down Expand Up @@ -52,6 +53,8 @@ type CustomEvent struct {
Id string
Retry uint
Data interface{}

Mutex sync.Mutex
}

func encode(writer io.Writer, event CustomEvent) error {
Expand All @@ -73,6 +76,8 @@ func (r CustomEvent) Render(w http.ResponseWriter) error {
}

func (r CustomEvent) WriteContentType(w http.ResponseWriter) {
r.Mutex.Lock()
defer r.Mutex.Unlock()
header := w.Header()
header["Content-Type"] = contentType

Expand Down
2 changes: 1 addition & 1 deletion common/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ var LogSqlType = DatabaseTypeSQLite // Default to SQLite for logging SQL queries
var UsingMySQL = false
var UsingClickHouse = false

var SQLitePath = "one-api.db?_busy_timeout=5000"
var SQLitePath = "one-api.db?_busy_timeout=30000"
32 changes: 32 additions & 0 deletions common/endpoint_defaults.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package common

import "one-api/constant"

// EndpointInfo 描述单个端点的默认请求信息
// path: 上游路径
// method: HTTP 请求方式,例如 POST/GET
// 目前均为 POST,后续可扩展
//
// json 标签用于直接序列化到 API 输出
// 例如:{"path":"/v1/chat/completions","method":"POST"}

type EndpointInfo struct {
Path string `json:"path"`
Method string `json:"method"`
}

// defaultEndpointInfoMap 保存内置端点的默认 Path 与 Method
var defaultEndpointInfoMap = map[constant.EndpointType]EndpointInfo{
constant.EndpointTypeOpenAI: {Path: "/v1/chat/completions", Method: "POST"},
constant.EndpointTypeOpenAIResponse: {Path: "/v1/responses", Method: "POST"},
constant.EndpointTypeAnthropic: {Path: "/v1/messages", Method: "POST"},
constant.EndpointTypeGemini: {Path: "/v1beta/models/{model}:generateContent", Method: "POST"},
constant.EndpointTypeJinaRerank: {Path: "/rerank", Method: "POST"},
constant.EndpointTypeImageGeneration: {Path: "/v1/images/generations", Method: "POST"},
}

// GetDefaultEndpointInfo 返回指定端点类型的默认信息以及是否存在
func GetDefaultEndpointInfo(et constant.EndpointType) (EndpointInfo, bool) {
info, ok := defaultEndpointInfoMap[et]
return info, ok
}
6 changes: 5 additions & 1 deletion common/gin.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ package common

import (
"bytes"
"github.com/gin-gonic/gin"
"io"
"net/http"
"one-api/constant"
"strings"
"time"

"github.com/gin-gonic/gin"
)

const KeyRequestBody = "key_request_body"
Expand All @@ -31,6 +32,9 @@ func UnmarshalBodyReusable(c *gin.Context, v any) error {
if err != nil {
return err
}
//if DebugEnabled {
// println("UnmarshalBodyReusable request body:", string(requestBody))
//}
contentType := c.Request.Header.Get("Content-Type")
if strings.HasPrefix(contentType, "application/json") {
err = Unmarshal(requestBody, &v)
Expand Down
2 changes: 1 addition & 1 deletion common/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func InitEnv() {
}

func initConstantEnv() {
constant.StreamingTimeout = GetEnvOrDefault("STREAMING_TIMEOUT", 120)
constant.StreamingTimeout = GetEnvOrDefault("STREAMING_TIMEOUT", 300)
constant.DifyDebug = GetEnvOrDefaultBool("DIFY_DEBUG", true)
constant.MaxFileDownloadMB = GetEnvOrDefault("MAX_FILE_DOWNLOAD_MB", 20)
// ForceStreamOption 覆盖请求参数,强制返回usage信息
Expand Down
22 changes: 22 additions & 0 deletions common/json.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,25 @@ func DecodeJson(reader *bytes.Reader, v any) error {
func Marshal(v any) ([]byte, error) {
return json.Marshal(v)
}

func GetJsonType(data json.RawMessage) string {
data = bytes.TrimSpace(data)
if len(data) == 0 {
return "unknown"
}
firstChar := bytes.TrimSpace(data)[0]
switch firstChar {
case '{':
return "object"
case '[':
return "array"
case '"':
return "string"
case 't', 'f':
return "boolean"
case 'n':
return "null"
default:
return "number"
}
}
2 changes: 1 addition & 1 deletion common/page_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func (p *PageInfo) SetItems(items any) {
func GetPageQuery(c *gin.Context) *PageInfo {
pageInfo := &PageInfo{}
// 手动获取并处理每个参数
if page, err := strconv.Atoi(c.Query("page")); err == nil {
if page, err := strconv.Atoi(c.Query("p")); err == nil {
pageInfo.Page = page
}
if pageSize, err := strconv.Atoi(c.Query("page_size")); err == nil {
Expand Down
5 changes: 5 additions & 0 deletions common/quota.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package common

func GetTrustQuota() int {
return int(10 * QuotaPerUnit)
}
140 changes: 140 additions & 0 deletions common/str.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ import (
"encoding/base64"
"encoding/json"
"math/rand"
"net/url"
"regexp"
"strconv"
"strings"
"unsafe"
)

Expand Down Expand Up @@ -95,3 +98,140 @@ func GetJsonString(data any) string {
b, _ := json.Marshal(data)
return string(b)
}

// MaskEmail masks a user email to prevent PII leakage in logs
// Returns "***masked***" if email is empty, otherwise shows only the domain part
func MaskEmail(email string) string {
if email == "" {
return "***masked***"
}

// Find the @ symbol
atIndex := strings.Index(email, "@")
if atIndex == -1 {
// No @ symbol found, return masked
return "***masked***"
}

// Return only the domain part with @ symbol
return "***@" + email[atIndex+1:]
}

// maskHostTail returns the tail parts of a domain/host that should be preserved.
// It keeps 2 parts for likely country-code TLDs (e.g., co.uk, com.cn), otherwise keeps only the TLD.
func maskHostTail(parts []string) []string {
if len(parts) < 2 {
return parts
}
lastPart := parts[len(parts)-1]
secondLastPart := parts[len(parts)-2]
if len(lastPart) == 2 && len(secondLastPart) <= 3 {
// Likely country code TLD like co.uk, com.cn
return []string{secondLastPart, lastPart}
}
return []string{lastPart}
}

// maskHostForURL collapses subdomains and keeps only masked prefix + preserved tail.
// Example: api.openai.com -> ***.com, sub.domain.co.uk -> ***.co.uk
func maskHostForURL(host string) string {
parts := strings.Split(host, ".")
if len(parts) < 2 {
return "***"
}
tail := maskHostTail(parts)
return "***." + strings.Join(tail, ".")
}

// maskHostForPlainDomain masks a plain domain and reflects subdomain depth with multiple ***.
// Example: openai.com -> ***.com, api.openai.com -> ***.***.com, sub.domain.co.uk -> ***.***.co.uk
func maskHostForPlainDomain(domain string) string {
parts := strings.Split(domain, ".")
if len(parts) < 2 {
return domain
}
tail := maskHostTail(parts)
numStars := len(parts) - len(tail)
if numStars < 1 {
numStars = 1
}
stars := strings.TrimSuffix(strings.Repeat("***.", numStars), ".")
return stars + "." + strings.Join(tail, ".")
}

// MaskSensitiveInfo masks sensitive information like URLs, IPs, and domain names in a string
// Example:
// http://example.com -> http://***.com
// https://api.test.org/v1/users/123?key=secret -> https://***.org/***/***/?key=***
// https://sub.domain.co.uk/path/to/resource -> https://***.co.uk/***/***
// 192.168.1.1 -> ***.***.***.***
// openai.com -> ***.com
// www.openai.com -> ***.***.com
// api.openai.com -> ***.***.com
func MaskSensitiveInfo(str string) string {
// Mask URLs
urlPattern := regexp.MustCompile(`(http|https)://[^\s/$.?#].[^\s]*`)
str = urlPattern.ReplaceAllStringFunc(str, func(urlStr string) string {
u, err := url.Parse(urlStr)
if err != nil {
return urlStr
}

host := u.Host
if host == "" {
return urlStr
}

// Mask host with unified logic
maskedHost := maskHostForURL(host)

result := u.Scheme + "://" + maskedHost

// Mask path
if u.Path != "" && u.Path != "/" {
pathParts := strings.Split(strings.Trim(u.Path, "/"), "/")
maskedPathParts := make([]string, len(pathParts))
for i := range pathParts {
if pathParts[i] != "" {
maskedPathParts[i] = "***"
}
}
if len(maskedPathParts) > 0 {
result += "/" + strings.Join(maskedPathParts, "/")
}
} else if u.Path == "/" {
result += "/"
}

// Mask query parameters
if u.RawQuery != "" {
values, err := url.ParseQuery(u.RawQuery)
if err != nil {
// If can't parse query, just mask the whole query string
result += "?***"
} else {
maskedParams := make([]string, 0, len(values))
for key := range values {
maskedParams = append(maskedParams, key+"=***")
}
if len(maskedParams) > 0 {
result += "?" + strings.Join(maskedParams, "&")
}
}
}

return result
})

// Mask domain names without protocol (like openai.com, www.openai.com)
domainPattern := regexp.MustCompile(`\b(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}\b`)
str = domainPattern.ReplaceAllStringFunc(str, func(domain string) string {
return maskHostForPlainDomain(domain)
})

// Mask IP addresses
ipPattern := regexp.MustCompile(`\b(?:\d{1,3}\.){3}\d{1,3}\b`)
str = ipPattern.ReplaceAllString(str, "***.***.***.***")

return str
}
24 changes: 24 additions & 0 deletions common/sys_log.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package common

import (
"fmt"
"github.com/gin-gonic/gin"
"os"
"time"
)

func SysLog(s string) {
t := time.Now()
_, _ = fmt.Fprintf(gin.DefaultWriter, "[SYS] %v | %s \n", t.Format("2006/01/02 - 15:04:05"), s)
}

func SysError(s string) {
t := time.Now()
_, _ = fmt.Fprintf(gin.DefaultErrorWriter, "[SYS] %v | %s \n", t.Format("2006/01/02 - 15:04:05"), s)
}

func FatalLog(v ...any) {
t := time.Now()
_, _ = fmt.Fprintf(gin.DefaultErrorWriter, "[FATAL] %v | %v \n", t.Format("2006/01/02 - 15:04:05"), v)
os.Exit(1)
}
Loading
Loading