Commit Graph

4887 Commits

Author SHA1 Message Date
Seefs
b10f1f7b85 feat: ionet integrate (#2105)
* wip ionet integrate

* wip ionet integrate

* wip ionet integrate

* ollama wip

* wip

* feat: ionet integration & ollama manage

* fix merge conflict

* wip

* fix: test conn cors

* wip

* fix ionet

* fix ionet

* wip

* fix model select

* refactor: Remove `pkg/ionet` test files and update related Go source and web UI model deployment components.

* feat: Enhance model deployment UI with styling improvements, updated text, and a new description component.

* Revert "feat: Enhance model deployment UI with styling improvements, updated text, and a new description component."

This reverts commit 8b75cb5bf0d1a534b339df8c033be9a6c7df7964.
2025-12-28 15:55:35 +08:00
Seefs
984ae32667 Merge pull request #2536 from RedwindA/feat/oaiDevRole2Gemini 2025-12-28 15:52:45 +08:00
RedwindA
518563c7eb feat: map OpenAI developer role to Gemini system instructions 2025-12-27 02:52:33 +08:00
skynono
7379b68f9f feat: support first bind update password (#2520) 2025-12-26 13:59:56 +08:00
Seefs
2570788b46 fix: Fix Openrouter test errors and optimize error messages (#2433)
* fix: Refine openrouter error

* fix: Refine openrouter error

* fix: openrouter test max_output_token

* fix: optimize messages

* fix: maxToken unified to 16

* fix: codex系列模型使用 responses接口

* fix: codex系列模型使用 responses接口

* fix: 状态码非200打印错误信息

* fix: 日志里没有报错的响应体
2025-12-26 13:58:44 +08:00
Calcium-Ion
15b38adf98 Merge pull request #2460 from seefs001/feature/gemini-flash-minial
fix(gemini): handle minimal reasoning effort budget
2025-12-26 13:57:56 +08:00
Seefs
8e4b8cc68c Merge pull request #2455 from comeback01/french-translation 2025-12-26 13:56:30 +08:00
Calcium-Ion
89e5edd407 Merge pull request #2450 from seefs001/fix/gemini-system-prompt
fix: 支持传入system_instruction和systemInstruction两种风格系统提示词参数名
2025-12-26 13:54:21 +08:00
Calcium-Ion
343497ad84 Merge pull request #2512 from seefs001/fix/warning-pass-through-body
fix: add warning for pass through body
2025-12-26 13:52:51 +08:00
Calcium-Ion
7126c3c125 Merge pull request #2513 from seefs001/fix/token-auth-bearer
fix: 支持小写bearer和Bearer后带多个空格 && 修复 WSS预扣费错误提取key的问题
2025-12-26 13:51:32 +08:00
Seefs
9a65b8646b Merge pull request #2528 from QuantumNous/fix/model-sync-overwrite-empty-missing 2025-12-26 13:49:55 +08:00
Seefs
c137a6b04e Merge pull request #2530 from RedwindA/fix/i18n-with-http 2025-12-26 13:49:30 +08:00
RedwindA
4a8bdb1483 fix(i18n): disable namespace separator to fix URL display in translations
i18next uses ':' as namespace separator by default, causing URLs like
'https://api.openai.com' to be incorrectly parsed as namespace 'https'
with key '//api.openai.com', resulting in truncated display.

Setting nsSeparator to false fixes this issue since the project doesn't
use multiple namespaces.
2025-12-26 00:10:19 +08:00
t0ng7u
f45e707d8e 🚀 fix(model-sync): avoid unnecessary upstream fetch while keeping overwrite updates working
- Only short-circuit when there are no missing models AND no overwrite fields requested
- Preserve overwrite behavior even when the missing-model list is empty
- Always return empty arrays (not null) for list fields to keep API responses stable
- Clarify SyncUpstreamModels behavior in comments (create missing models + optional overwrite updates)
2025-12-25 23:01:09 +08:00
Calcium-Ion
225cb9ef86 Merge pull request #2154 from feitianbubu/pr/fix-model-sync
fix: ensure overwrite works correctly when no missing models
2025-12-25 22:34:49 +08:00
Calcium-Ion
90b70f472b Merge pull request #2475 from seefs001/feature/pyro
feat: pyroscope integrate
2025-12-25 17:54:39 +08:00
Seefs
b10aed74b2 Merge branch 'upstream-main' into feature/pyro 2025-12-25 17:08:02 +08:00
CaIon
ceb7ebe5cd feat(user): simplify user response structure in JSON output 2025-12-25 15:39:58 +08:00
Calcium-Ion
c7125480ac Merge pull request #2524 from seefs001/fix/revert-model-ratio
fix: revert model ratio
2025-12-25 15:38:36 +08:00
Seefs
0edef97413 fix: revert model ratio 2025-12-25 15:37:54 +08:00
Calcium-Ion
3955d61b3e Merge pull request #2477 from 1420970597/fix/anthropic-cache-billing
fix: 修复 Anthropic 渠道缓存计费错误
2025-12-24 16:59:23 +08:00
Seefs
07cb6e9626 Merge pull request #2493 from shikaiwei1/patch-1 2025-12-24 16:52:24 +08:00
Seefs
be047a7053 Merge pull request #2511 from JerryKwan/issue2499 2025-12-24 16:51:51 +08:00
Seefs
7e1ad4bdff fix: 支持小写bearer和Bearer后带多个空格 && 修复 WSS预扣费错误提取key的问题 2025-12-24 15:52:56 +08:00
Seefs
783e7877c2 fix: add warning for pass through body 2025-12-24 15:35:36 +08:00
Jerry
2504e9ad04 Resolving event mismatch in OpenAI2Claude
add stricter validation for content_block_start corresponding to
tool call
and fix the crash issue when Claude Code is processing tool call
2025-12-24 14:52:39 +08:00
Calcium-Ion
8ee5c23b48 Merge pull request #2510 from feitianbubu/pr/0e7050dc89c1b761069f5e528d8ecf786e7008ae
修复claudeResponse流式请求空指针Panic
2025-12-24 14:15:51 +08:00
feitianbubu
1dc7ab9a97 fix: check claudeResponse delta StopReason nil point 2025-12-24 11:54:23 +08:00
CaIon
d488a19ed7 feat(token): enhance error handling in ValidateUserToken for better clarity 2025-12-22 18:01:38 +08:00
John Chen
6dbe89f1cf 为Moonshot添加缓存tokens读取逻辑
为Moonshot添加缓存tokens读取逻辑。其与智普V4的逻辑相同,所以共用逻辑
2025-12-22 17:05:16 +08:00
Calcium-Ion
4bcdb1ec07 Merge pull request #2486 from QuantumNous/docs/readme-update-doc-links-new-routing
🔗 docs(readme): update documentation links to new site routing
2025-12-21 21:28:35 +08:00
t0ng7u
1f6527e91a 🔗 docs(readme): revert missing docs links to legacy site
Keep new-site links (/{lang}/docs/...) where matching pages exist in the current docs repo
Revert links that have no equivalent in the new docs to the legacy paths on doc.newapi.pro:
Google Gemini Chat
Midjourney-Proxy image docs
Suno music docs
Apply the same rule consistently across all README translations (zh/en/ja/fr)
2025-12-21 21:18:59 +08:00
t0ng7u
93b3cfc0f7 🔗 docs(readme): update documentation links to new site routing
- Replace legacy `docs.newapi.pro` paths with the new `/{lang}/docs/...` structure across all README translations
- Point key sections (installation, env vars, API, support, features) to their new locations
- Ensure language-specific links use the correct locale prefix (zh/en/ja) and keep FR aligned with English routes
2025-12-21 21:00:33 +08:00
Calcium-Ion
7af80ff043 Merge pull request #2483 from seefs001/fix/vertex-function-response-id
fix: 模型设置增加针对Vertex渠道过滤content[].part[].functionResponse.id的选项,默认启用
2025-12-21 17:24:07 +08:00
Seefs
45649249b2 fix: 在Vertex Adapter过滤content[].part[].functionResponse.id 2025-12-21 17:22:04 +08:00
Seefs
219b13af70 fix: 模型设置增加针对Vertex渠道过滤content[].part[].functionResponse.id的选项,默认启用 2025-12-21 17:09:49 +08:00
comeback01
b9d78515f8 Merge branch 'main' into french-translation 2025-12-20 11:08:07 +01:00
长安
6e3bc06fa6 fix: 修复 Anthropic 渠道缓存计费错误
## 问题描述

当使用 Anthropic 渠道通过 `/v1/chat/completions` 端点调用且启用缓存功能时,
计费逻辑错误地减去了缓存 tokens,导致严重的收入损失(94.5%)。

## 根本原因

不同 API 的 `prompt_tokens` 定义不同:

- **Anthropic API**: `input_tokens` 字段已经是纯输入 tokens(不包含缓存)
- **OpenAI API**: `prompt_tokens` 字段包含所有 tokens(包含缓存)
- **OpenRouter API**: `prompt_tokens` 字段包含所有 tokens(包含缓存)

当前 `postConsumeQuota` 函数对所有渠道都减去缓存 tokens,这对 Anthropic
渠道是错误的,因为其 `input_tokens` 已经不包含缓存。

## 修复方案

在 `relay/compatible_handler.go` 的 `postConsumeQuota` 函数中,添加渠道类型判断:

```go
if relayInfo.ChannelType != constant.ChannelTypeAnthropic {
    baseTokens = baseTokens.Sub(dCacheTokens)
}
```

只对非 Anthropic 渠道减去缓存 tokens。

## 影响分析

###  不受影响的场景

1. **无缓存调用**(所有渠道)
   - cache_tokens = 0
   - 减去 0 = 不减去
   - 结果:完全一致

2. **OpenAI/OpenRouter 渠道 + 缓存**
   - 继续减去缓存(因为 ChannelType != Anthropic)
   - 结果:完全一致

3. **Anthropic 渠道 + /v1/messages 端点**
   - 使用 PostClaudeConsumeQuota(不修改)
   - 结果:完全不受影响

###  修复的场景

4. **Anthropic 渠道 + /v1/chat/completions + 缓存**
   - 修复前:错误地减去缓存,导致 94.5% 收入损失
   - 修复后:不减去缓存,计费正确

## 验证数据

以实际记录 143509 为例:

| 项目 | 修复前 | 修复后 | 差异 |
|------|--------|--------|------|
| Quota | 10,489 | 191,330 | +180,841 |
| 费用 | ¥0.020978 | ¥0.382660 | +¥0.361682 |
| 收入恢复 | - | - | **+1724.1%** |

## 测试建议

1. 测试 Anthropic 渠道 + 缓存场景
2. 测试 OpenAI 渠道 + 缓存场景(确保不受影响)
3. 测试无缓存场景(确保不受影响)

## 相关 Issue

修复 Anthropic 渠道使用 prompt caching 时的计费错误。
2025-12-20 14:17:12 +08:00
CaIon
c2a6193497 feat(gin): improve request body handling and error reporting 2025-12-20 13:34:10 +08:00
CaIon
3523acfc2c feat(init): increase MaxRequestBodyMB to enhance request handling 2025-12-20 13:27:55 +08:00
CaIon
f2d2b6e7fc feat(channel): add error handling for SaveWithoutKey when channel ID is 0 2025-12-20 13:26:40 +08:00
Seefs
7a9cfa38ff Merge pull request #2476 from TinsFox/chore/code-inspector-plugin 2025-12-20 11:04:40 +08:00
Seefs
a78fd2dae6 docs: document pyroscope env var 2025-12-19 23:16:56 +08:00
TinsFox
c06a216a14 chore: add code-inspector-plugin integration 2025-12-19 23:04:53 +08:00
Seefs
fb0ffe8c95 docs: document pyroscope env var 2025-12-19 23:03:04 +08:00
Seefs
b49bb48ed1 fix: systemname 2025-12-19 22:27:35 +08:00
Seefs
6d0cb5df75 Merge pull request #2474 from TinsFox/main 2025-12-19 21:39:56 +08:00
TinsFox
530b3eff11 style: add card spacing 2025-12-19 21:00:31 +08:00
Seefs
39df47486c fix(gemini): handle minimal reasoning effort budget
- Add minimal case to clampThinkingBudgetByEffort to avoid defaulting to full thinking budget
2025-12-18 08:10:46 +08:00
comeback01
5aaf006642 Refine French translations for UI conciseness
Updated web/src/i18n/locales/fr.json to improve French translations for the user interface.

Removed verbose prefixes like 'Gestion des...' and 'Paramètres de...' to prevent truncation in sidebars and menus.

Harmonized terms for consistency (e.g., 'Tâches', 'Journaux', 'Dessins').

Renamed 'Place du marché' to 'Marché des modèles'.
2025-12-17 12:10:36 +01:00