mirror of
https://github.com/QuantumNous/new-api.git
synced 2026-12-05 08:03:01 +00:00
feat(relay): explicit @ model modifiers and canonical billing identity
Model-name post-processing is rebuilt around an explicit trailing
@key:value modifier syntax (thinking/effort/temperature/topp) that
overrides request fields, survives model mapping, and records
conversion diagnostics on the consume log.
- Legacy naked aliases (-thinking, -nothinking, -thinking-<budget>,
effort tails) now parse only for positively matched families
(gpt-*/o-series, claude-*, gemini-*, incl. vendor/ namespaces);
names like qwen-max stay opaque. EffortTailModelIDs remains the
escape hatch for real in-family IDs such as gpt-5.1-codex-max.
- Billing identity resolves once in ModelPriceHelper via a ladder:
configured request name first (legacy wildcard entries intact), then
canonical billing names rebuilt from parsed intent
(base@effort:E@thinking:S, then base@thinking:S; order, duplicates,
and budget values are irrelevant; temperature/topp never priced),
then base. Routing and token limits fall back through
RoutingMatchModelName; pricing lookups stay wildcard-only.
- Pass-through stays byte-identical: modifiers and aliases are neither
parsed nor validated there and forward verbatim for the upstream
(or a chained gateway) to interpret.
- Unknown modifier keys and invalid known-key values are rejected with
400; models whose real names contain @tag:value are exempted via the
thinking-suffix blacklist, which now supports re:-prefixed Go regex
entries.
- Claude reasoning render coerces unsupported combinations (disable,
adaptive, budgets) with warning diagnostics instead of erroring;
native-protocol requests without host syntax pass through untouched.
BREAKING(openrouter): drop the host-invented "-thinking" model-name
alias (added in 4f6d16e36) that trimmed any *-thinking model on
OpenRouter channels and injected reasoning.enabled. It matched too
broadly and mangled real model IDs such as kimi-k2-thinking.
Migration: use some-model@thinking:on, or keep the old public name via
a channel model mapping {"some-model-thinking": "some-model@thinking:on"}.
Claude/Gemini family aliases (incl. anthropic/claude-*-thinking) keep
working via the family whitelist.
This commit is contained in:
46 files changed
+2575
-547
No files matched your search
@@ -259,7 +259,7 @@ func testChannel(ctx context.Context, channel *model.Channel, testUserID int, te
|
||||
newAPIError: types.NewError(err, types.ErrorCodeChannelModelMappedError),
|
||||
}
|
||||
}
|
||||
if err = helper.ApplyReasoningModelSuffix(info, request); err != nil {
|
||||
if err := helper.ApplyReasoningModelSuffix(c, info, request); err != nil {
|
||||
return testResult{
|
||||
context: c,
|
||||
localErr: err,
|
||||
|
||||
+1
-1
@@ -251,7 +251,7 @@ func ListModels(c *gin.Context, modelType int) {
|
||||
models := service.GetGroupsEnabledModels(ownerGroups)
|
||||
for _, modelName := range models {
|
||||
if modelLimitEnable {
|
||||
matchingName := ratio_setting.FormatMatchingModelName(modelName)
|
||||
matchingName := ratio_setting.RoutingMatchModelName(modelName)
|
||||
if !tokenModelLimit[modelName] && !tokenModelLimit[matchingName] {
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -92,8 +92,7 @@ func Distribute() func(c *gin.Context) {
|
||||
if !ok {
|
||||
tokenModelLimit = map[string]bool{}
|
||||
}
|
||||
matchName := ratio_setting.FormatMatchingModelName(modelRequest.Model) // match gpts & thinking-*
|
||||
if _, ok := tokenModelLimit[matchName]; !ok {
|
||||
if !tokenModelLimitAllows(tokenModelLimit, modelRequest.Model) {
|
||||
abortWithOpenAiMessage(c, http.StatusForbidden, i18n.T(c, i18n.MsgDistributorTokenModelForbidden, map[string]any{"Model": modelRequest.Model}))
|
||||
return
|
||||
}
|
||||
@@ -570,6 +569,19 @@ func getModelRequest(c *gin.Context) (*ModelRequest, bool, error) {
|
||||
return &modelRequest, shouldSelectChannel, nil
|
||||
}
|
||||
|
||||
// tokenModelLimitAllows reports whether a token model-limit map authorizes
|
||||
// model. Exact name, wildcard-normalized name, and routing-normalized name
|
||||
// (modifiers and legacy aliases stripped) are all accepted.
|
||||
func tokenModelLimitAllows(limit map[string]bool, model string) bool {
|
||||
if limit[model] {
|
||||
return true
|
||||
}
|
||||
if formatted := ratio_setting.FormatMatchingModelName(model); limit[formatted] {
|
||||
return true
|
||||
}
|
||||
return limit[ratio_setting.RoutingMatchModelName(model)]
|
||||
}
|
||||
|
||||
// 修复 #4834: GET /v1/video/generations/:task_id && /v1/video/:task_id 此前不解析 model,
|
||||
// 当 token 启用「可用模型限制」时,下游 modelLimitEnable 校验会因
|
||||
// modelRequest.Model 为空而误报 "This token has no access to model"。
|
||||
|
||||
@@ -11,6 +11,7 @@ import (
|
||||
"github.com/QuantumNous/new-api/model"
|
||||
"github.com/QuantumNous/new-api/pkg/jsplugin"
|
||||
"github.com/QuantumNous/new-api/relaykit/dto"
|
||||
"github.com/QuantumNous/new-api/setting/model_setting"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
@@ -151,6 +152,32 @@ export const protocols = {openai_responses: {
|
||||
`, key, key, channelType)
|
||||
}
|
||||
|
||||
func TestTokenModelLimitAllowsLegacyAliasAndModifierVariant(t *testing.T) {
|
||||
aliasOnly := map[string]bool{"claude-3-7-sonnet-thinking": true}
|
||||
assert.True(t, tokenModelLimitAllows(aliasOnly, "claude-3-7-sonnet-thinking"))
|
||||
assert.False(t, tokenModelLimitAllows(aliasOnly, "claude-3-7-sonnet"))
|
||||
|
||||
baseOnly := map[string]bool{"claude-3-7-sonnet": true}
|
||||
assert.True(t, tokenModelLimitAllows(baseOnly, "claude-3-7-sonnet@thinking:on"))
|
||||
assert.True(t, tokenModelLimitAllows(baseOnly, "claude-3-7-sonnet-thinking"))
|
||||
|
||||
wildcard := map[string]bool{"gemini-2.5-flash-thinking-*": true}
|
||||
assert.True(t, tokenModelLimitAllows(wildcard, "gemini-2.5-flash-thinking-8192"))
|
||||
}
|
||||
|
||||
func TestTokenModelLimitAllowsExemptAtNameByFullName(t *testing.T) {
|
||||
settings := model_setting.GetGlobalSettings()
|
||||
original := append([]string(nil), settings.ThinkingModelBlacklist...)
|
||||
t.Cleanup(func() { settings.ThinkingModelBlacklist = original })
|
||||
settings.ThinkingModelBlacklist = append(original, "re:.*@sha256:.*")
|
||||
|
||||
fullOnly := map[string]bool{"opaque@sha256:deadbeef": true}
|
||||
assert.True(t, tokenModelLimitAllows(fullOnly, "opaque@sha256:deadbeef"))
|
||||
|
||||
baseOnly := map[string]bool{"opaque": true}
|
||||
assert.False(t, tokenModelLimitAllows(baseOnly, "opaque@sha256:deadbeef"))
|
||||
}
|
||||
|
||||
func TestNoAvailableChannelMessageNamesClaimingTaskPlugin(t *testing.T) {
|
||||
require.NoError(t, i18n.Init())
|
||||
registry := jsplugin.NewRegistry()
|
||||
|
||||
@@ -133,7 +133,7 @@ func GetRandomSatisfiedChannel(
|
||||
|
||||
// If no channels found, try to find channels with the normalized model name.
|
||||
if len(channels) == 0 {
|
||||
normalizedModel := ratio_setting.FormatMatchingModelName(model)
|
||||
normalizedModel := ratio_setting.RoutingMatchModelName(model)
|
||||
channels, _ = filterCandidateIDs(group2model2channels[group][normalizedModel], model, filters)
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ func IsChannelEnabledForGroupModel(group string, modelName string, channelID int
|
||||
if isChannelIDInList(group2model2channels[group][modelName], channelID) {
|
||||
return true
|
||||
}
|
||||
normalized := ratio_setting.FormatMatchingModelName(modelName)
|
||||
normalized := ratio_setting.RoutingMatchModelName(modelName)
|
||||
if normalized != "" && normalized != modelName {
|
||||
return isChannelIDInList(group2model2channels[group][normalized], channelID)
|
||||
}
|
||||
@@ -50,7 +50,7 @@ func isChannelEnabledForGroupModelDB(group string, modelName string, channelID i
|
||||
if err == nil && count > 0 {
|
||||
return true
|
||||
}
|
||||
normalized := ratio_setting.FormatMatchingModelName(modelName)
|
||||
normalized := ratio_setting.RoutingMatchModelName(modelName)
|
||||
if normalized == "" || normalized == modelName {
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -37,6 +37,43 @@ func TestConvertClaudeRequestTreatsZeroMaxTokensAsUnset(t *testing.T) {
|
||||
assert.Equal(t, uint(model_setting.GetClaudeSettings().GetDefaultMaxTokens(req.Model)), *converted.MaxTokens)
|
||||
}
|
||||
|
||||
func TestConvertClaudeRequestPreservesNativeClaudeCodeThinking(t *testing.T) {
|
||||
budget := 10000
|
||||
maxTokens := uint(20000)
|
||||
temperature := 0.7
|
||||
topP := 0.9
|
||||
req := &dto.ClaudeRequest{
|
||||
Model: "claude-opus-4-8",
|
||||
MaxTokens: &maxTokens,
|
||||
Temperature: &temperature,
|
||||
TopP: &topP,
|
||||
Thinking: &dto.Thinking{Type: "enabled", BudgetTokens: &budget},
|
||||
OutputConfig: []byte(`{"effort":"high"}`),
|
||||
Messages: []dto.ClaudeMessage{
|
||||
{Role: "user", Content: "hello"},
|
||||
},
|
||||
}
|
||||
info := &relaycommon.RelayInfo{
|
||||
OriginModelName: req.Model,
|
||||
ChannelMeta: &relaycommon.ChannelMeta{
|
||||
UpstreamModelName: req.Model,
|
||||
},
|
||||
}
|
||||
|
||||
out, err := (&Adaptor{}).ConvertClaudeRequest(nil, info, req)
|
||||
require.NoError(t, err)
|
||||
converted, ok := out.(*dto.ClaudeRequest)
|
||||
require.True(t, ok)
|
||||
require.NotNil(t, converted.Thinking)
|
||||
assert.Equal(t, "enabled", converted.Thinking.Type)
|
||||
require.NotNil(t, converted.Thinking.BudgetTokens)
|
||||
assert.Equal(t, budget, *converted.Thinking.BudgetTokens)
|
||||
assert.Equal(t, temperature, *converted.Temperature)
|
||||
assert.Equal(t, topP, *converted.TopP)
|
||||
assert.JSONEq(t, `{"effort":"high"}`, string(converted.OutputConfig))
|
||||
assert.Empty(t, info.ConversionDiagnostics())
|
||||
}
|
||||
|
||||
func TestConvertClaudeRequestZeroMaxTokensStillRaisesThinkingBudget(t *testing.T) {
|
||||
gin.SetMode(gin.TestMode)
|
||||
c, _ := gin.CreateTestContext(httptest.NewRecorder())
|
||||
@@ -59,7 +96,8 @@ func TestConvertClaudeRequestZeroMaxTokensStillRaisesThinkingBudget(t *testing.T
|
||||
outbound, err := common.DeepCopy(original)
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, helper.ModelMappedHelper(c, info, outbound))
|
||||
require.NoError(t, helper.ApplyReasoningModelSuffix(info, outbound))
|
||||
err = helper.ApplyReasoningModelSuffix(nil, info, outbound)
|
||||
require.NoError(t, err)
|
||||
|
||||
out, err := (&Adaptor{}).ConvertClaudeRequest(nil, info, outbound)
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -342,7 +342,8 @@ func applyOpenAIChatReasoningThroughHandlerOrder(t *testing.T, original dto.Gene
|
||||
outbound, err := common.DeepCopy(&original)
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, helper.ModelMappedHelper(c, info, outbound))
|
||||
require.NoError(t, helper.ApplyReasoningModelSuffix(info, outbound))
|
||||
err = helper.ApplyReasoningModelSuffix(nil, info, outbound)
|
||||
require.NoError(t, err)
|
||||
return outbound, info
|
||||
}
|
||||
|
||||
|
||||
@@ -272,7 +272,7 @@ func (a *Adaptor) ConvertOpenAIRequest(c *gin.Context, info *relaycommon.RelayIn
|
||||
if len(request.Usage) == 0 {
|
||||
request.Usage = json.RawMessage(`{"include":true}`)
|
||||
}
|
||||
// 适配 OpenRouter 的 thinking 后缀
|
||||
// 合并 effort 尾巴产生的意图
|
||||
preserveSuffix := model_setting.ShouldPreserveThinkingSuffix(info.OriginModelName) || model_setting.ShouldPreserveThinkingSuffix(info.UpstreamModelName)
|
||||
mergeEffortSuffix := func(modelName string) error {
|
||||
rawEffort, _ := reasoning.ParseOpenAIReasoningEffortFromModelSuffix(modelName)
|
||||
@@ -304,28 +304,6 @@ func (a *Adaptor) ConvertOpenAIRequest(c *gin.Context, info *relaycommon.RelayIn
|
||||
}
|
||||
}
|
||||
}
|
||||
if !preserveSuffix && strings.HasSuffix(info.UpstreamModelName, "-thinking") {
|
||||
initialIntent, err = kitreasoning.MergeExplicitAndSuffix(
|
||||
initialIntent,
|
||||
kitreasoning.Intent{Mode: kitreasoning.ModeEnabled},
|
||||
info.UpstreamModelName,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, kitreasoning.AsClientError(err)
|
||||
}
|
||||
info.UpstreamModelName = strings.TrimSuffix(info.UpstreamModelName, "-thinking")
|
||||
request.Model = info.UpstreamModelName
|
||||
}
|
||||
if !preserveSuffix && info.OriginModelName != info.UpstreamModelName && strings.HasSuffix(info.OriginModelName, "-thinking") {
|
||||
initialIntent, err = kitreasoning.MergeExplicitAndSuffix(
|
||||
initialIntent,
|
||||
kitreasoning.Intent{Mode: kitreasoning.ModeEnabled},
|
||||
info.OriginModelName,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, kitreasoning.AsClientError(err)
|
||||
}
|
||||
}
|
||||
if !initialIntent.IsEmpty() {
|
||||
reasoningConfig := make(map[string]any)
|
||||
if len(request.Reasoning) > 0 {
|
||||
|
||||
@@ -38,7 +38,7 @@ func ClaudeHelper(c *gin.Context, info *relaycommon.RelayInfo) (newAPIError *typ
|
||||
if err != nil {
|
||||
return types.NewError(err, types.ErrorCodeChannelModelMappedError, types.ErrOptionWithSkipRetry())
|
||||
}
|
||||
if err = helper.ApplyReasoningModelSuffix(info, request); err != nil {
|
||||
if err := helper.ApplyReasoningModelSuffix(c, info, request); err != nil {
|
||||
return newConvertRequestFailedError(c, info, err)
|
||||
}
|
||||
|
||||
|
||||
@@ -536,6 +536,7 @@ func genBaseRelayInfo(c *gin.Context, request dto.Request) *RelayInfo {
|
||||
reqId = common.NewRequestId()
|
||||
}
|
||||
reasoningEffort := reasoningEffortFromRequest(request)
|
||||
originModelName := common.GetContextKeyString(c, constant.ContextKeyOriginalModel)
|
||||
info := &RelayInfo{
|
||||
Request: request,
|
||||
ReasoningEffort: reasoningEffort,
|
||||
@@ -547,7 +548,7 @@ func genBaseRelayInfo(c *gin.Context, request dto.Request) *RelayInfo {
|
||||
UserQuota: common.GetContextKeyInt(c, constant.ContextKeyUserQuota),
|
||||
UserEmail: common.GetContextKeyString(c, constant.ContextKeyUserEmail),
|
||||
|
||||
OriginModelName: common.GetContextKeyString(c, constant.ContextKeyOriginalModel),
|
||||
OriginModelName: originModelName,
|
||||
|
||||
TokenId: common.GetContextKeyInt(c, constant.ContextKeyTokenId),
|
||||
TokenKey: common.GetContextKeyString(c, constant.ContextKeyTokenKey),
|
||||
|
||||
@@ -161,6 +161,20 @@ func TestGenRelayInfoCapturesRequestReasoningEffort(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestGenRelayInfoKeepsOriginAndLeavesBillingUnset(t *testing.T) {
|
||||
gin.SetMode(gin.TestMode)
|
||||
ctx, _ := gin.CreateTestContext(httptest.NewRecorder())
|
||||
ctx.Request = httptest.NewRequest("POST", "/v1/chat/completions", nil)
|
||||
const model = "qwen3.8-max@thinking:on@temperature:0.2"
|
||||
ctx.Set("original_model", model)
|
||||
|
||||
info, err := GenRelayInfo(ctx, types.RelayFormatOpenAI, &dto.GeneralOpenAIRequest{Model: model}, nil)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, model, info.OriginModelName)
|
||||
assert.Empty(t, info.BillingModelName)
|
||||
assert.Equal(t, model, info.GetBillingModelName())
|
||||
}
|
||||
|
||||
func TestInitChannelMetaRestoresRequestReasoningEffortForRetry(t *testing.T) {
|
||||
gin.SetMode(gin.TestMode)
|
||||
ctx, _ := gin.CreateTestContext(httptest.NewRecorder())
|
||||
|
||||
@@ -43,7 +43,7 @@ func TextHelper(c *gin.Context, info *relaycommon.RelayInfo) (newAPIError *types
|
||||
if err != nil {
|
||||
return types.NewError(err, types.ErrorCodeChannelModelMappedError, types.ErrOptionWithSkipRetry())
|
||||
}
|
||||
if err = helper.ApplyReasoningModelSuffix(info, request); err != nil {
|
||||
if err := helper.ApplyReasoningModelSuffix(c, info, request); err != nil {
|
||||
return newConvertRequestFailedError(c, info, err)
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,9 @@ import (
|
||||
|
||||
"github.com/QuantumNous/new-api/common"
|
||||
relaycommon "github.com/QuantumNous/new-api/relay/common"
|
||||
"github.com/QuantumNous/new-api/relay/helper"
|
||||
"github.com/QuantumNous/new-api/relaykit/dto"
|
||||
kitreasoning "github.com/QuantumNous/new-api/relaykit/relayconvert/reasoning"
|
||||
"github.com/QuantumNous/new-api/relaykit/types"
|
||||
"github.com/QuantumNous/new-api/service"
|
||||
"github.com/gin-gonic/gin"
|
||||
@@ -62,6 +64,30 @@ func TestOptInSafeToolLossRejectedAsBadRequestWithAdminDiagnostics(t *testing.T)
|
||||
require.Contains(t, adminInfo, "conversion_diagnostics")
|
||||
}
|
||||
|
||||
func TestUnknownModelModifierIsBadRequestWithoutRetry(t *testing.T) {
|
||||
gin.SetMode(gin.TestMode)
|
||||
c, _ := gin.CreateTestContext(httptest.NewRecorder())
|
||||
c.Request = httptest.NewRequest(http.MethodPost, "/v1/chat/completions", nil)
|
||||
|
||||
info := &relaycommon.RelayInfo{
|
||||
OriginModelName: "m@thinkin:on",
|
||||
ChannelMeta: &relaycommon.ChannelMeta{
|
||||
UpstreamModelName: "m@thinkin:on",
|
||||
},
|
||||
}
|
||||
err := helper.ApplyReasoningModelSuffix(c, info)
|
||||
require.Error(t, err)
|
||||
require.True(t, kitreasoning.IsClientError(err))
|
||||
assert.Contains(t, err.Error(), `unsupported model modifier "thinkin"`)
|
||||
assert.Contains(t, err.Error(), "re:")
|
||||
|
||||
apiErr := newConvertRequestFailedError(c, info, err)
|
||||
require.NotNil(t, apiErr)
|
||||
assert.Equal(t, http.StatusBadRequest, apiErr.StatusCode)
|
||||
assert.Equal(t, types.ErrorCodeConvertRequestFailed, apiErr.GetErrorCode())
|
||||
assert.True(t, types.IsSkipRetryError(apiErr))
|
||||
}
|
||||
|
||||
func hasHostDiagnosticCode(diagnostics []types.ConversionDiagnostic, code string) bool {
|
||||
for _, diagnostic := range diagnostics {
|
||||
if diagnostic.Code == code {
|
||||
|
||||
@@ -37,7 +37,7 @@ func GeminiHelper(c *gin.Context, info *relaycommon.RelayInfo) (newAPIError *typ
|
||||
if err != nil {
|
||||
return types.NewError(err, types.ErrorCodeChannelModelMappedError, types.ErrOptionWithSkipRetry())
|
||||
}
|
||||
if err = helper.ApplyReasoningModelSuffix(info, request); err != nil {
|
||||
if err := helper.ApplyReasoningModelSuffix(c, info, request); err != nil {
|
||||
return newConvertRequestFailedError(c, info, err)
|
||||
}
|
||||
|
||||
@@ -198,7 +198,7 @@ func GeminiEmbeddingHandler(c *gin.Context, info *relaycommon.RelayInfo) (newAPI
|
||||
if err != nil {
|
||||
return types.NewError(err, types.ErrorCodeChannelModelMappedError, types.ErrOptionWithSkipRetry())
|
||||
}
|
||||
if err = helper.ApplyReasoningModelSuffix(info, req); err != nil {
|
||||
if err := helper.ApplyReasoningModelSuffix(c, info, req); err != nil {
|
||||
return newConvertRequestFailedError(c, info, err)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,25 +1,26 @@
|
||||
package helper
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/QuantumNous/new-api/relay/common"
|
||||
rootcommon "github.com/QuantumNous/new-api/common"
|
||||
relaycommon "github.com/QuantumNous/new-api/relay/common"
|
||||
"github.com/QuantumNous/new-api/relaykit/dto"
|
||||
hostreasoning "github.com/QuantumNous/new-api/setting/reasoning"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func ModelMappedHelper(c *gin.Context, info *common.RelayInfo, request dto.Request) error {
|
||||
func ModelMappedHelper(c *gin.Context, info *relaycommon.RelayInfo, request dto.Request) error {
|
||||
if info.ChannelMeta == nil {
|
||||
info.ChannelMeta = &common.ChannelMeta{}
|
||||
info.ChannelMeta = &relaycommon.ChannelMeta{}
|
||||
}
|
||||
|
||||
// map model name
|
||||
modelMapping := c.GetString("model_mapping")
|
||||
if modelMapping != "" && modelMapping != "{}" {
|
||||
modelMap := make(map[string]string)
|
||||
err := json.Unmarshal([]byte(modelMapping), &modelMap)
|
||||
err := rootcommon.Unmarshal([]byte(modelMapping), &modelMap)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unmarshal_model_mapping_failed")
|
||||
}
|
||||
@@ -30,17 +31,22 @@ func ModelMappedHelper(c *gin.Context, info *common.RelayInfo, request dto.Reque
|
||||
currentModel: true,
|
||||
}
|
||||
for {
|
||||
if mappedModel, exists := modelMap[currentModel]; exists && mappedModel != "" {
|
||||
mappedModel, exists := modelMap[currentModel]
|
||||
baseModel := hostreasoning.BaseModelName(currentModel)
|
||||
if (!exists || mappedModel == "") && baseModel != currentModel {
|
||||
mappedModel, exists = modelMap[baseModel]
|
||||
}
|
||||
if exists && mappedModel != "" {
|
||||
// 模型重定向循环检测,避免无限循环
|
||||
if visitedModels[mappedModel] {
|
||||
if mappedModel == currentModel {
|
||||
if currentModel == info.OriginModelName {
|
||||
info.IsModelMapped = false
|
||||
return nil
|
||||
} else {
|
||||
info.IsModelMapped = true
|
||||
break
|
||||
}
|
||||
|
||||
info.IsModelMapped = true
|
||||
break
|
||||
}
|
||||
return errors.New("model_mapping_contains_cycle")
|
||||
}
|
||||
|
||||
@@ -0,0 +1,278 @@
|
||||
package helper
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"math"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/QuantumNous/new-api/common"
|
||||
"github.com/QuantumNous/new-api/relaykit/dto"
|
||||
"github.com/QuantumNous/new-api/relaykit/relayconvert/reasoning"
|
||||
"github.com/QuantumNous/new-api/relaykit/types"
|
||||
)
|
||||
|
||||
type parsedModelModifiers struct {
|
||||
base string
|
||||
hasSyntax bool
|
||||
intent reasoning.Intent
|
||||
hasThinking bool
|
||||
temperature *float64
|
||||
topP *float64
|
||||
hasTemperature bool
|
||||
hasTopP bool
|
||||
diagnostics []types.ConversionDiagnostic
|
||||
}
|
||||
|
||||
const modelModifierExemptionHint = `If this segment is part of the real model name, add the model to the "Models that skip thinking suffix processing" setting (re: regex entries are supported)`
|
||||
|
||||
func modelModifierClientError(message string) error {
|
||||
return fmt.Errorf("%s. %s", message, modelModifierExemptionHint)
|
||||
}
|
||||
|
||||
func parseExplicitModelModifiers(modelName string) (parsedModelModifiers, error) {
|
||||
spec := reasoning.ParseModelModifiers(modelName)
|
||||
parsed := parsedModelModifiers{base: spec.Base, hasSyntax: spec.HasModifiers()}
|
||||
last := make(map[string]int, len(spec.Modifiers))
|
||||
|
||||
for index, modifier := range spec.Modifiers {
|
||||
if _, duplicate := last[modifier.Key]; duplicate {
|
||||
parsed.diagnostics = append(parsed.diagnostics, modelModifierDiagnostic(
|
||||
"duplicate_model_modifier",
|
||||
modifier.Key,
|
||||
fmt.Sprintf("model modifier %q is repeated; the rightmost value is used", modifier.Key),
|
||||
))
|
||||
}
|
||||
last[modifier.Key] = index
|
||||
}
|
||||
|
||||
for index, modifier := range spec.Modifiers {
|
||||
if last[modifier.Key] != index {
|
||||
continue
|
||||
}
|
||||
switch modifier.Key {
|
||||
case "thinking":
|
||||
intent, ok := reasoning.ParseThinkingModifier(modifier.Value)
|
||||
if !ok {
|
||||
return parsedModelModifiers{}, modelModifierClientError(
|
||||
fmt.Sprintf("invalid thinking modifier value %q", modifier.Value),
|
||||
)
|
||||
}
|
||||
if parsed.hasThinking && intent.Mode != reasoning.ModeDisabled && intent.BudgetTokens == nil {
|
||||
parsed.intent.Mode = intent.Mode
|
||||
parsed.intent.Source = reasoning.SourceSuffix
|
||||
} else if parsed.hasThinking && intent.Mode != reasoning.ModeDisabled {
|
||||
parsed.intent.Mode = intent.Mode
|
||||
parsed.intent.BudgetTokens = intent.BudgetTokens
|
||||
parsed.intent.BudgetSource = intent.BudgetSource
|
||||
parsed.intent.Source = reasoning.SourceSuffix
|
||||
} else {
|
||||
parsed.intent = intent
|
||||
}
|
||||
parsed.hasThinking = true
|
||||
case "effort":
|
||||
effort, err := reasoning.ParseEffort(modifier.Value)
|
||||
if err != nil || effort == "" {
|
||||
return parsedModelModifiers{}, modelModifierClientError(
|
||||
fmt.Sprintf("invalid effort modifier value %q: must be one of none/low/medium/high/xhigh/max", modifier.Value),
|
||||
)
|
||||
}
|
||||
if effort == reasoning.EffortNone {
|
||||
parsed.intent = reasoning.Intent{Mode: reasoning.ModeDisabled, Effort: reasoning.EffortNone, Source: reasoning.SourceSuffix}
|
||||
} else {
|
||||
if parsed.intent.Mode == reasoning.ModeUnset || parsed.intent.Mode == reasoning.ModeDisabled {
|
||||
parsed.intent.Mode = reasoning.ModeEnabled
|
||||
}
|
||||
parsed.intent.Effort = effort
|
||||
parsed.intent.Source = reasoning.SourceSuffix
|
||||
}
|
||||
parsed.hasThinking = true
|
||||
case "temperature":
|
||||
value, ok := parseFiniteFloat(modifier.Value)
|
||||
if !ok {
|
||||
return parsedModelModifiers{}, modelModifierClientError(
|
||||
fmt.Sprintf("invalid temperature modifier value %q: must be a finite number", modifier.Value),
|
||||
)
|
||||
}
|
||||
parsed.temperature = &value
|
||||
parsed.hasTemperature = true
|
||||
case "topp":
|
||||
value, ok := parseFiniteFloat(modifier.Value)
|
||||
if !ok {
|
||||
return parsedModelModifiers{}, modelModifierClientError(
|
||||
fmt.Sprintf("invalid topp modifier value %q: must be a finite number", modifier.Value),
|
||||
)
|
||||
}
|
||||
parsed.topP = &value
|
||||
parsed.hasTopP = true
|
||||
default:
|
||||
return parsedModelModifiers{}, modelModifierClientError(
|
||||
fmt.Sprintf("unsupported model modifier %q", modifier.Key),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
return parsed, nil
|
||||
}
|
||||
|
||||
func parseFiniteFloat(raw string) (float64, bool) {
|
||||
value, err := strconv.ParseFloat(strings.TrimSpace(raw), 64)
|
||||
if err != nil || math.IsNaN(value) || math.IsInf(value, 0) {
|
||||
return 0, false
|
||||
}
|
||||
return value, true
|
||||
}
|
||||
|
||||
func extractTemperature(req dto.Request) (float64, bool) {
|
||||
switch request := req.(type) {
|
||||
case *dto.GeneralOpenAIRequest:
|
||||
if request != nil && request.Temperature != nil {
|
||||
return *request.Temperature, true
|
||||
}
|
||||
case *dto.OpenAIResponsesRequest:
|
||||
if request != nil && request.Temperature != nil {
|
||||
return *request.Temperature, true
|
||||
}
|
||||
case *dto.ClaudeRequest:
|
||||
if request != nil && request.Temperature != nil {
|
||||
return *request.Temperature, true
|
||||
}
|
||||
case *dto.GeminiChatRequest:
|
||||
if request != nil && request.GenerationConfig.Temperature != nil {
|
||||
return *request.GenerationConfig.Temperature, true
|
||||
}
|
||||
}
|
||||
return 0, false
|
||||
}
|
||||
|
||||
func extractTopP(req dto.Request) (float64, bool) {
|
||||
switch request := req.(type) {
|
||||
case *dto.GeneralOpenAIRequest:
|
||||
if request != nil && request.TopP != nil {
|
||||
return *request.TopP, true
|
||||
}
|
||||
case *dto.OpenAIResponsesRequest:
|
||||
if request != nil && request.TopP != nil {
|
||||
return *request.TopP, true
|
||||
}
|
||||
case *dto.ClaudeRequest:
|
||||
if request != nil && request.TopP != nil {
|
||||
return *request.TopP, true
|
||||
}
|
||||
case *dto.GeminiChatRequest:
|
||||
if request != nil && request.GenerationConfig.TopP != nil {
|
||||
return *request.GenerationConfig.TopP, true
|
||||
}
|
||||
}
|
||||
return 0, false
|
||||
}
|
||||
|
||||
func modelModifierDiagnostic(code string, key string, message string) types.ConversionDiagnostic {
|
||||
return types.ConversionDiagnostic{
|
||||
Code: code,
|
||||
Path: "model.@" + key,
|
||||
Message: message,
|
||||
Severity: types.ConversionDiagnosticWarning,
|
||||
}
|
||||
}
|
||||
|
||||
func applyModelControls(req dto.Request, parsed parsedModelModifiers) error {
|
||||
if req == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
switch request := req.(type) {
|
||||
case *dto.GeneralOpenAIRequest:
|
||||
if parsed.hasTemperature {
|
||||
request.Temperature = parsed.temperature
|
||||
}
|
||||
if parsed.hasTopP {
|
||||
request.TopP = parsed.topP
|
||||
}
|
||||
if parsed.hasThinking {
|
||||
request.ReasoningConversion = reasoning.StateFromIntent(parsed.intent)
|
||||
reasoningConfig := make(map[string]any)
|
||||
if len(request.Reasoning) > 0 {
|
||||
if common.GetJsonType(request.Reasoning) != "object" {
|
||||
return fmt.Errorf("OpenAI reasoning must be a JSON object")
|
||||
}
|
||||
if err := common.Unmarshal(request.Reasoning, &reasoningConfig); err != nil {
|
||||
return fmt.Errorf("invalid OpenAI reasoning config: %w", err)
|
||||
}
|
||||
}
|
||||
if parsed.intent.BudgetTokens != nil {
|
||||
reasoningConfig["enabled"] = parsed.intent.Mode != reasoning.ModeDisabled
|
||||
reasoningConfig["max_tokens"] = *parsed.intent.BudgetTokens
|
||||
delete(reasoningConfig, "effort")
|
||||
request.ReasoningEffort = ""
|
||||
} else {
|
||||
delete(reasoningConfig, "enabled")
|
||||
delete(reasoningConfig, "effort")
|
||||
delete(reasoningConfig, "max_tokens")
|
||||
request.ReasoningEffort = ""
|
||||
if parsed.intent.Effort != "" {
|
||||
request.ReasoningEffort = string(reasoning.OpenAIEffort(parsed.intent.Effort))
|
||||
}
|
||||
}
|
||||
if len(reasoningConfig) == 0 {
|
||||
request.Reasoning = nil
|
||||
} else {
|
||||
encoded, err := common.Marshal(reasoningConfig)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
request.Reasoning = encoded
|
||||
}
|
||||
}
|
||||
case *dto.OpenAIResponsesRequest:
|
||||
if parsed.hasTemperature {
|
||||
request.Temperature = parsed.temperature
|
||||
}
|
||||
if parsed.hasTopP {
|
||||
request.TopP = parsed.topP
|
||||
}
|
||||
if parsed.hasThinking {
|
||||
request.ReasoningConversion = reasoning.StateFromIntent(parsed.intent)
|
||||
if parsed.intent.Effort != "" {
|
||||
if request.Reasoning == nil {
|
||||
request.Reasoning = &dto.Reasoning{}
|
||||
}
|
||||
request.Reasoning.Effort = string(reasoning.OpenAIEffort(parsed.intent.Effort))
|
||||
} else if request.Reasoning != nil && parsed.intent.BudgetTokens == nil {
|
||||
request.Reasoning.Effort = ""
|
||||
}
|
||||
}
|
||||
case *dto.ClaudeRequest:
|
||||
if parsed.hasTemperature {
|
||||
request.Temperature = parsed.temperature
|
||||
}
|
||||
if parsed.hasTopP {
|
||||
request.TopP = parsed.topP
|
||||
}
|
||||
if parsed.hasThinking {
|
||||
request.Thinking = nil
|
||||
if len(request.OutputConfig) > 0 && common.GetJsonType(request.OutputConfig) == "object" {
|
||||
var output map[string]any
|
||||
if err := common.Unmarshal(request.OutputConfig, &output); err == nil {
|
||||
delete(output, "effort")
|
||||
encoded, err := common.Marshal(output)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
request.OutputConfig = encoded
|
||||
}
|
||||
}
|
||||
}
|
||||
case *dto.GeminiChatRequest:
|
||||
if parsed.hasTemperature {
|
||||
request.GenerationConfig.Temperature = parsed.temperature
|
||||
}
|
||||
if parsed.hasTopP {
|
||||
request.GenerationConfig.TopP = parsed.topP
|
||||
}
|
||||
if parsed.hasThinking {
|
||||
request.GenerationConfig.ThinkingConfig = nil
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -9,10 +9,12 @@ import (
|
||||
"github.com/QuantumNous/new-api/model"
|
||||
"github.com/QuantumNous/new-api/pkg/billingexpr"
|
||||
relaycommon "github.com/QuantumNous/new-api/relay/common"
|
||||
"github.com/QuantumNous/new-api/relaykit/relayconvert/reasoning"
|
||||
"github.com/QuantumNous/new-api/relaykit/types"
|
||||
"github.com/QuantumNous/new-api/setting/billing_setting"
|
||||
"github.com/QuantumNous/new-api/setting/operation_setting"
|
||||
"github.com/QuantumNous/new-api/setting/ratio_setting"
|
||||
hostreasoning "github.com/QuantumNous/new-api/setting/reasoning"
|
||||
hosttypes "github.com/QuantumNous/new-api/types"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
@@ -71,6 +73,11 @@ func HandleGroupRatio(ctx *gin.Context, relayInfo *relaycommon.RelayInfo) hostty
|
||||
}
|
||||
|
||||
func ModelPriceHelper(c *gin.Context, info *relaycommon.RelayInfo, promptTokens int, meta *types.TokenCountMeta) (hosttypes.PriceData, error) {
|
||||
if info != nil {
|
||||
if matched := resolveBillingModelName(info.GetOriginModelName()); matched != "" && matched != info.OriginModelName {
|
||||
info.BillingModelName = matched
|
||||
}
|
||||
}
|
||||
billingModelName := info.GetBillingModelName()
|
||||
modelPrice, usePrice := ratio_setting.GetModelPrice(billingModelName, false)
|
||||
|
||||
@@ -267,6 +274,50 @@ func HasModelBillingConfig(modelName string) bool {
|
||||
return ok && strings.TrimSpace(expr) != ""
|
||||
}
|
||||
|
||||
// HasPriceOrRatioEntry reports whether name has a configured price, ratio, or
|
||||
// tiered billing-mode entry after a single wildcard normalization. Self-use
|
||||
// fallback does not count as a configured ratio.
|
||||
func HasPriceOrRatioEntry(name string) bool {
|
||||
formatted := ratio_setting.FormatMatchingModelName(name)
|
||||
if _, ok := ratio_setting.GetModelPrice(formatted, false); ok {
|
||||
return true
|
||||
}
|
||||
if ratio_setting.HasConfiguredModelRatio(formatted) {
|
||||
return true
|
||||
}
|
||||
return billing_setting.GetBillingMode(formatted) == billing_setting.BillingModeTieredExpr
|
||||
}
|
||||
|
||||
func resolveBillingModelName(origin string) string {
|
||||
var candidates []string
|
||||
if !reasoning.ParseModelModifiers(origin).HasModifiers() {
|
||||
candidates = append(candidates, origin)
|
||||
}
|
||||
candidates = append(candidates, hostreasoning.CanonicalBillingModelNames(origin)...)
|
||||
base := hostreasoning.BaseModelName(origin)
|
||||
candidates = append(candidates, base)
|
||||
|
||||
seen := make(map[string]struct{}, len(candidates))
|
||||
matched := ""
|
||||
for _, name := range candidates {
|
||||
if name == "" {
|
||||
continue
|
||||
}
|
||||
if _, ok := seen[name]; ok {
|
||||
continue
|
||||
}
|
||||
seen[name] = struct{}{}
|
||||
if HasPriceOrRatioEntry(name) {
|
||||
matched = name
|
||||
break
|
||||
}
|
||||
}
|
||||
if matched == "" {
|
||||
matched = base
|
||||
}
|
||||
return matched
|
||||
}
|
||||
|
||||
func modelPriceHelperTiered(c *gin.Context, info *relaycommon.RelayInfo, billingModelName string, promptTokens int, meta *types.TokenCountMeta, groupRatioInfo hosttypes.GroupRatioInfo) (hosttypes.PriceData, error) {
|
||||
exprStr, ok := billing_setting.GetBillingExpr(billingModelName)
|
||||
if !ok {
|
||||
|
||||
+288
-4
@@ -277,10 +277,12 @@ func TestModelPriceHelperRequestBillingRatiosOnlyApplyToFixedPrice(t *testing.T)
|
||||
require.Nil(t, info.Billing)
|
||||
}
|
||||
|
||||
// Pricing at controller/relay.go runs before ApplyReasoningModelSuffix.
|
||||
// Identity is GetBillingModelName() → OriginModelName (the suffixed client
|
||||
// name), matching main's info.OriginModelName lookup. Wildcard entries such
|
||||
// as gemini-2.5-flash-thinking-* depend on that unstripped origin form.
|
||||
// Pricing identity is resolved once in ModelPriceHelper via the candidate
|
||||
// ladder: raw name (only when it has no @ modifiers) → canonical
|
||||
// base@effort:E@thinking:S → base@thinking:S → base. Each level is looked up
|
||||
// after FormatMatchingModelName wildcard normalization. A hit on the raw
|
||||
// gemini-2.5-flash-thinking-* wildcard must keep the client origin as the
|
||||
// consume-log name.
|
||||
func TestModelPriceHelperUsesSuffixedOriginLikeMain(t *testing.T) {
|
||||
gin.SetMode(gin.TestMode)
|
||||
|
||||
@@ -313,6 +315,22 @@ func TestModelPriceHelperUsesSuffixedOriginLikeMain(t *testing.T) {
|
||||
assert.Equal(t, "gemini-2.5-flash-thinking-8192", suffixed.GetBillingModelName())
|
||||
assert.Equal(t, 0.075, suffixedPrice.ModelRatio)
|
||||
|
||||
geminiSettings := model_setting.GetGeminiSettings()
|
||||
oldThinking := geminiSettings.ThinkingAdapterEnabled
|
||||
geminiSettings.ThinkingAdapterEnabled = true
|
||||
t.Cleanup(func() { geminiSettings.ThinkingAdapterEnabled = oldThinking })
|
||||
|
||||
adapterOn := &relaycommon.RelayInfo{
|
||||
OriginModelName: "gemini-2.5-flash-thinking-8192",
|
||||
UserGroup: "default",
|
||||
UsingGroup: "default",
|
||||
}
|
||||
adapterOnPrice, err := ModelPriceHelper(ctx, adapterOn, 1000, &types.TokenCountMeta{})
|
||||
require.NoError(t, err)
|
||||
assert.Empty(t, adapterOn.BillingModelName)
|
||||
assert.Equal(t, "gemini-2.5-flash-thinking-8192", adapterOn.GetBillingModelName())
|
||||
assert.Equal(t, 0.075, adapterOnPrice.ModelRatio)
|
||||
|
||||
base := &relaycommon.RelayInfo{
|
||||
OriginModelName: "gemini-2.5-flash",
|
||||
UserGroup: "default",
|
||||
@@ -325,6 +343,272 @@ func TestModelPriceHelperUsesSuffixedOriginLikeMain(t *testing.T) {
|
||||
assert.Equal(t, 0.15, basePrice.ModelRatio)
|
||||
}
|
||||
|
||||
func TestModelPriceHelperHonorsCustomClaudeThinkingAlias(t *testing.T) {
|
||||
gin.SetMode(gin.TestMode)
|
||||
|
||||
savedRatios := ratio_setting.ModelRatio2JSONString()
|
||||
t.Cleanup(func() {
|
||||
require.NoError(t, ratio_setting.UpdateModelRatioByJSONString(savedRatios))
|
||||
})
|
||||
ratios := ratio_setting.GetModelRatioCopy()
|
||||
ratios["claude-3-7-sonnet"] = 1.5
|
||||
ratios["claude-3-7-sonnet-thinking"] = 3.0
|
||||
ratioJSON, err := common.Marshal(ratios)
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, ratio_setting.UpdateModelRatioByJSONString(string(ratioJSON)))
|
||||
|
||||
oldSelfUse := operation_setting.SelfUseModeEnabled
|
||||
operation_setting.SelfUseModeEnabled = false
|
||||
t.Cleanup(func() { operation_setting.SelfUseModeEnabled = oldSelfUse })
|
||||
|
||||
claudeSettings := model_setting.GetClaudeSettings()
|
||||
oldThinking := claudeSettings.ThinkingAdapterEnabled
|
||||
claudeSettings.ThinkingAdapterEnabled = true
|
||||
t.Cleanup(func() { claudeSettings.ThinkingAdapterEnabled = oldThinking })
|
||||
|
||||
ctx, _ := gin.CreateTestContext(httptest.NewRecorder())
|
||||
ctx.Set("group", "default")
|
||||
info := &relaycommon.RelayInfo{
|
||||
OriginModelName: "claude-3-7-sonnet-thinking",
|
||||
UserGroup: "default",
|
||||
UsingGroup: "default",
|
||||
}
|
||||
priceData, err := ModelPriceHelper(ctx, info, 1000, &types.TokenCountMeta{})
|
||||
require.NoError(t, err)
|
||||
assert.Empty(t, info.BillingModelName)
|
||||
assert.Equal(t, "claude-3-7-sonnet-thinking", info.GetBillingModelName())
|
||||
assert.Equal(t, 3.0, priceData.ModelRatio)
|
||||
}
|
||||
|
||||
func TestModelPriceHelperCanonicalBillingLadder(t *testing.T) {
|
||||
gin.SetMode(gin.TestMode)
|
||||
|
||||
savedRatios := ratio_setting.ModelRatio2JSONString()
|
||||
t.Cleanup(func() {
|
||||
require.NoError(t, ratio_setting.UpdateModelRatioByJSONString(savedRatios))
|
||||
})
|
||||
oldSelfUse := operation_setting.SelfUseModeEnabled
|
||||
operation_setting.SelfUseModeEnabled = false
|
||||
t.Cleanup(func() { operation_setting.SelfUseModeEnabled = oldSelfUse })
|
||||
|
||||
ctx, _ := gin.CreateTestContext(httptest.NewRecorder())
|
||||
ctx.Set("group", "default")
|
||||
|
||||
t.Run("level2 full form", func(t *testing.T) {
|
||||
ratios := ratio_setting.GetModelRatioCopy()
|
||||
delete(ratios, "qwen3-max")
|
||||
ratios["qwen3-max@effort:high@thinking:on"] = 4.0
|
||||
ratios["qwen3-max@thinking:on"] = 3.0
|
||||
ratioJSON, err := common.Marshal(ratios)
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, ratio_setting.UpdateModelRatioByJSONString(string(ratioJSON)))
|
||||
|
||||
info := &relaycommon.RelayInfo{
|
||||
OriginModelName: "qwen3-max@thinking:on@effort:high@temperature:0.2",
|
||||
UserGroup: "default",
|
||||
UsingGroup: "default",
|
||||
}
|
||||
priceData, err := ModelPriceHelper(ctx, info, 1000, &types.TokenCountMeta{})
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, "qwen3-max@effort:high@thinking:on", info.BillingModelName)
|
||||
assert.Equal(t, 4.0, priceData.ModelRatio)
|
||||
})
|
||||
|
||||
t.Run("level3 thinking form shuffled budget", func(t *testing.T) {
|
||||
ratios := ratio_setting.GetModelRatioCopy()
|
||||
delete(ratios, "qwen3-max")
|
||||
delete(ratios, "qwen3-max@effort:high@thinking:on")
|
||||
ratios["qwen3-max@thinking:on"] = 3.0
|
||||
ratioJSON, err := common.Marshal(ratios)
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, ratio_setting.UpdateModelRatioByJSONString(string(ratioJSON)))
|
||||
|
||||
info := &relaycommon.RelayInfo{
|
||||
OriginModelName: "qwen3-max@temperature:0.3@thinking:8192",
|
||||
UserGroup: "default",
|
||||
UsingGroup: "default",
|
||||
}
|
||||
priceData, err := ModelPriceHelper(ctx, info, 1000, &types.TokenCountMeta{})
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, "qwen3-max@thinking:on", info.BillingModelName)
|
||||
assert.Equal(t, 3.0, priceData.ModelRatio)
|
||||
})
|
||||
|
||||
t.Run("level4 base fallback", func(t *testing.T) {
|
||||
ratios := ratio_setting.GetModelRatioCopy()
|
||||
delete(ratios, "qwen3-max@thinking:on")
|
||||
delete(ratios, "qwen3-max@effort:high@thinking:on")
|
||||
ratios["qwen3-max"] = 1.25
|
||||
ratioJSON, err := common.Marshal(ratios)
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, ratio_setting.UpdateModelRatioByJSONString(string(ratioJSON)))
|
||||
|
||||
info := &relaycommon.RelayInfo{
|
||||
OriginModelName: "qwen3-max@thinking:off",
|
||||
UserGroup: "default",
|
||||
UsingGroup: "default",
|
||||
}
|
||||
priceData, err := ModelPriceHelper(ctx, info, 1000, &types.TokenCountMeta{})
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, "qwen3-max", info.BillingModelName)
|
||||
assert.Equal(t, 1.25, priceData.ModelRatio)
|
||||
})
|
||||
|
||||
t.Run("thinking minus one bills as on", func(t *testing.T) {
|
||||
ratios := ratio_setting.GetModelRatioCopy()
|
||||
ratios["qwen3-max@thinking:on"] = 3.0
|
||||
ratioJSON, err := common.Marshal(ratios)
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, ratio_setting.UpdateModelRatioByJSONString(string(ratioJSON)))
|
||||
|
||||
info := &relaycommon.RelayInfo{
|
||||
OriginModelName: "qwen3-max@thinking:-1",
|
||||
UserGroup: "default",
|
||||
UsingGroup: "default",
|
||||
}
|
||||
priceData, err := ModelPriceHelper(ctx, info, 1000, &types.TokenCountMeta{})
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, "qwen3-max@thinking:on", info.BillingModelName)
|
||||
assert.Equal(t, 3.0, priceData.ModelRatio)
|
||||
})
|
||||
}
|
||||
|
||||
func TestModelPriceHelperMigratesLegacyGeminiWildcardToCanonical(t *testing.T) {
|
||||
gin.SetMode(gin.TestMode)
|
||||
|
||||
savedRatios := ratio_setting.ModelRatio2JSONString()
|
||||
t.Cleanup(func() {
|
||||
require.NoError(t, ratio_setting.UpdateModelRatioByJSONString(savedRatios))
|
||||
})
|
||||
ratios := ratio_setting.GetModelRatioCopy()
|
||||
delete(ratios, "gemini-2.5-flash-thinking-*")
|
||||
ratios["gemini-2.5-flash"] = 0.15
|
||||
ratios["gemini-2.5-flash@thinking:on"] = 0.09
|
||||
ratioJSON, err := common.Marshal(ratios)
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, ratio_setting.UpdateModelRatioByJSONString(string(ratioJSON)))
|
||||
|
||||
oldSelfUse := operation_setting.SelfUseModeEnabled
|
||||
operation_setting.SelfUseModeEnabled = false
|
||||
t.Cleanup(func() { operation_setting.SelfUseModeEnabled = oldSelfUse })
|
||||
|
||||
geminiSettings := model_setting.GetGeminiSettings()
|
||||
oldThinking := geminiSettings.ThinkingAdapterEnabled
|
||||
geminiSettings.ThinkingAdapterEnabled = true
|
||||
t.Cleanup(func() { geminiSettings.ThinkingAdapterEnabled = oldThinking })
|
||||
|
||||
ctx, _ := gin.CreateTestContext(httptest.NewRecorder())
|
||||
ctx.Set("group", "default")
|
||||
info := &relaycommon.RelayInfo{
|
||||
OriginModelName: "gemini-2.5-flash-thinking-8192",
|
||||
UserGroup: "default",
|
||||
UsingGroup: "default",
|
||||
}
|
||||
priceData, err := ModelPriceHelper(ctx, info, 1000, &types.TokenCountMeta{})
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, "gemini-2.5-flash@thinking:on", info.BillingModelName)
|
||||
assert.Equal(t, 0.09, priceData.ModelRatio)
|
||||
}
|
||||
|
||||
func TestModelPriceHelperModifierNameFallsBackToBase(t *testing.T) {
|
||||
gin.SetMode(gin.TestMode)
|
||||
|
||||
savedRatios := ratio_setting.ModelRatio2JSONString()
|
||||
t.Cleanup(func() {
|
||||
require.NoError(t, ratio_setting.UpdateModelRatioByJSONString(savedRatios))
|
||||
})
|
||||
ratios := ratio_setting.GetModelRatioCopy()
|
||||
ratios["qwen3.8-max"] = 2.0
|
||||
ratioJSON, err := common.Marshal(ratios)
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, ratio_setting.UpdateModelRatioByJSONString(string(ratioJSON)))
|
||||
|
||||
oldSelfUse := operation_setting.SelfUseModeEnabled
|
||||
operation_setting.SelfUseModeEnabled = false
|
||||
t.Cleanup(func() { operation_setting.SelfUseModeEnabled = oldSelfUse })
|
||||
|
||||
ctx, _ := gin.CreateTestContext(httptest.NewRecorder())
|
||||
ctx.Set("group", "default")
|
||||
info := &relaycommon.RelayInfo{
|
||||
OriginModelName: "qwen3.8-max@thinking:on@temperature:0.2",
|
||||
UserGroup: "default",
|
||||
UsingGroup: "default",
|
||||
}
|
||||
priceData, err := ModelPriceHelper(ctx, info, 1000, &types.TokenCountMeta{})
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, "qwen3.8-max", info.BillingModelName)
|
||||
assert.Equal(t, 2.0, priceData.ModelRatio)
|
||||
}
|
||||
|
||||
func TestModelPriceHelperExemptAtNameBillsVerbatim(t *testing.T) {
|
||||
gin.SetMode(gin.TestMode)
|
||||
|
||||
settings := model_setting.GetGlobalSettings()
|
||||
originalBlacklist := append([]string(nil), settings.ThinkingModelBlacklist...)
|
||||
t.Cleanup(func() { settings.ThinkingModelBlacklist = originalBlacklist })
|
||||
settings.ThinkingModelBlacklist = append(originalBlacklist, "re:.*@sha256:.*")
|
||||
|
||||
savedRatios := ratio_setting.ModelRatio2JSONString()
|
||||
t.Cleanup(func() {
|
||||
require.NoError(t, ratio_setting.UpdateModelRatioByJSONString(savedRatios))
|
||||
})
|
||||
ratios := ratio_setting.GetModelRatioCopy()
|
||||
ratios["opaque"] = 1.0
|
||||
ratios["opaque@sha256:deadbeef"] = 7.0
|
||||
ratioJSON, err := common.Marshal(ratios)
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, ratio_setting.UpdateModelRatioByJSONString(string(ratioJSON)))
|
||||
|
||||
oldSelfUse := operation_setting.SelfUseModeEnabled
|
||||
operation_setting.SelfUseModeEnabled = false
|
||||
t.Cleanup(func() { operation_setting.SelfUseModeEnabled = oldSelfUse })
|
||||
|
||||
ctx, _ := gin.CreateTestContext(httptest.NewRecorder())
|
||||
ctx.Set("group", "default")
|
||||
info := &relaycommon.RelayInfo{
|
||||
OriginModelName: "opaque@sha256:deadbeef",
|
||||
UserGroup: "default",
|
||||
UsingGroup: "default",
|
||||
}
|
||||
priceData, err := ModelPriceHelper(ctx, info, 1000, &types.TokenCountMeta{})
|
||||
require.NoError(t, err)
|
||||
assert.Empty(t, info.BillingModelName)
|
||||
assert.Equal(t, "opaque@sha256:deadbeef", info.GetBillingModelName())
|
||||
assert.Equal(t, 7.0, priceData.ModelRatio)
|
||||
}
|
||||
|
||||
func TestModelPriceHelperPreservesGpt51CodexMaxIdentity(t *testing.T) {
|
||||
gin.SetMode(gin.TestMode)
|
||||
|
||||
savedRatios := ratio_setting.ModelRatio2JSONString()
|
||||
t.Cleanup(func() {
|
||||
require.NoError(t, ratio_setting.UpdateModelRatioByJSONString(savedRatios))
|
||||
})
|
||||
ratios := ratio_setting.GetModelRatioCopy()
|
||||
ratios["gpt-5.1-codex-max"] = 1.75
|
||||
ratios["gpt-5.1-codex"] = 9.9
|
||||
ratioJSON, err := common.Marshal(ratios)
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, ratio_setting.UpdateModelRatioByJSONString(string(ratioJSON)))
|
||||
|
||||
oldSelfUse := operation_setting.SelfUseModeEnabled
|
||||
operation_setting.SelfUseModeEnabled = false
|
||||
t.Cleanup(func() { operation_setting.SelfUseModeEnabled = oldSelfUse })
|
||||
|
||||
ctx, _ := gin.CreateTestContext(httptest.NewRecorder())
|
||||
ctx.Set("group", "default")
|
||||
info := &relaycommon.RelayInfo{
|
||||
OriginModelName: "gpt-5.1-codex-max",
|
||||
UserGroup: "default",
|
||||
UsingGroup: "default",
|
||||
}
|
||||
priceData, err := ModelPriceHelper(ctx, info, 1000, &types.TokenCountMeta{})
|
||||
require.NoError(t, err)
|
||||
assert.Empty(t, info.BillingModelName)
|
||||
assert.Equal(t, "gpt-5.1-codex-max", info.GetBillingModelName())
|
||||
assert.Equal(t, 1.75, priceData.ModelRatio)
|
||||
}
|
||||
|
||||
func TestModelPriceHelperNativeGeminiNoThinkingDoesNotAliasBillingModel(t *testing.T) {
|
||||
gin.SetMode(gin.TestMode)
|
||||
|
||||
|
||||
@@ -1,30 +1,33 @@
|
||||
package helper
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
relaycommon "github.com/QuantumNous/new-api/relay/common"
|
||||
"github.com/QuantumNous/new-api/relaykit/dto"
|
||||
"github.com/QuantumNous/new-api/relaykit/relayconvert/convmeta"
|
||||
"github.com/QuantumNous/new-api/relaykit/relayconvert/reasoning"
|
||||
"github.com/QuantumNous/new-api/relaykit/types"
|
||||
"github.com/QuantumNous/new-api/setting/model_setting"
|
||||
hostreasoning "github.com/QuantumNous/new-api/setting/reasoning"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// ApplyReasoningModelSuffix parses host-private reasoning suffixes from the
|
||||
// origin and mapped model names, attaches the resulting intent to RelayInfo,
|
||||
// and normalizes UpstreamModelName to the unsuffixed base. Optional outbound
|
||||
// requests are the DeepCopy the handler will send upstream; they must be
|
||||
// synced here because info.Request is the original, not that copy. Conflict
|
||||
// between an explicit request field and a suffix is a client error.
|
||||
func ApplyReasoningModelSuffix(info *relaycommon.RelayInfo, outbound ...dto.Request) error {
|
||||
// synced here because info.Request is the original, not that copy. Explicit
|
||||
// model modifiers override request fields; mapped-model modifiers override
|
||||
// origin-model modifiers. Pass-through (global or channel) is a no-op so the
|
||||
// request body stays byte-identical. c is used only to correlate diagnostics.
|
||||
func ApplyReasoningModelSuffix(c *gin.Context, info *relaycommon.RelayInfo, outbound ...dto.Request) error {
|
||||
if info == nil {
|
||||
return nil
|
||||
}
|
||||
passThrough := model_setting.GetGlobalSettings().PassThroughRequestEnabled
|
||||
if info.ChannelMeta != nil && info.ChannelSetting.PassThroughBodyEnabled {
|
||||
passThrough = true
|
||||
}
|
||||
if passThrough {
|
||||
if model_setting.GetGlobalSettings().PassThroughRequestEnabled ||
|
||||
info.ChannelMeta != nil && info.ChannelSetting.PassThroughBodyEnabled {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -34,99 +37,179 @@ func ApplyReasoningModelSuffix(info *relaycommon.RelayInfo, outbound ...dto.Requ
|
||||
if info.ChannelMeta != nil {
|
||||
upstream = info.UpstreamModelName
|
||||
}
|
||||
if opts.ShouldPreserveThinkingSuffix(origin) || opts.ShouldPreserveThinkingSuffix(upstream) {
|
||||
return nil
|
||||
}
|
||||
|
||||
originBase, originIntent, originFound, err := parseHostModelSuffix(origin, opts)
|
||||
originParsed, err := parseRequestModelName(origin, opts)
|
||||
if err != nil {
|
||||
return reasoning.AsClientError(err)
|
||||
}
|
||||
upstreamBase, upstreamIntent, upstreamFound, err := parseHostModelSuffix(upstream, opts)
|
||||
if err != nil {
|
||||
return reasoning.AsClientError(err)
|
||||
}
|
||||
|
||||
suffix := originIntent
|
||||
if originFound && upstreamFound {
|
||||
suffix, err = reasoning.MergeExplicitAndSuffix(originIntent, upstreamIntent, origin)
|
||||
upstreamParsed := originParsed
|
||||
if upstream != origin {
|
||||
upstreamParsed, err = parseRequestModelName(upstream, opts)
|
||||
if err != nil {
|
||||
return reasoning.AsClientError(err)
|
||||
}
|
||||
} else if upstreamFound {
|
||||
suffix = upstreamIntent
|
||||
}
|
||||
diagnostics := append([]types.ConversionDiagnostic(nil), originParsed.diagnostics...)
|
||||
if upstream != origin {
|
||||
diagnostics = append(diagnostics, upstreamParsed.diagnostics...)
|
||||
}
|
||||
|
||||
explicit, err := explicitIntentFromRequest(info.Request)
|
||||
if err != nil {
|
||||
return reasoning.AsClientError(err)
|
||||
}
|
||||
conflictModel := upstream
|
||||
if conflictModel == "" {
|
||||
conflictModel = origin
|
||||
}
|
||||
if _, err = reasoning.MergeExplicitAndSuffix(explicit, suffix, conflictModel); err != nil {
|
||||
return reasoning.AsClientError(err)
|
||||
selected := originParsed
|
||||
if upstream != origin {
|
||||
selected, diagnostics = overlayMappedModelModifiers(selected, upstreamParsed, diagnostics)
|
||||
}
|
||||
|
||||
if !suffix.IsEmpty() {
|
||||
info.ReasoningConversion = reasoning.StateFromIntent(suffix)
|
||||
if selected.hasThinking {
|
||||
explicit, err := explicitIntentFromRequest(info.Request)
|
||||
if err != nil {
|
||||
return reasoning.AsClientError(err)
|
||||
}
|
||||
diagnostics = append(diagnostics, modifierRequestOverrideDiagnostics(explicit, selected.intent)...)
|
||||
if selected.intent.IncludeThoughts == nil {
|
||||
selected.intent.IncludeThoughts = explicit.IncludeThoughts
|
||||
}
|
||||
info.ReasoningConversion = reasoning.StateFromIntent(selected.intent)
|
||||
}
|
||||
if info.ChannelMeta != nil {
|
||||
info.UpstreamModelName = selected.base
|
||||
}
|
||||
|
||||
if upstreamFound && info.ChannelMeta != nil {
|
||||
info.UpstreamModelName = upstreamBase
|
||||
} else if !info.IsModelMapped && originFound && info.ChannelMeta != nil {
|
||||
info.UpstreamModelName = originBase
|
||||
if selected.hasTemperature {
|
||||
if current, exists := extractTemperature(info.Request); exists && *selected.temperature != current {
|
||||
diagnostics = append(diagnostics, modelModifierDiagnostic(
|
||||
"model_modifier_overrode_request",
|
||||
"temperature",
|
||||
fmt.Sprintf("model temperature modifier overrides request temperature %v", current),
|
||||
))
|
||||
}
|
||||
}
|
||||
if selected.hasTopP {
|
||||
if current, exists := extractTopP(info.Request); exists && *selected.topP != current {
|
||||
diagnostics = append(diagnostics, modelModifierDiagnostic(
|
||||
"model_modifier_overrode_request",
|
||||
"topp",
|
||||
fmt.Sprintf("model topp modifier overrides request top_p %v", current),
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
// Handlers DeepCopy before this helper; info.Request is the original.
|
||||
// Sync every outbound copy the caller is about to send upstream.
|
||||
for _, outbound := range outbound {
|
||||
if outbound != nil {
|
||||
outbound.SetModelName(info.UpstreamModelName)
|
||||
if outbound == nil {
|
||||
continue
|
||||
}
|
||||
if err := applyModelControls(outbound, selected); err != nil {
|
||||
return reasoning.AsClientError(err)
|
||||
}
|
||||
outbound.SetModelName(info.UpstreamModelName)
|
||||
}
|
||||
if info.Request != nil {
|
||||
info.Request.SetModelName(info.UpstreamModelName)
|
||||
}
|
||||
for i := range diagnostics {
|
||||
diagnostics[i].From = info.RelayFormat
|
||||
}
|
||||
diagnosticContext := context.Background()
|
||||
if c != nil {
|
||||
diagnosticContext = c
|
||||
}
|
||||
info.RecordConversionDiagnostics(diagnosticContext, diagnostics)
|
||||
return nil
|
||||
}
|
||||
|
||||
func parseRequestModelName(name string, opts *convmeta.Options) (parsedModelModifiers, error) {
|
||||
if opts.ShouldPreserveThinkingSuffix(name) {
|
||||
return parsedModelModifiers{base: name}, nil
|
||||
}
|
||||
parsed, err := parseExplicitModelModifiers(name)
|
||||
if err != nil {
|
||||
return parsedModelModifiers{}, err
|
||||
}
|
||||
if opts.ShouldPreserveThinkingSuffix(parsed.base) {
|
||||
return parsed, nil
|
||||
}
|
||||
legacyBase, legacyIntent, legacyFound, err := parseHostModelSuffix(parsed.base, opts)
|
||||
if err != nil {
|
||||
return parsedModelModifiers{}, err
|
||||
}
|
||||
parsed.base = legacyBase
|
||||
if legacyFound && !parsed.hasThinking {
|
||||
parsed.intent = legacyIntent
|
||||
parsed.hasThinking = true
|
||||
}
|
||||
return parsed, nil
|
||||
}
|
||||
|
||||
func overlayMappedModelModifiers(origin parsedModelModifiers, mapped parsedModelModifiers, diagnostics []types.ConversionDiagnostic) (parsedModelModifiers, []types.ConversionDiagnostic) {
|
||||
origin.base = mapped.base
|
||||
origin.hasSyntax = origin.hasSyntax || mapped.hasSyntax
|
||||
origin.diagnostics = nil
|
||||
if mapped.hasThinking {
|
||||
if origin.hasThinking && !sameModifierIntent(origin.intent, mapped.intent) {
|
||||
diagnostics = append(diagnostics, modelModifierDiagnostic(
|
||||
"mapped_model_modifier_override",
|
||||
"thinking",
|
||||
"mapped-model thinking modifier overrides the origin-model modifier",
|
||||
))
|
||||
}
|
||||
origin.intent = mapped.intent
|
||||
origin.hasThinking = true
|
||||
}
|
||||
if mapped.hasTemperature {
|
||||
if origin.hasTemperature && *origin.temperature != *mapped.temperature {
|
||||
diagnostics = append(diagnostics, modelModifierDiagnostic(
|
||||
"mapped_model_modifier_override",
|
||||
"temperature",
|
||||
"mapped-model temperature modifier overrides the origin-model modifier",
|
||||
))
|
||||
}
|
||||
origin.temperature = mapped.temperature
|
||||
origin.hasTemperature = true
|
||||
}
|
||||
if mapped.hasTopP {
|
||||
if origin.hasTopP && *origin.topP != *mapped.topP {
|
||||
diagnostics = append(diagnostics, modelModifierDiagnostic(
|
||||
"mapped_model_modifier_override",
|
||||
"topp",
|
||||
"mapped-model topp modifier overrides the origin-model modifier",
|
||||
))
|
||||
}
|
||||
origin.topP = mapped.topP
|
||||
origin.hasTopP = true
|
||||
}
|
||||
return origin, diagnostics
|
||||
}
|
||||
|
||||
func modifierRequestOverrideDiagnostics(explicit reasoning.Intent, modifier reasoning.Intent) []types.ConversionDiagnostic {
|
||||
if !explicit.HasStrength() || sameModifierIntent(explicit, modifier) {
|
||||
return nil
|
||||
}
|
||||
return []types.ConversionDiagnostic{modelModifierDiagnostic(
|
||||
"model_modifier_overrode_request",
|
||||
"thinking",
|
||||
"model thinking modifier overrides structured request reasoning fields",
|
||||
)}
|
||||
}
|
||||
|
||||
func sameModifierIntent(left reasoning.Intent, right reasoning.Intent) bool {
|
||||
if left.Mode != right.Mode || left.Effort != right.Effort {
|
||||
return false
|
||||
}
|
||||
if left.BudgetTokens == nil || right.BudgetTokens == nil {
|
||||
return left.BudgetTokens == nil && right.BudgetTokens == nil
|
||||
}
|
||||
return *left.BudgetTokens == *right.BudgetTokens
|
||||
}
|
||||
|
||||
func parseHostModelSuffix(name string, opts *convmeta.Options) (string, reasoning.Intent, bool, error) {
|
||||
if name == "" {
|
||||
return name, reasoning.Intent{}, false, nil
|
||||
}
|
||||
if strings.HasPrefix(name, "claude-") {
|
||||
return reasoning.ParseClaudeModelSuffix(name, opts.Claude.ThinkingAdapterEnabled)
|
||||
}
|
||||
if strings.HasPrefix(name, "gemini-") {
|
||||
if !opts.Gemini.ThinkingAdapterEnabled {
|
||||
return name, reasoning.Intent{}, false, nil
|
||||
}
|
||||
return reasoning.ParseGeminiModelSuffix(name, true)
|
||||
}
|
||||
// deepseek-v4 effort tails are consumed by ParseDeepSeekV4ThinkingSuffix
|
||||
// in the DeepSeek adaptor; stripping them here drops THINKING+effort.
|
||||
if strings.HasPrefix(name, "deepseek-v4-") {
|
||||
return name, reasoning.Intent{}, false, nil
|
||||
}
|
||||
effort, base := reasoning.ParseOpenAIReasoningEffortFromModelSuffix(name, opts.PreserveEffortTail)
|
||||
if effort != "" {
|
||||
parsed, err := reasoning.ParseEffort(effort)
|
||||
if err != nil {
|
||||
return name, reasoning.Intent{}, false, err
|
||||
}
|
||||
mode := reasoning.ModeEnabled
|
||||
if parsed == reasoning.EffortNone {
|
||||
mode = reasoning.ModeDisabled
|
||||
}
|
||||
return base, reasoning.Intent{Mode: mode, Effort: parsed, Source: reasoning.SourceSuffix}, true, nil
|
||||
}
|
||||
// Generic -thinking trim is OpenRouter-only. Volcengine/DeepSeek adaptors
|
||||
// read the suffix off UpstreamModelName themselves.
|
||||
if opts != nil && opts.OpenRouterDialect && strings.HasSuffix(name, "-thinking") {
|
||||
return strings.TrimSuffix(name, "-thinking"), reasoning.Intent{Mode: reasoning.ModeEnabled, Source: reasoning.SourceSuffix}, true, nil
|
||||
}
|
||||
return name, reasoning.Intent{}, false, nil
|
||||
return hostreasoning.ParseLegacyModelSuffix(
|
||||
name,
|
||||
opts.Claude.ThinkingAdapterEnabled,
|
||||
opts.Gemini.ThinkingAdapterEnabled,
|
||||
)
|
||||
}
|
||||
|
||||
func explicitIntentFromRequest(req dto.Request) (reasoning.Intent, error) {
|
||||
|
||||
@@ -2,18 +2,28 @@ package helper
|
||||
|
||||
import (
|
||||
"net/http/httptest"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/QuantumNous/new-api/common"
|
||||
"github.com/QuantumNous/new-api/constant"
|
||||
relaycommon "github.com/QuantumNous/new-api/relay/common"
|
||||
"github.com/QuantumNous/new-api/relaykit/dto"
|
||||
kitreasoning "github.com/QuantumNous/new-api/relaykit/relayconvert/reasoning"
|
||||
"github.com/QuantumNous/new-api/relaykit/types"
|
||||
"github.com/QuantumNous/new-api/setting/model_setting"
|
||||
hostreasoning "github.com/QuantumNous/new-api/setting/reasoning"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/tidwall/gjson"
|
||||
)
|
||||
|
||||
func mustApplyReasoningModelSuffix(t *testing.T, info *relaycommon.RelayInfo, outbound ...dto.Request) {
|
||||
t.Helper()
|
||||
require.NoError(t, ApplyReasoningModelSuffix(nil, info, outbound...))
|
||||
}
|
||||
|
||||
func TestApplyReasoningModelSuffixTrimsUpstreamAndAttachesState(t *testing.T) {
|
||||
info := &relaycommon.RelayInfo{
|
||||
OriginModelName: "claude-3-7-sonnet-thinking",
|
||||
@@ -22,7 +32,7 @@ func TestApplyReasoningModelSuffixTrimsUpstreamAndAttachesState(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
require.NoError(t, ApplyReasoningModelSuffix(info))
|
||||
mustApplyReasoningModelSuffix(t, info)
|
||||
assert.Equal(t, "claude-3-7-sonnet", info.UpstreamModelName)
|
||||
require.NotNil(t, info.ReasoningConversion)
|
||||
assert.Equal(t, "enabled", info.ReasoningConversion.Mode)
|
||||
@@ -36,13 +46,13 @@ func TestApplyReasoningModelSuffixRetryKeepsEquivalentState(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
require.NoError(t, ApplyReasoningModelSuffix(info))
|
||||
mustApplyReasoningModelSuffix(t, info)
|
||||
require.NotNil(t, info.ReasoningConversion)
|
||||
firstMode := info.ReasoningConversion.Mode
|
||||
firstEffort := info.ReasoningConversion.Effort
|
||||
|
||||
info.UpstreamModelName = info.OriginModelName
|
||||
require.NoError(t, ApplyReasoningModelSuffix(info))
|
||||
mustApplyReasoningModelSuffix(t, info)
|
||||
require.NotNil(t, info.ReasoningConversion)
|
||||
assert.Equal(t, firstMode, info.ReasoningConversion.Mode)
|
||||
assert.Equal(t, firstEffort, info.ReasoningConversion.Effort)
|
||||
@@ -60,7 +70,7 @@ func TestApplyReasoningModelSuffixRetryClearsStateWhenNewChannelHasNoSuffix(t *t
|
||||
IsModelMapped: true,
|
||||
},
|
||||
}
|
||||
require.NoError(t, ApplyReasoningModelSuffix(info))
|
||||
mustApplyReasoningModelSuffix(t, info)
|
||||
require.NotNil(t, info.ReasoningState())
|
||||
|
||||
ctx, _ := gin.CreateTestContext(httptest.NewRecorder())
|
||||
@@ -70,7 +80,7 @@ func TestApplyReasoningModelSuffixRetryClearsStateWhenNewChannelHasNoSuffix(t *t
|
||||
info.InitChannelMeta(ctx)
|
||||
assert.Nil(t, info.ReasoningState())
|
||||
|
||||
require.NoError(t, ApplyReasoningModelSuffix(info))
|
||||
mustApplyReasoningModelSuffix(t, info)
|
||||
assert.Nil(t, info.ReasoningState())
|
||||
}
|
||||
|
||||
@@ -87,7 +97,7 @@ func TestApplyReasoningModelSuffixPassThroughDoesNotTrim(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
require.NoError(t, ApplyReasoningModelSuffix(info))
|
||||
mustApplyReasoningModelSuffix(t, info)
|
||||
assert.Equal(t, "claude-3-7-sonnet-thinking", info.UpstreamModelName)
|
||||
assert.Nil(t, info.ReasoningConversion)
|
||||
}
|
||||
@@ -105,12 +115,12 @@ func TestApplyReasoningModelSuffixBlacklistDoesNotTrim(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
require.NoError(t, ApplyReasoningModelSuffix(info))
|
||||
mustApplyReasoningModelSuffix(t, info)
|
||||
assert.Equal(t, "claude-3-7-sonnet-thinking", info.UpstreamModelName)
|
||||
assert.Nil(t, info.ReasoningConversion)
|
||||
}
|
||||
|
||||
func TestApplyReasoningModelSuffixRejectsExplicitSuffixConflict(t *testing.T) {
|
||||
func TestApplyReasoningModelSuffixModifierOverridesExplicitConflict(t *testing.T) {
|
||||
info := &relaycommon.RelayInfo{
|
||||
OriginModelName: "claude-3-7-sonnet-thinking",
|
||||
Request: &dto.ClaudeRequest{
|
||||
@@ -122,8 +132,13 @@ func TestApplyReasoningModelSuffixRejectsExplicitSuffixConflict(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
err := ApplyReasoningModelSuffix(info)
|
||||
require.Error(t, err)
|
||||
mustApplyReasoningModelSuffix(t, info, info.Request)
|
||||
require.NotNil(t, info.ReasoningConversion)
|
||||
assert.Equal(t, "enabled", info.ReasoningConversion.Mode)
|
||||
assert.Nil(t, info.Request.(*dto.ClaudeRequest).Thinking)
|
||||
diagnostics := info.ConversionDiagnostics()
|
||||
require.NotEmpty(t, diagnostics)
|
||||
assert.Equal(t, "model_modifier_overrode_request", diagnostics[0].Code)
|
||||
}
|
||||
|
||||
func TestApplyReasoningModelSuffixGeminiNoThinkingWhenAdapterEnabled(t *testing.T) {
|
||||
@@ -139,7 +154,7 @@ func TestApplyReasoningModelSuffixGeminiNoThinkingWhenAdapterEnabled(t *testing.
|
||||
},
|
||||
}
|
||||
|
||||
require.NoError(t, ApplyReasoningModelSuffix(info))
|
||||
mustApplyReasoningModelSuffix(t, info)
|
||||
assert.Equal(t, "gemini-2.5-flash", info.UpstreamModelName)
|
||||
require.NotNil(t, info.ReasoningConversion)
|
||||
assert.Equal(t, "disabled", info.ReasoningConversion.Mode)
|
||||
@@ -154,7 +169,7 @@ func TestApplyReasoningModelSuffixPreservesEffortTailModelID(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
require.NoError(t, ApplyReasoningModelSuffix(info))
|
||||
mustApplyReasoningModelSuffix(t, info)
|
||||
assert.Equal(t, "qwen-max", info.UpstreamModelName)
|
||||
assert.Nil(t, info.ReasoningConversion)
|
||||
}
|
||||
@@ -168,7 +183,7 @@ func TestApplyReasoningModelSuffixLeavesDeepSeekV4SuffixForAdaptor(t *testing.T)
|
||||
},
|
||||
}
|
||||
|
||||
require.NoError(t, ApplyReasoningModelSuffix(info))
|
||||
mustApplyReasoningModelSuffix(t, info)
|
||||
assert.Equal(t, "deepseek-v4-chat-max", info.UpstreamModelName)
|
||||
assert.Nil(t, info.ReasoningConversion)
|
||||
}
|
||||
@@ -182,7 +197,7 @@ func TestApplyReasoningModelSuffixLeavesVolcengineDeepSeekThinkingForAdaptor(t *
|
||||
},
|
||||
}
|
||||
|
||||
require.NoError(t, ApplyReasoningModelSuffix(info))
|
||||
mustApplyReasoningModelSuffix(t, info)
|
||||
assert.Equal(t, "deepseek-r1-thinking", info.UpstreamModelName)
|
||||
assert.Nil(t, info.ReasoningConversion)
|
||||
}
|
||||
@@ -196,14 +211,14 @@ func TestApplyReasoningModelSuffixStillParsesOpenAIEffortTail(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
require.NoError(t, ApplyReasoningModelSuffix(info))
|
||||
mustApplyReasoningModelSuffix(t, info)
|
||||
assert.Equal(t, "gpt-5.1", info.UpstreamModelName)
|
||||
require.NotNil(t, info.ReasoningConversion)
|
||||
assert.Equal(t, "enabled", info.ReasoningConversion.Mode)
|
||||
assert.Equal(t, "high", info.ReasoningConversion.Effort)
|
||||
}
|
||||
|
||||
func TestApplyReasoningModelSuffixTrimsOpenRouterThinkingOnly(t *testing.T) {
|
||||
func TestApplyReasoningModelSuffixLeavesUnknownOpenRouterThinkingModel(t *testing.T) {
|
||||
openRouter := &relaycommon.RelayInfo{
|
||||
OriginModelName: "some-model-thinking",
|
||||
ChannelMeta: &relaycommon.ChannelMeta{
|
||||
@@ -211,8 +226,363 @@ func TestApplyReasoningModelSuffixTrimsOpenRouterThinkingOnly(t *testing.T) {
|
||||
UpstreamModelName: "some-model-thinking",
|
||||
},
|
||||
}
|
||||
require.NoError(t, ApplyReasoningModelSuffix(openRouter))
|
||||
assert.Equal(t, "some-model", openRouter.UpstreamModelName)
|
||||
require.NotNil(t, openRouter.ReasoningConversion)
|
||||
assert.Equal(t, "enabled", openRouter.ReasoningConversion.Mode)
|
||||
mustApplyReasoningModelSuffix(t, openRouter)
|
||||
assert.Equal(t, "some-model-thinking", openRouter.UpstreamModelName)
|
||||
assert.Nil(t, openRouter.ReasoningConversion)
|
||||
}
|
||||
|
||||
func TestApplyReasoningModelSuffixLeavesVersionedQwenMaxUntouched(t *testing.T) {
|
||||
info := &relaycommon.RelayInfo{
|
||||
OriginModelName: "qwen3.8-max",
|
||||
ChannelMeta: &relaycommon.ChannelMeta{
|
||||
UpstreamModelName: "qwen3.8-max",
|
||||
},
|
||||
}
|
||||
|
||||
mustApplyReasoningModelSuffix(t, info)
|
||||
assert.Equal(t, "qwen3.8-max", info.UpstreamModelName)
|
||||
assert.Empty(t, info.BillingModelName)
|
||||
assert.Nil(t, info.ReasoningConversion)
|
||||
}
|
||||
|
||||
func TestApplyReasoningModelSuffixTreatsCloudflareAtAsModelName(t *testing.T) {
|
||||
const model = "@cf/meta/llama-3.1-8b-instruct"
|
||||
info := &relaycommon.RelayInfo{
|
||||
OriginModelName: model,
|
||||
ChannelMeta: &relaycommon.ChannelMeta{UpstreamModelName: model},
|
||||
}
|
||||
|
||||
mustApplyReasoningModelSuffix(t, info)
|
||||
assert.Equal(t, model, info.UpstreamModelName)
|
||||
assert.Nil(t, info.ReasoningConversion)
|
||||
}
|
||||
|
||||
func TestApplyReasoningModelSuffixAppliesExplicitModifierChain(t *testing.T) {
|
||||
temperature := 0.9
|
||||
topP := 1.0
|
||||
request := &dto.GeneralOpenAIRequest{
|
||||
Model: "qwen3.8-max@thinking:on@effort:high@temperature:0.2@topp:0.8",
|
||||
ReasoningEffort: "low",
|
||||
Temperature: &temperature,
|
||||
TopP: &topP,
|
||||
}
|
||||
info := &relaycommon.RelayInfo{
|
||||
OriginModelName: request.Model,
|
||||
Request: request,
|
||||
ChannelMeta: &relaycommon.ChannelMeta{
|
||||
UpstreamModelName: request.Model,
|
||||
},
|
||||
}
|
||||
|
||||
mustApplyReasoningModelSuffix(t, info, request)
|
||||
assert.Equal(t, "qwen3.8-max", info.UpstreamModelName)
|
||||
assert.Empty(t, info.BillingModelName)
|
||||
assert.Equal(t, "qwen3.8-max", request.Model)
|
||||
assert.Equal(t, 0.2, *request.Temperature)
|
||||
assert.Equal(t, 0.8, *request.TopP)
|
||||
assert.Equal(t, "high", request.ReasoningEffort)
|
||||
require.NotNil(t, info.ReasoningConversion)
|
||||
assert.Equal(t, "enabled", info.ReasoningConversion.Mode)
|
||||
assert.Equal(t, "high", info.ReasoningConversion.Effort)
|
||||
assert.Contains(t, info.ConversionDiagnostics(), types.ConversionDiagnostic{
|
||||
Code: "model_modifier_overrode_request",
|
||||
Path: "model.@temperature",
|
||||
Message: "model temperature modifier overrides request temperature 0.9",
|
||||
Severity: types.ConversionDiagnosticWarning,
|
||||
})
|
||||
}
|
||||
|
||||
func TestApplyReasoningModelSuffixRejectsUnknownModifierKey(t *testing.T) {
|
||||
request := &dto.GeneralOpenAIRequest{Model: "m@thinkin:on"}
|
||||
info := &relaycommon.RelayInfo{
|
||||
OriginModelName: request.Model,
|
||||
Request: request,
|
||||
ChannelMeta: &relaycommon.ChannelMeta{
|
||||
UpstreamModelName: request.Model,
|
||||
},
|
||||
}
|
||||
|
||||
err := ApplyReasoningModelSuffix(nil, info, request)
|
||||
require.Error(t, err)
|
||||
assert.True(t, kitreasoning.IsClientError(err))
|
||||
assert.Contains(t, err.Error(), `unsupported model modifier "thinkin"`)
|
||||
assert.Contains(t, err.Error(), "Models that skip thinking suffix processing")
|
||||
assert.Contains(t, err.Error(), "re:")
|
||||
assert.Equal(t, "m@thinkin:on", info.UpstreamModelName)
|
||||
assert.Nil(t, info.ReasoningConversion)
|
||||
}
|
||||
|
||||
func TestApplyReasoningModelSuffixThinkingOnOnly(t *testing.T) {
|
||||
request := &dto.GeneralOpenAIRequest{Model: "qwen3.8-max@thinking:on"}
|
||||
info := &relaycommon.RelayInfo{
|
||||
OriginModelName: request.Model,
|
||||
Request: request,
|
||||
ChannelMeta: &relaycommon.ChannelMeta{
|
||||
UpstreamModelName: request.Model,
|
||||
},
|
||||
}
|
||||
|
||||
mustApplyReasoningModelSuffix(t, info, request)
|
||||
assert.Equal(t, "qwen3.8-max", info.UpstreamModelName)
|
||||
assert.Equal(t, "", request.ReasoningEffort)
|
||||
require.NotNil(t, info.ReasoningConversion)
|
||||
assert.Equal(t, "enabled", info.ReasoningConversion.Mode)
|
||||
assert.Equal(t, "", info.ReasoningConversion.Effort)
|
||||
}
|
||||
|
||||
func TestApplyReasoningModelSuffixThinkingOff(t *testing.T) {
|
||||
request := &dto.GeneralOpenAIRequest{Model: "qwen3.8-max@thinking:off"}
|
||||
info := &relaycommon.RelayInfo{
|
||||
OriginModelName: request.Model,
|
||||
Request: request,
|
||||
ChannelMeta: &relaycommon.ChannelMeta{
|
||||
UpstreamModelName: request.Model,
|
||||
},
|
||||
}
|
||||
|
||||
mustApplyReasoningModelSuffix(t, info, request)
|
||||
assert.Equal(t, "none", request.ReasoningEffort)
|
||||
require.NotNil(t, info.ReasoningConversion)
|
||||
assert.Equal(t, "disabled", info.ReasoningConversion.Mode)
|
||||
assert.Equal(t, "none", info.ReasoningConversion.Effort)
|
||||
}
|
||||
|
||||
func TestApplyReasoningModelSuffixThinkingLegacyValuesRejected(t *testing.T) {
|
||||
request := &dto.GeneralOpenAIRequest{Model: "qwen3.8-max@thinking:enabled"}
|
||||
info := &relaycommon.RelayInfo{
|
||||
OriginModelName: request.Model,
|
||||
Request: request,
|
||||
ChannelMeta: &relaycommon.ChannelMeta{
|
||||
UpstreamModelName: request.Model,
|
||||
},
|
||||
}
|
||||
|
||||
err := ApplyReasoningModelSuffix(nil, info, request)
|
||||
require.Error(t, err)
|
||||
assert.True(t, kitreasoning.IsClientError(err))
|
||||
assert.Contains(t, err.Error(), `invalid thinking modifier value "enabled"`)
|
||||
assert.Contains(t, err.Error(), "Models that skip thinking suffix processing")
|
||||
assert.Equal(t, "qwen3.8-max@thinking:enabled", info.UpstreamModelName)
|
||||
assert.Equal(t, "qwen3.8-max@thinking:enabled", request.Model)
|
||||
assert.Nil(t, info.ReasoningConversion)
|
||||
assert.Empty(t, info.ConversionDiagnostics())
|
||||
}
|
||||
|
||||
func TestApplyReasoningModelSuffixDuplicateModifierLastWins(t *testing.T) {
|
||||
request := &dto.GeneralOpenAIRequest{Model: "qwen3.8-max@thinking:on@thinking:off"}
|
||||
info := &relaycommon.RelayInfo{
|
||||
OriginModelName: request.Model,
|
||||
Request: request,
|
||||
ChannelMeta: &relaycommon.ChannelMeta{
|
||||
UpstreamModelName: request.Model,
|
||||
},
|
||||
}
|
||||
|
||||
mustApplyReasoningModelSuffix(t, info, request)
|
||||
assert.Equal(t, "qwen3.8-max", info.UpstreamModelName)
|
||||
require.NotNil(t, info.ReasoningConversion)
|
||||
assert.Equal(t, "disabled", info.ReasoningConversion.Mode)
|
||||
assert.Contains(t, info.ConversionDiagnostics(), types.ConversionDiagnostic{
|
||||
Code: "duplicate_model_modifier",
|
||||
Path: "model.@thinking",
|
||||
Message: "model modifier \"thinking\" is repeated; the rightmost value is used",
|
||||
Severity: types.ConversionDiagnosticWarning,
|
||||
})
|
||||
}
|
||||
|
||||
func TestApplyReasoningModelSuffixExactExemptionKeepsOpaqueName(t *testing.T) {
|
||||
const model = "opaque@sha256:abc"
|
||||
settings := model_setting.GetGlobalSettings()
|
||||
original := append([]string(nil), settings.ThinkingModelBlacklist...)
|
||||
t.Cleanup(func() { settings.ThinkingModelBlacklist = original })
|
||||
settings.ThinkingModelBlacklist = append(original, model)
|
||||
|
||||
request := &dto.GeneralOpenAIRequest{Model: model}
|
||||
info := &relaycommon.RelayInfo{
|
||||
OriginModelName: model,
|
||||
Request: request,
|
||||
ChannelMeta: &relaycommon.ChannelMeta{
|
||||
UpstreamModelName: model,
|
||||
},
|
||||
}
|
||||
|
||||
mustApplyReasoningModelSuffix(t, info, request)
|
||||
assert.Equal(t, model, info.UpstreamModelName)
|
||||
assert.Equal(t, model, request.Model)
|
||||
assert.Nil(t, info.ReasoningConversion)
|
||||
assert.Empty(t, info.ConversionDiagnostics())
|
||||
}
|
||||
|
||||
func TestApplyReasoningModelSuffixRegexExemptionKeepsOpaqueName(t *testing.T) {
|
||||
const model = "m@sha256:abc"
|
||||
settings := model_setting.GetGlobalSettings()
|
||||
original := append([]string(nil), settings.ThinkingModelBlacklist...)
|
||||
t.Cleanup(func() { settings.ThinkingModelBlacklist = original })
|
||||
settings.ThinkingModelBlacklist = append(original, "re:.*@sha256:.*")
|
||||
|
||||
request := &dto.GeneralOpenAIRequest{Model: model}
|
||||
info := &relaycommon.RelayInfo{
|
||||
OriginModelName: model,
|
||||
Request: request,
|
||||
ChannelMeta: &relaycommon.ChannelMeta{
|
||||
UpstreamModelName: model,
|
||||
},
|
||||
}
|
||||
|
||||
mustApplyReasoningModelSuffix(t, info, request)
|
||||
assert.Equal(t, model, info.UpstreamModelName)
|
||||
assert.Equal(t, model, request.Model)
|
||||
assert.Nil(t, info.ReasoningConversion)
|
||||
assert.Empty(t, info.ConversionDiagnostics())
|
||||
}
|
||||
|
||||
func TestApplyReasoningModelSuffixEffortNoneDisables(t *testing.T) {
|
||||
request := &dto.GeneralOpenAIRequest{Model: "qwen3.8-max@effort:none"}
|
||||
info := &relaycommon.RelayInfo{
|
||||
OriginModelName: request.Model,
|
||||
Request: request,
|
||||
ChannelMeta: &relaycommon.ChannelMeta{
|
||||
UpstreamModelName: request.Model,
|
||||
},
|
||||
}
|
||||
|
||||
mustApplyReasoningModelSuffix(t, info, request)
|
||||
assert.Equal(t, "none", request.ReasoningEffort)
|
||||
require.NotNil(t, info.ReasoningConversion)
|
||||
assert.Equal(t, "disabled", info.ReasoningConversion.Mode)
|
||||
assert.Equal(t, "none", info.ReasoningConversion.Effort)
|
||||
}
|
||||
|
||||
func TestApplyReasoningModelSuffixPassThroughKeepsModifierBodyVerbatim(t *testing.T) {
|
||||
settings := model_setting.GetGlobalSettings()
|
||||
original := settings.PassThroughRequestEnabled
|
||||
t.Cleanup(func() { settings.PassThroughRequestEnabled = original })
|
||||
settings.PassThroughRequestEnabled = true
|
||||
|
||||
gin.SetMode(gin.TestMode)
|
||||
const model = "qwen3.8-max@thinking:on@effort:high@temperature:0.2@topp:0.8"
|
||||
body := `{"model":"` + model + `","messages":[],"vendor_extension":{"keep":true}}`
|
||||
c, _ := gin.CreateTestContext(httptest.NewRecorder())
|
||||
c.Request = httptest.NewRequest("POST", "/v1/chat/completions", strings.NewReader(body))
|
||||
c.Request.Header.Set("Content-Type", "application/json")
|
||||
request := &dto.GeneralOpenAIRequest{Model: model}
|
||||
info := &relaycommon.RelayInfo{
|
||||
OriginModelName: model,
|
||||
Request: request,
|
||||
RelayFormat: types.RelayFormatOpenAI,
|
||||
ChannelMeta: &relaycommon.ChannelMeta{
|
||||
UpstreamModelName: model,
|
||||
},
|
||||
}
|
||||
|
||||
require.NoError(t, ApplyReasoningModelSuffix(c, info, request))
|
||||
assert.Equal(t, model, info.UpstreamModelName)
|
||||
assert.Equal(t, model, request.Model)
|
||||
assert.Nil(t, info.ReasoningConversion)
|
||||
assert.Empty(t, info.ConversionDiagnostics())
|
||||
storage, err := common.GetBodyStorage(c)
|
||||
require.NoError(t, err)
|
||||
got, err := storage.Bytes()
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, body, string(got))
|
||||
}
|
||||
|
||||
func TestApplyReasoningModelSuffixChannelPassThroughKeepsModifierBodyVerbatim(t *testing.T) {
|
||||
gin.SetMode(gin.TestMode)
|
||||
const model = "qwen3.8-max@thinking:on"
|
||||
body := `{"model":"` + model + `","messages":[]}`
|
||||
c, _ := gin.CreateTestContext(httptest.NewRecorder())
|
||||
c.Request = httptest.NewRequest("POST", "/v1/chat/completions", strings.NewReader(body))
|
||||
c.Request.Header.Set("Content-Type", "application/json")
|
||||
request := &dto.GeneralOpenAIRequest{Model: model}
|
||||
info := &relaycommon.RelayInfo{
|
||||
OriginModelName: model,
|
||||
Request: request,
|
||||
ChannelMeta: &relaycommon.ChannelMeta{
|
||||
UpstreamModelName: model,
|
||||
ChannelSetting: dto.ChannelSettings{PassThroughBodyEnabled: true},
|
||||
},
|
||||
}
|
||||
|
||||
require.NoError(t, ApplyReasoningModelSuffix(c, info, request))
|
||||
assert.Equal(t, model, info.UpstreamModelName)
|
||||
assert.Nil(t, info.ReasoningConversion)
|
||||
storage, err := common.GetBodyStorage(c)
|
||||
require.NoError(t, err)
|
||||
got, err := storage.Bytes()
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, body, string(got))
|
||||
}
|
||||
|
||||
func TestApplyReasoningModelSuffixPassThroughAllowsUnknownModifier(t *testing.T) {
|
||||
settings := model_setting.GetGlobalSettings()
|
||||
original := settings.PassThroughRequestEnabled
|
||||
t.Cleanup(func() { settings.PassThroughRequestEnabled = original })
|
||||
settings.PassThroughRequestEnabled = true
|
||||
|
||||
const model = "m@sha256:abc"
|
||||
request := &dto.GeneralOpenAIRequest{Model: model}
|
||||
info := &relaycommon.RelayInfo{
|
||||
OriginModelName: model,
|
||||
Request: request,
|
||||
ChannelMeta: &relaycommon.ChannelMeta{
|
||||
UpstreamModelName: model,
|
||||
},
|
||||
}
|
||||
|
||||
mustApplyReasoningModelSuffix(t, info, request)
|
||||
assert.Equal(t, model, info.UpstreamModelName)
|
||||
assert.Nil(t, info.ReasoningConversion)
|
||||
}
|
||||
|
||||
func TestApplyReasoningModelSuffixAppliesModifiersWhenPassThroughOff(t *testing.T) {
|
||||
request := &dto.GeneralOpenAIRequest{Model: "qwen3.8-max@thinking:on@effort:high"}
|
||||
info := &relaycommon.RelayInfo{
|
||||
OriginModelName: request.Model,
|
||||
Request: request,
|
||||
ChannelMeta: &relaycommon.ChannelMeta{
|
||||
UpstreamModelName: request.Model,
|
||||
},
|
||||
}
|
||||
|
||||
mustApplyReasoningModelSuffix(t, info, request)
|
||||
assert.Equal(t, "qwen3.8-max", info.UpstreamModelName)
|
||||
assert.Equal(t, "high", request.ReasoningEffort)
|
||||
require.NotNil(t, info.ReasoningConversion)
|
||||
assert.Equal(t, "enabled", info.ReasoningConversion.Mode)
|
||||
}
|
||||
|
||||
func TestApplyReasoningModelSuffixThinkingMinusOnePassthrough(t *testing.T) {
|
||||
request := &dto.GeneralOpenAIRequest{Model: "m@thinking:-1"}
|
||||
info := &relaycommon.RelayInfo{
|
||||
OriginModelName: request.Model,
|
||||
Request: request,
|
||||
ChannelMeta: &relaycommon.ChannelMeta{
|
||||
UpstreamModelName: request.Model,
|
||||
},
|
||||
}
|
||||
|
||||
require.NotPanics(t, func() {
|
||||
mustApplyReasoningModelSuffix(t, info, request)
|
||||
})
|
||||
assert.Equal(t, "m", info.UpstreamModelName)
|
||||
require.NotNil(t, info.ReasoningConversion)
|
||||
require.NotNil(t, info.ReasoningConversion.BudgetTokens)
|
||||
assert.Equal(t, -1, *info.ReasoningConversion.BudgetTokens)
|
||||
require.NotEmpty(t, request.Reasoning)
|
||||
assert.Equal(t, float64(-1), gjson.GetBytes(request.Reasoning, "max_tokens").Num)
|
||||
}
|
||||
|
||||
func TestApplyReasoningModelSuffixPreservesGpt51CodexMax(t *testing.T) {
|
||||
info := &relaycommon.RelayInfo{
|
||||
OriginModelName: "gpt-5.1-codex-max",
|
||||
ChannelMeta: &relaycommon.ChannelMeta{
|
||||
UpstreamModelName: "gpt-5.1-codex-max",
|
||||
},
|
||||
}
|
||||
|
||||
mustApplyReasoningModelSuffix(t, info)
|
||||
assert.Equal(t, "gpt-5.1-codex-max", info.UpstreamModelName)
|
||||
assert.Nil(t, info.ReasoningConversion)
|
||||
assert.Equal(t, "gpt-5.1-codex-max", hostreasoning.BaseModelName("gpt-5.1-codex-max"))
|
||||
}
|
||||
@@ -70,7 +70,7 @@ func ResponsesHelper(c *gin.Context, info *relaycommon.RelayInfo) (newAPIError *
|
||||
if err != nil {
|
||||
return types.NewError(err, types.ErrorCodeChannelModelMappedError, types.ErrOptionWithSkipRetry())
|
||||
}
|
||||
if err = helper.ApplyReasoningModelSuffix(info, request); err != nil {
|
||||
if err := helper.ApplyReasoningModelSuffix(c, info, request); err != nil {
|
||||
return newConvertRequestFailedError(c, info, err)
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
package convdiag
|
||||
|
||||
import (
|
||||
"context"
|
||||
"reflect"
|
||||
|
||||
"github.com/QuantumNous/new-api/relaykit/types"
|
||||
)
|
||||
|
||||
type collectorKey struct{}
|
||||
|
||||
type Collector struct {
|
||||
diagnostics []types.ConversionDiagnostic
|
||||
}
|
||||
|
||||
func WithCollector(ctx context.Context) (context.Context, *Collector) {
|
||||
if isNilContext(ctx) {
|
||||
ctx = context.Background()
|
||||
}
|
||||
if collector, _ := ctx.Value(collectorKey{}).(*Collector); collector != nil {
|
||||
return ctx, collector
|
||||
}
|
||||
collector := &Collector{}
|
||||
return context.WithValue(ctx, collectorKey{}, collector), collector
|
||||
}
|
||||
|
||||
func Add(ctx context.Context, diagnostics ...types.ConversionDiagnostic) {
|
||||
if isNilContext(ctx) || len(diagnostics) == 0 {
|
||||
return
|
||||
}
|
||||
collector, _ := ctx.Value(collectorKey{}).(*Collector)
|
||||
if collector == nil {
|
||||
return
|
||||
}
|
||||
collector.diagnostics = append(collector.diagnostics, diagnostics...)
|
||||
}
|
||||
|
||||
func isNilContext(ctx context.Context) bool {
|
||||
if ctx == nil {
|
||||
return true
|
||||
}
|
||||
value := reflect.ValueOf(ctx)
|
||||
switch value.Kind() {
|
||||
case reflect.Chan, reflect.Func, reflect.Interface, reflect.Map, reflect.Ptr, reflect.Slice:
|
||||
return value.IsNil()
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Collector) Diagnostics() []types.ConversionDiagnostic {
|
||||
if c == nil || len(c.diagnostics) == 0 {
|
||||
return nil
|
||||
}
|
||||
return append([]types.ConversionDiagnostic(nil), c.diagnostics...)
|
||||
}
|
||||
@@ -97,7 +97,7 @@ func OpenAIChatRequestToClaudeMessages(c context.Context, info convmeta.Meta, te
|
||||
if err != nil {
|
||||
return nil, reasoning.AsClientError(err)
|
||||
}
|
||||
if err := sharedclaude.ApplyReasoning(&claudeRequest, info, sourceReasoning); err != nil {
|
||||
if err := sharedclaude.ApplyReasoning(c, &claudeRequest, info, sourceReasoning, true); err != nil {
|
||||
return nil, reasoning.AsClientError(err)
|
||||
}
|
||||
if claudeRequest.MaxTokens == nil {
|
||||
|
||||
@@ -60,7 +60,7 @@ func OpenAIResponsesRequestToClaudeMessages(c context.Context, info convmeta.Met
|
||||
if err != nil {
|
||||
return nil, reasoning.AsClientError(err)
|
||||
}
|
||||
if err := sharedclaude.ApplyReasoning(claudeRequest, info, sourceReasoning); err != nil {
|
||||
if err := sharedclaude.ApplyReasoning(c, claudeRequest, info, sourceReasoning, true); err != nil {
|
||||
return nil, reasoning.AsClientError(err)
|
||||
}
|
||||
if claudeRequest.MaxTokens == nil {
|
||||
|
||||
@@ -1,29 +1,23 @@
|
||||
package claude
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"math"
|
||||
|
||||
"github.com/QuantumNous/new-api/relaykit/dto"
|
||||
"github.com/QuantumNous/new-api/relaykit/relayconvert/convmeta"
|
||||
"github.com/QuantumNous/new-api/relaykit/relayconvert/internal/convdiag"
|
||||
kitutil "github.com/QuantumNous/new-api/relaykit/relayconvert/kitutil"
|
||||
"github.com/QuantumNous/new-api/relaykit/relayconvert/reasoning"
|
||||
"github.com/QuantumNous/new-api/relaykit/types"
|
||||
)
|
||||
|
||||
func ApplyReasoning(req *dto.ClaudeRequest, info convmeta.Meta, source reasoning.Intent) error {
|
||||
func ApplyReasoning(ctx context.Context, req *dto.ClaudeRequest, info convmeta.Meta, source reasoning.Intent, crossProtocol bool) error {
|
||||
if req == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
native, err := reasoning.FromClaude(req)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
explicit, err := reasoning.MergeExplicit(native, source, req.Model)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
opts := convmeta.OptionsOf(info)
|
||||
baseModel := req.Model
|
||||
capabilityModel := baseModel
|
||||
@@ -35,6 +29,32 @@ func ApplyReasoning(req *dto.ClaudeRequest, info convmeta.Meta, source reasoning
|
||||
if preserveSuffix {
|
||||
suffix = reasoning.Intent{}
|
||||
}
|
||||
// A native Claude request without a host modifier is already in the target
|
||||
// protocol, including Claude-compatible proxies that keep native controls
|
||||
// instead of applying Anthropic model rules. Read portable effort for
|
||||
// accounting metadata, but do not run the capability renderer or rewrite
|
||||
// provider-native controls.
|
||||
if !crossProtocol && source.IsEmpty() && suffix.IsEmpty() {
|
||||
native, err := reasoning.FromClaude(req)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if info != nil {
|
||||
if effort := reasoning.EffectiveEffort(native); effort != "" {
|
||||
info.SetReasoningEffort(string(effort))
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
native, err := reasoning.FromClaude(req)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
explicit, err := reasoning.MergeExplicit(native, source, req.Model)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if info != nil && !reasoning.IsKnownClaudeModel(capabilityModel) && reasoning.IsKnownClaudeModel(info.GetOriginModelName()) {
|
||||
capabilityModel = info.GetOriginModelName()
|
||||
}
|
||||
@@ -43,18 +63,6 @@ func ApplyReasoning(req *dto.ClaudeRequest, info convmeta.Meta, source reasoning
|
||||
return err
|
||||
}
|
||||
knownClaudeModel := reasoning.IsKnownClaudeModel(capabilityModel)
|
||||
if source.IsEmpty() && suffix.IsEmpty() && !knownClaudeModel {
|
||||
// A native Messages request can target a non-Anthropic model through a
|
||||
// Claude-compatible proxy. Its capability vocabulary belongs to that
|
||||
// upstream, so preserve validated native controls instead of applying
|
||||
// Anthropic model rules to an unknown model name.
|
||||
if info != nil {
|
||||
if effort := reasoning.EffectiveEffort(intent); effort != "" {
|
||||
info.SetReasoningEffort(string(effort))
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
if !knownClaudeModel && intent.Mode == reasoning.ModeAdaptive {
|
||||
// Cross-protocol pivots cannot safely assume that an unknown
|
||||
// Claude-compatible model implements Anthropic's adaptive mode. Render
|
||||
@@ -93,6 +101,7 @@ func ApplyReasoning(req *dto.ClaudeRequest, info convmeta.Meta, source reasoning
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
convdiag.Add(ctx, rendered.Diagnostics...)
|
||||
req.Model = baseModel
|
||||
if rendered.Thinking != nil {
|
||||
req.Thinking = rendered.Thinking
|
||||
@@ -118,15 +127,34 @@ func ApplyReasoning(req *dto.ClaudeRequest, info convmeta.Meta, source reasoning
|
||||
req.OutputConfig = encoded
|
||||
}
|
||||
if rendered.ClearSampling {
|
||||
if req.Temperature != nil || req.TopP != nil || req.TopK != nil {
|
||||
convdiag.Add(ctx, types.ConversionDiagnostic{
|
||||
Code: "claude_sampling_removed",
|
||||
Path: "temperature/top_p/top_k",
|
||||
Message: fmt.Sprintf("model %q does not accept sampling controls with the selected thinking mode", capabilityModel),
|
||||
Severity: types.ConversionDiagnosticWarning,
|
||||
To: types.RelayFormatClaude,
|
||||
})
|
||||
}
|
||||
req.Temperature = nil
|
||||
req.TopP = nil
|
||||
req.TopK = nil
|
||||
} else if rendered.ConstrainThinkingSampling {
|
||||
removedSampling := req.Temperature != nil || req.TopK != nil || req.TopP != nil && (*req.TopP < 0.95 || *req.TopP > 1)
|
||||
req.Temperature = nil
|
||||
req.TopK = nil
|
||||
if req.TopP != nil && (*req.TopP < 0.95 || *req.TopP > 1) {
|
||||
req.TopP = nil
|
||||
}
|
||||
if removedSampling {
|
||||
convdiag.Add(ctx, types.ConversionDiagnostic{
|
||||
Code: "claude_sampling_constrained",
|
||||
Path: "temperature/top_p/top_k",
|
||||
Message: fmt.Sprintf("model %q accepts only top_p between 0.95 and 1 with manual thinking", capabilityModel),
|
||||
Severity: types.ConversionDiagnosticWarning,
|
||||
To: types.RelayFormatClaude,
|
||||
})
|
||||
}
|
||||
}
|
||||
if info != nil && rendered.EffectiveEffort != "" {
|
||||
info.SetReasoningEffort(string(rendered.EffectiveEffort))
|
||||
|
||||
@@ -81,6 +81,7 @@ func ApplyThinkingConfig(geminiRequest *dto.GeminiChatRequest, info convmeta.Met
|
||||
|
||||
modelName := convmeta.UpstreamModelName(info)
|
||||
var source reasoning.Intent
|
||||
crossProtocol := len(oaiRequest) > 0
|
||||
if len(oaiRequest) > 0 {
|
||||
if modelName == "" {
|
||||
modelName = oaiRequest[0].Model
|
||||
@@ -101,6 +102,21 @@ func ApplyThinkingConfig(geminiRequest *dto.GeminiChatRequest, info convmeta.Met
|
||||
if preserveSuffix {
|
||||
suffix = reasoning.Intent{}
|
||||
}
|
||||
// Native Gemini requests already use the target protocol. Without a host
|
||||
// modifier, read portable effort metadata without running the capability
|
||||
// renderer or rewriting provider-native controls.
|
||||
if !crossProtocol && suffix.IsEmpty() {
|
||||
native, err := reasoning.FromGemini(geminiRequest)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if info != nil {
|
||||
if effort := reasoning.EffectiveEffort(native); effort != "" {
|
||||
info.SetReasoningEffort(string(effort))
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
native, err := reasoning.FromGemini(geminiRequest)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/QuantumNous/new-api/relaykit/dto"
|
||||
"github.com/QuantumNous/new-api/relaykit/types"
|
||||
)
|
||||
|
||||
type ClaudeRender struct {
|
||||
@@ -14,6 +15,7 @@ type ClaudeRender struct {
|
||||
EffectiveEffort Effort
|
||||
ClearSampling bool
|
||||
ConstrainThinkingSampling bool
|
||||
Diagnostics []types.ConversionDiagnostic
|
||||
}
|
||||
|
||||
type claudeCapabilities struct {
|
||||
@@ -73,7 +75,8 @@ func claudeCapabilitiesFor(model string) claudeCapabilities {
|
||||
}
|
||||
|
||||
func RenderClaude(model string, intent Intent, maxTokens *uint, adapterBudgetPercentage float64) (ClaudeRender, error) {
|
||||
if intent.Mode == ModeDisabled && intent.Effort != "" && intent.Effort != EffortNone {
|
||||
disabledWithEffort := intent.Mode == ModeDisabled && intent.Effort != "" && intent.Effort != EffortNone
|
||||
if disabledWithEffort {
|
||||
effort, err := ParseEffort(string(intent.Effort))
|
||||
if err != nil {
|
||||
return ClaudeRender{}, err
|
||||
@@ -87,6 +90,13 @@ func RenderClaude(model string, intent Intent, maxTokens *uint, adapterBudgetPer
|
||||
}
|
||||
}
|
||||
capabilities := claudeCapabilitiesFor(model)
|
||||
diagnostics := make([]types.ConversionDiagnostic, 0, 1)
|
||||
if disabledWithEffort {
|
||||
diagnostics = append(diagnostics, claudeReasoningDiagnostic(
|
||||
"claude_disabled_effort_ignored",
|
||||
fmt.Sprintf("model %q cannot apply effort %q while thinking is disabled; the effort was ignored", model, intent.Effort),
|
||||
))
|
||||
}
|
||||
if !intent.HasStrength() {
|
||||
if intent.IncludeThoughts != nil && capabilities.adaptive && capabilities.defaultThinking {
|
||||
thinking := &dto.Thinking{Type: "adaptive"}
|
||||
@@ -108,23 +118,50 @@ func RenderClaude(model string, intent Intent, maxTokens *uint, adapterBudgetPer
|
||||
}
|
||||
|
||||
if intent.Mode == ModeDisabled || intent.Effort == EffortNone {
|
||||
if strings.HasPrefix(strings.ToLower(model), "claude-opus-5") &&
|
||||
(intent.Effort == EffortXHigh || intent.Effort == EffortMax) {
|
||||
return ClaudeRender{}, fmt.Errorf("model %q does not support effort %q while thinking is disabled", model, intent.Effort)
|
||||
}
|
||||
if !capabilities.supportsDisable {
|
||||
return ClaudeRender{}, fmt.Errorf("%w for model %q", ErrThinkingNotDisabled, model)
|
||||
diagnostics = append(diagnostics, claudeReasoningDiagnostic(
|
||||
"claude_thinking_disable_unsupported",
|
||||
fmt.Sprintf("model %q cannot disable thinking; using the lowest representable thinking mode", model),
|
||||
))
|
||||
if capabilities.adaptive {
|
||||
thinking := &dto.Thinking{Type: "adaptive"}
|
||||
if intent.IncludeThoughts != nil {
|
||||
if *intent.IncludeThoughts {
|
||||
thinking.Display = "summarized"
|
||||
} else {
|
||||
thinking.Display = "omitted"
|
||||
}
|
||||
}
|
||||
outputEffort := Effort("")
|
||||
effectiveEffort := EffortHigh
|
||||
if capabilities.supportsEffort {
|
||||
outputEffort = EffortLow
|
||||
effectiveEffort = EffortLow
|
||||
}
|
||||
return ClaudeRender{
|
||||
Thinking: thinking,
|
||||
OutputEffort: outputEffort,
|
||||
EffectiveEffort: effectiveEffort,
|
||||
ClearSampling: capabilities.strictSampling,
|
||||
Diagnostics: diagnostics,
|
||||
}, nil
|
||||
}
|
||||
return ClaudeRender{Diagnostics: diagnostics}, nil
|
||||
}
|
||||
return ClaudeRender{
|
||||
Thinking: &dto.Thinking{Type: "disabled"},
|
||||
EffectiveEffort: EffortNone,
|
||||
ClearSampling: capabilities.strictSampling,
|
||||
Diagnostics: diagnostics,
|
||||
}, nil
|
||||
}
|
||||
|
||||
preferManual := capabilities.supportsManual && intent.BudgetTokens != nil && intent.Mode != ModeAdaptive
|
||||
if !capabilities.supportsManual && intent.BudgetTokens != nil && intent.BudgetSource == SourceNative && intent.Mode == ModeEnabled {
|
||||
return ClaudeRender{}, fmt.Errorf("model %q requires adaptive thinking and does not support native budget_tokens", model)
|
||||
if !capabilities.supportsManual && intent.BudgetTokens != nil && intent.Mode == ModeEnabled {
|
||||
diagnostics = append(diagnostics, claudeReasoningDiagnostic(
|
||||
"claude_budget_to_adaptive",
|
||||
fmt.Sprintf("model %q uses adaptive thinking; budget_tokens was converted to an effort level", model),
|
||||
))
|
||||
}
|
||||
if capabilities.adaptive && !preferManual {
|
||||
effort := intent.Effort
|
||||
@@ -134,7 +171,14 @@ func RenderClaude(model string, intent Intent, maxTokens *uint, adapterBudgetPer
|
||||
if effort == "" && intent.Mode == ModeEnabled {
|
||||
effort = EffortHigh
|
||||
}
|
||||
effort = normalizeClaudeEffort(effort, capabilities)
|
||||
normalizedEffort := normalizeClaudeEffort(effort, capabilities)
|
||||
if effort != "" && normalizedEffort != effort {
|
||||
diagnostics = append(diagnostics, claudeReasoningDiagnostic(
|
||||
"claude_effort_adjusted",
|
||||
fmt.Sprintf("model %q does not support effort %q; using %q", model, effort, normalizedEffort),
|
||||
))
|
||||
}
|
||||
effort = normalizedEffort
|
||||
effectiveEffort := effort
|
||||
if effectiveEffort == "" && intent.Mode == ModeAdaptive {
|
||||
effectiveEffort = EffortHigh
|
||||
@@ -148,6 +192,7 @@ func RenderClaude(model string, intent Intent, maxTokens *uint, adapterBudgetPer
|
||||
OutputEffort: effort,
|
||||
EffectiveEffort: effectiveEffort,
|
||||
ClearSampling: capabilities.strictSampling,
|
||||
Diagnostics: diagnostics,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -165,11 +210,19 @@ func RenderClaude(model string, intent Intent, maxTokens *uint, adapterBudgetPer
|
||||
EffectiveEffort: effectiveEffort,
|
||||
ClearSampling: capabilities.strictSampling,
|
||||
ConstrainThinkingSampling: !capabilities.strictSampling,
|
||||
Diagnostics: diagnostics,
|
||||
}, nil
|
||||
}
|
||||
|
||||
if intent.Mode == ModeAdaptive {
|
||||
return ClaudeRender{}, fmt.Errorf("model %q does not support adaptive thinking", model)
|
||||
diagnostics = append(diagnostics, claudeReasoningDiagnostic(
|
||||
"claude_adaptive_to_manual",
|
||||
fmt.Sprintf("model %q does not support adaptive thinking; using manual thinking", model),
|
||||
))
|
||||
intent.Mode = ModeEnabled
|
||||
if intent.Effort == "" {
|
||||
intent.Effort = EffortHigh
|
||||
}
|
||||
}
|
||||
if intent.Mode == ModeUnset {
|
||||
return ClaudeRender{OutputEffort: intent.Effort, EffectiveEffort: intent.Effort}, nil
|
||||
@@ -185,23 +238,28 @@ func RenderClaude(model string, intent Intent, maxTokens *uint, adapterBudgetPer
|
||||
}
|
||||
|
||||
budget := 0
|
||||
if intent.BudgetTokens != nil && *intent.BudgetTokens == -1 && intent.BudgetSource == SourceNative {
|
||||
return ClaudeRender{}, fmt.Errorf("Claude thinking budget_tokens does not support -1")
|
||||
}
|
||||
if intent.BudgetTokens != nil && *intent.BudgetTokens >= 0 {
|
||||
budget = *intent.BudgetTokens
|
||||
if intent.BudgetSource != SourceNative {
|
||||
if budget < 1024 {
|
||||
budget = 1024
|
||||
}
|
||||
if uint(budget) >= *maxTokens {
|
||||
budget = int(*maxTokens) - 1
|
||||
}
|
||||
requestedBudget := *intent.BudgetTokens
|
||||
budget = requestedBudget
|
||||
if budget < 1024 {
|
||||
budget = 1024
|
||||
}
|
||||
if budget < 1024 || uint(budget) >= *maxTokens {
|
||||
return ClaudeRender{}, fmt.Errorf("Claude thinking budget must satisfy 1024 <= budget_tokens < max_tokens")
|
||||
if uint(budget) >= *maxTokens {
|
||||
budget = int(*maxTokens) - 1
|
||||
}
|
||||
if budget != requestedBudget {
|
||||
diagnostics = append(diagnostics, claudeReasoningDiagnostic(
|
||||
"claude_budget_adjusted",
|
||||
fmt.Sprintf("model %q requires 1024 <= budget_tokens < max_tokens; adjusted %d to %d", model, requestedBudget, budget),
|
||||
))
|
||||
}
|
||||
} else {
|
||||
if intent.BudgetTokens != nil {
|
||||
diagnostics = append(diagnostics, claudeReasoningDiagnostic(
|
||||
"claude_dynamic_budget_converted",
|
||||
fmt.Sprintf("model %q does not support a dynamic budget; derived a manual budget from reasoning effort", model),
|
||||
))
|
||||
}
|
||||
percentage := effortPercentage(intent.Effort, adapterBudgetPercentage)
|
||||
budget = int(*maxTokens) * percentage / 100
|
||||
if budget < 1024 {
|
||||
@@ -236,9 +294,20 @@ func RenderClaude(model string, intent Intent, maxTokens *uint, adapterBudgetPer
|
||||
OutputEffort: outputEffort,
|
||||
EffectiveEffort: effectiveEffort,
|
||||
ConstrainThinkingSampling: true,
|
||||
Diagnostics: diagnostics,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func claudeReasoningDiagnostic(code string, message string) types.ConversionDiagnostic {
|
||||
return types.ConversionDiagnostic{
|
||||
Code: code,
|
||||
Path: "thinking",
|
||||
Message: message,
|
||||
Severity: types.ConversionDiagnosticWarning,
|
||||
To: types.RelayFormatClaude,
|
||||
}
|
||||
}
|
||||
|
||||
// ClaudeUsesManualThinking reports whether an exact numeric budget is rendered
|
||||
// as legacy extended thinking rather than being reduced to adaptive effort.
|
||||
func ClaudeUsesManualThinking(model string, intent Intent) bool {
|
||||
|
||||
@@ -2,6 +2,7 @@ package reasoning
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
@@ -14,6 +15,102 @@ var OpenAIEffortSuffixes = []string{"-max", "-xhigh", "-high", "-medium", "-low"
|
||||
|
||||
var DeepSeekV4EffortSuffixes = []string{"-none", "-max"}
|
||||
|
||||
var (
|
||||
legacyOpenAIModelPattern = regexp.MustCompile(`^(gpt-[a-z0-9][a-z0-9._-]*|o[1-9][a-z0-9._-]*)$`)
|
||||
legacyClaudeModelPattern = regexp.MustCompile(`^claude-[a-z0-9][a-z0-9._-]*$`)
|
||||
legacyGeminiModelPattern = regexp.MustCompile(`^gemini-[a-z0-9][a-z0-9._-]*$`)
|
||||
)
|
||||
|
||||
type ModelModifier struct {
|
||||
Key string
|
||||
Value string
|
||||
}
|
||||
|
||||
type ModelModifierSpec struct {
|
||||
Raw string
|
||||
Base string
|
||||
Modifiers []ModelModifier
|
||||
}
|
||||
|
||||
func (s ModelModifierSpec) HasModifiers() bool {
|
||||
return len(s.Modifiers) > 0
|
||||
}
|
||||
|
||||
// ParseModelModifiers removes only a contiguous trailing chain of @key:value
|
||||
// segments. Other @ characters remain part of the opaque model name.
|
||||
func ParseModelModifiers(modelName string) ModelModifierSpec {
|
||||
spec := ModelModifierSpec{Raw: modelName, Base: modelName}
|
||||
parts := strings.Split(modelName, "@")
|
||||
if len(parts) < 2 {
|
||||
return spec
|
||||
}
|
||||
|
||||
firstModifier := len(parts)
|
||||
for i := len(parts) - 1; i > 0; i-- {
|
||||
key, value, ok := parseModelModifierSegment(parts[i])
|
||||
if !ok {
|
||||
break
|
||||
}
|
||||
firstModifier = i
|
||||
spec.Modifiers = append([]ModelModifier{{Key: key, Value: value}}, spec.Modifiers...)
|
||||
}
|
||||
if firstModifier == len(parts) {
|
||||
return spec
|
||||
}
|
||||
|
||||
base := strings.Join(parts[:firstModifier], "@")
|
||||
if base == "" {
|
||||
return ModelModifierSpec{Raw: modelName, Base: modelName}
|
||||
}
|
||||
spec.Base = base
|
||||
return spec
|
||||
}
|
||||
|
||||
func parseModelModifierSegment(segment string) (string, string, bool) {
|
||||
colon := strings.IndexByte(segment, ':')
|
||||
if colon <= 0 {
|
||||
return "", "", false
|
||||
}
|
||||
key := segment[:colon]
|
||||
for i, r := range key {
|
||||
letter := r >= 'a' && r <= 'z' || r >= 'A' && r <= 'Z'
|
||||
if i == 0 && !letter || i > 0 && !letter && (r < '0' || r > '9') && r != '_' && r != '-' {
|
||||
return "", "", false
|
||||
}
|
||||
}
|
||||
return strings.ToLower(key), segment[colon+1:], true
|
||||
}
|
||||
|
||||
// ParseThinkingModifier maps an explicit @thinking value onto a portable
|
||||
// Intent. on/adaptive/off and integer budgets (including -1) are accepted;
|
||||
// values below -1 are rejected.
|
||||
func ParseThinkingModifier(raw string) (Intent, bool) {
|
||||
value := strings.ToLower(strings.TrimSpace(raw))
|
||||
switch value {
|
||||
case "on":
|
||||
return Intent{Mode: ModeEnabled, Source: SourceSuffix}, true
|
||||
case "adaptive":
|
||||
return Intent{Mode: ModeAdaptive, Source: SourceSuffix}, true
|
||||
case "off":
|
||||
return Intent{Mode: ModeDisabled, Effort: EffortNone, Source: SourceSuffix}, true
|
||||
}
|
||||
if budget, err := strconv.Atoi(value); err == nil {
|
||||
if budget < -1 {
|
||||
return Intent{}, false
|
||||
}
|
||||
if budget == 0 {
|
||||
return Intent{Mode: ModeDisabled, Effort: EffortNone, Source: SourceSuffix}, true
|
||||
}
|
||||
return Intent{
|
||||
Mode: ModeEnabled,
|
||||
BudgetTokens: &budget,
|
||||
Source: SourceSuffix,
|
||||
BudgetSource: SourceSuffix,
|
||||
}, true
|
||||
}
|
||||
return Intent{}, false
|
||||
}
|
||||
|
||||
func TrimEffortSuffixWithSuffixes(modelName string, suffixes []string) (string, string, bool) {
|
||||
suffix, found := lo.Find(suffixes, func(s string) bool {
|
||||
return strings.HasSuffix(modelName, s)
|
||||
@@ -24,37 +121,31 @@ func TrimEffortSuffixWithSuffixes(modelName string, suffixes []string) (string,
|
||||
return strings.TrimSuffix(modelName, suffix), strings.TrimPrefix(suffix, "-"), true
|
||||
}
|
||||
|
||||
// ParseOpenAIReasoningEffortFromModelSuffix extracts an OpenAI effort tail
|
||||
// such as -high or -none. preserveEffortTail, when non-nil, keeps real model
|
||||
// IDs whose names already end in those tokens (for example qwen-max).
|
||||
// ParseOpenAIReasoningEffortFromModelSuffix extracts an effort tail only from
|
||||
// GPT and o-series model families. preserveEffortTail is consulted on the
|
||||
// complete name first so real model IDs that already end in an effort word
|
||||
// (for example gpt-5.1-codex-max) stay intact.
|
||||
func ParseOpenAIReasoningEffortFromModelSuffix(modelName string, preserveEffortTail func(string) bool) (string, string) {
|
||||
if preserveEffortTail != nil && preserveEffortTail(modelName) {
|
||||
return "", modelName
|
||||
}
|
||||
baseModel, effort, ok := TrimEffortSuffixWithSuffixes(modelName, OpenAIEffortSuffixes)
|
||||
if !ok {
|
||||
if !ok || !legacyOpenAIModelPattern.MatchString(lastModelPathSegment(baseModel)) {
|
||||
return "", modelName
|
||||
}
|
||||
return effort, baseModel
|
||||
}
|
||||
|
||||
func ParseClaudeModelSuffix(modelName string, allowThinkingAlias bool) (string, Intent, bool, error) {
|
||||
if !strings.HasPrefix(modelName, "claude-") {
|
||||
prefix, bare := splitModelNamespace(modelName)
|
||||
if !strings.HasPrefix(bare, "claude-") {
|
||||
return modelName, Intent{}, false, nil
|
||||
}
|
||||
if allowThinkingAlias && hasLegacyThinkingAlias(modelName) {
|
||||
return parseProviderModelSuffix(modelName, "claude-", true, true)
|
||||
base, intent, found, err := parseProviderModelSuffix(bare, "claude-", allowThinkingAlias, true)
|
||||
if err != nil || !found || !legacyClaudeModelPattern.MatchString(base) {
|
||||
return modelName, Intent{}, false, err
|
||||
}
|
||||
if !isKnownClaudeModel(modelName) {
|
||||
return modelName, Intent{}, false, nil
|
||||
}
|
||||
return parseProviderModelSuffix(modelName, "claude-", allowThinkingAlias, true)
|
||||
}
|
||||
|
||||
func hasLegacyThinkingAlias(modelName string) bool {
|
||||
return strings.HasSuffix(modelName, "-thinking") ||
|
||||
strings.HasSuffix(modelName, "-nothinking") ||
|
||||
strings.LastIndex(modelName, "-thinking-") >= 0
|
||||
return prefix + base, intent, true, nil
|
||||
}
|
||||
|
||||
func isKnownClaudeModel(modelName string) bool {
|
||||
@@ -81,36 +172,41 @@ func isKnownClaudeModel(modelName string) bool {
|
||||
}
|
||||
|
||||
func ParseGeminiModelSuffix(modelName string, allowThinkingAlias bool) (string, Intent, bool, error) {
|
||||
if !strings.HasPrefix(modelName, "gemini-") {
|
||||
prefix, bare := splitModelNamespace(modelName)
|
||||
if !strings.HasPrefix(bare, "gemini-") {
|
||||
return modelName, Intent{}, false, nil
|
||||
}
|
||||
if !isKnownGeminiModel(modelName) {
|
||||
return modelName, Intent{}, false, nil
|
||||
base, intent, found, err := parseProviderModelSuffix(bare, "gemini-", allowThinkingAlias, true)
|
||||
if err != nil || !found || !legacyGeminiModelPattern.MatchString(base) {
|
||||
return modelName, Intent{}, false, err
|
||||
}
|
||||
return parseProviderModelSuffix(modelName, "gemini-", allowThinkingAlias, true)
|
||||
return prefix + base, intent, true, nil
|
||||
}
|
||||
|
||||
// ParseKnownProviderModelSuffix extracts a canonical intent only when the
|
||||
// origin identifies a provider family whose suffix vocabulary is defined by
|
||||
// relaykit. Unknown OpenAI-compatible model names are deliberately untouched.
|
||||
func ParseKnownProviderModelSuffix(modelName string, allowThinkingAlias bool) (string, Intent, bool, error) {
|
||||
if strings.HasPrefix(modelName, "claude-") {
|
||||
bare := lastModelPathSegment(modelName)
|
||||
if strings.HasPrefix(bare, "claude-") {
|
||||
return ParseClaudeModelSuffix(modelName, allowThinkingAlias)
|
||||
}
|
||||
if strings.HasPrefix(modelName, "gemini-") {
|
||||
if strings.HasPrefix(bare, "gemini-") {
|
||||
return ParseGeminiModelSuffix(modelName, allowThinkingAlias)
|
||||
}
|
||||
return modelName, Intent{}, false, nil
|
||||
}
|
||||
|
||||
func isKnownGeminiModel(modelName string) bool {
|
||||
baseModel, _, _ := TrimEffortSuffixWithSuffixes(modelName, []string{"-max", "-xhigh", "-high", "-medium", "-low", "-minimal", "-none"})
|
||||
if marker := strings.LastIndex(baseModel, "-thinking-"); marker >= 0 {
|
||||
baseModel = baseModel[:marker]
|
||||
} else {
|
||||
baseModel = strings.TrimSuffix(strings.TrimSuffix(baseModel, "-thinking"), "-nothinking")
|
||||
func splitModelNamespace(modelName string) (string, string) {
|
||||
if slash := strings.LastIndex(modelName, "/"); slash >= 0 {
|
||||
return modelName[:slash+1], modelName[slash+1:]
|
||||
}
|
||||
return geminiCapabilitiesFor(baseModel).kind != geminiThinkingUnknown
|
||||
return "", modelName
|
||||
}
|
||||
|
||||
func lastModelPathSegment(modelName string) string {
|
||||
_, bare := splitModelNamespace(modelName)
|
||||
return bare
|
||||
}
|
||||
|
||||
func TrimGeminiThinkingSuffix(modelName string) (string, bool) {
|
||||
|
||||
@@ -133,6 +133,58 @@ func TestParseKnownProviderModelSuffix(t *testing.T) {
|
||||
assert.Empty(t, effort)
|
||||
assert.Equal(t, "vendor/qwen-max", base)
|
||||
})
|
||||
|
||||
t.Run("preserve gpt-5.1-codex-max with callback", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
preserve := func(name string) bool { return name == "gpt-5.1-codex-max" }
|
||||
effort, base := ParseOpenAIReasoningEffortFromModelSuffix("gpt-5.1-codex-max", preserve)
|
||||
assert.Empty(t, effort)
|
||||
assert.Equal(t, "gpt-5.1-codex-max", base)
|
||||
})
|
||||
|
||||
t.Run("splits gpt-5.1-codex-max without callback", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
effort, base := ParseOpenAIReasoningEffortFromModelSuffix("gpt-5.1-codex-max", nil)
|
||||
assert.Equal(t, "max", effort)
|
||||
assert.Equal(t, "gpt-5.1-codex", base)
|
||||
})
|
||||
}
|
||||
|
||||
func TestParseThinkingModifier(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
on, ok := ParseThinkingModifier("on")
|
||||
require.True(t, ok)
|
||||
assert.Equal(t, ModeEnabled, on.Mode)
|
||||
|
||||
adaptive, ok := ParseThinkingModifier("Adaptive")
|
||||
require.True(t, ok)
|
||||
assert.Equal(t, ModeAdaptive, adaptive.Mode)
|
||||
|
||||
off, ok := ParseThinkingModifier("off")
|
||||
require.True(t, ok)
|
||||
assert.Equal(t, ModeDisabled, off.Mode)
|
||||
assert.Equal(t, EffortNone, off.Effort)
|
||||
|
||||
zero, ok := ParseThinkingModifier("0")
|
||||
require.True(t, ok)
|
||||
assert.Equal(t, ModeDisabled, zero.Mode)
|
||||
|
||||
budget, ok := ParseThinkingModifier("8192")
|
||||
require.True(t, ok)
|
||||
require.NotNil(t, budget.BudgetTokens)
|
||||
assert.Equal(t, 8192, *budget.BudgetTokens)
|
||||
assert.Equal(t, ModeEnabled, budget.Mode)
|
||||
|
||||
dynamic, ok := ParseThinkingModifier("-1")
|
||||
require.True(t, ok)
|
||||
require.NotNil(t, dynamic.BudgetTokens)
|
||||
assert.Equal(t, -1, *dynamic.BudgetTokens)
|
||||
|
||||
_, ok = ParseThinkingModifier("-2")
|
||||
assert.False(t, ok)
|
||||
_, ok = ParseThinkingModifier("enabled")
|
||||
assert.False(t, ok)
|
||||
}
|
||||
|
||||
func intPtr(v int) *int {
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
|
||||
"github.com/QuantumNous/new-api/relaykit/dto"
|
||||
"github.com/QuantumNous/new-api/relaykit/relayconvert/convmeta"
|
||||
"github.com/QuantumNous/new-api/relaykit/relayconvert/internal/convdiag"
|
||||
sharedclaude "github.com/QuantumNous/new-api/relaykit/relayconvert/internal/shared/claude"
|
||||
sharedgemini "github.com/QuantumNous/new-api/relaykit/relayconvert/internal/shared/gemini"
|
||||
"github.com/QuantumNous/new-api/relaykit/relayconvert/reasoning"
|
||||
@@ -33,7 +34,14 @@ func ApplyGeminiThinkingConfigChecked(geminiRequest *dto.GeminiChatRequest, info
|
||||
}
|
||||
|
||||
func ApplyClaudeThinkingModel(claudeRequest *dto.ClaudeRequest, info convmeta.Meta) error {
|
||||
return reasoning.AsClientError(sharedclaude.ApplyReasoning(claudeRequest, info, reasoning.Intent{}))
|
||||
ctx, collector := convdiag.WithCollector(context.Background())
|
||||
err := reasoning.AsClientError(sharedclaude.ApplyReasoning(ctx, claudeRequest, info, reasoning.Intent{}, false))
|
||||
if recorder, ok := info.(interface {
|
||||
RecordConversionDiagnostics(context.Context, []types.ConversionDiagnostic)
|
||||
}); ok {
|
||||
recorder.RecordConversionDiagnostics(ctx, collector.Diagnostics())
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func ChatCompletionsRequestToResponsesRequest(req *dto.GeneralOpenAIRequest) (*dto.OpenAIResponsesRequest, error) {
|
||||
|
||||
@@ -11,6 +11,7 @@ import (
|
||||
"github.com/QuantumNous/new-api/relaykit/dto"
|
||||
"github.com/QuantumNous/new-api/relaykit/relayconvert/convmeta"
|
||||
claudemessages "github.com/QuantumNous/new-api/relaykit/relayconvert/internal/claude_messages"
|
||||
"github.com/QuantumNous/new-api/relaykit/relayconvert/internal/convdiag"
|
||||
geminichat "github.com/QuantumNous/new-api/relaykit/relayconvert/internal/gemini_chat"
|
||||
oaichat "github.com/QuantumNous/new-api/relaykit/relayconvert/internal/oai_chat"
|
||||
oairesponses "github.com/QuantumNous/new-api/relaykit/relayconvert/internal/oai_responses"
|
||||
@@ -239,6 +240,7 @@ func executeRequestSpec(c context.Context, info convmeta.Meta, from types.RelayF
|
||||
}
|
||||
|
||||
func executeRequestSteps(c context.Context, info convmeta.Meta, from types.RelayFormat, target types.RelayFormat, request any, converter string, quality RequestConverterQuality, specs []RequestConverterSpec) (*RequestResult, error) {
|
||||
c, diagnosticCollector := convdiag.WithCollector(c)
|
||||
current, tools, err := toolconv.ExtractRequest(from, request)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -258,7 +260,16 @@ func executeRequestSteps(c context.Context, info convmeta.Meta, from types.Relay
|
||||
steps = append(steps, step)
|
||||
}
|
||||
|
||||
current, diagnostics, err := toolconv.AttachRequest(target, current, tools, convmeta.OptionsOf(info))
|
||||
current, toolDiagnostics, err := toolconv.AttachRequest(target, current, tools, convmeta.OptionsOf(info))
|
||||
diagnostics := append(diagnosticCollector.Diagnostics(), toolDiagnostics...)
|
||||
for i := range diagnostics {
|
||||
if diagnostics[i].From == "" {
|
||||
diagnostics[i].From = from
|
||||
}
|
||||
if diagnostics[i].To == "" {
|
||||
diagnostics[i].To = target
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
return &RequestResult{
|
||||
Value: current,
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
package model_setting
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"regexp"
|
||||
"slices"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/QuantumNous/new-api/common"
|
||||
"github.com/QuantumNous/new-api/setting/config"
|
||||
)
|
||||
|
||||
@@ -33,8 +37,10 @@ func (p ChatCompletionsToResponsesPolicy) IsChannelEnabled(channelID int, channe
|
||||
}
|
||||
|
||||
type GlobalSettings struct {
|
||||
PassThroughRequestEnabled bool `json:"pass_through_request_enabled"`
|
||||
ThinkingModelBlacklist []string `json:"thinking_model_blacklist"`
|
||||
PassThroughRequestEnabled bool `json:"pass_through_request_enabled"`
|
||||
ThinkingModelBlacklist []string `json:"thinking_model_blacklist"`
|
||||
// EffortTailModelIDs lists real model IDs that sit inside the GPT/o-series
|
||||
// family whitelist but whose names already end in an effort word.
|
||||
EffortTailModelIDs []string `json:"effort_tail_model_ids"`
|
||||
ChatCompletionsToResponsesPolicy ChatCompletionsToResponsesPolicy `json:"chat_completions_to_responses_policy"`
|
||||
}
|
||||
@@ -71,32 +77,105 @@ func GetGlobalSettings() *GlobalSettings {
|
||||
return &globalSettings
|
||||
}
|
||||
|
||||
// ShouldPreserveThinkingSuffix 判断模型是否配置为保留 thinking/-nothinking/-low/-high/-medium 后缀
|
||||
const thinkingBlacklistRegexPrefix = "re:"
|
||||
|
||||
type thinkingBlacklistCompiled struct {
|
||||
source string
|
||||
exact []string
|
||||
regexes []*regexp.Regexp
|
||||
}
|
||||
|
||||
var (
|
||||
thinkingBlacklistMu sync.RWMutex
|
||||
thinkingBlacklistCache thinkingBlacklistCompiled
|
||||
)
|
||||
|
||||
func thinkingBlacklistSourceKey(entries []string) string {
|
||||
return strings.Join(entries, "\x00")
|
||||
}
|
||||
|
||||
func compiledThinkingBlacklist() ([]string, []*regexp.Regexp) {
|
||||
entries := globalSettings.ThinkingModelBlacklist
|
||||
key := thinkingBlacklistSourceKey(entries)
|
||||
|
||||
thinkingBlacklistMu.RLock()
|
||||
if thinkingBlacklistCache.source == key {
|
||||
exact, regexes := thinkingBlacklistCache.exact, thinkingBlacklistCache.regexes
|
||||
thinkingBlacklistMu.RUnlock()
|
||||
return exact, regexes
|
||||
}
|
||||
thinkingBlacklistMu.RUnlock()
|
||||
|
||||
thinkingBlacklistMu.Lock()
|
||||
defer thinkingBlacklistMu.Unlock()
|
||||
if thinkingBlacklistCache.source == key {
|
||||
return thinkingBlacklistCache.exact, thinkingBlacklistCache.regexes
|
||||
}
|
||||
|
||||
exact := make([]string, 0, len(entries))
|
||||
var regexes []*regexp.Regexp
|
||||
for _, entry := range entries {
|
||||
entry = strings.TrimSpace(entry)
|
||||
if entry == "" {
|
||||
continue
|
||||
}
|
||||
if strings.HasPrefix(entry, thinkingBlacklistRegexPrefix) {
|
||||
pattern := strings.TrimPrefix(entry, thinkingBlacklistRegexPrefix)
|
||||
if pattern == "" {
|
||||
common.SysError(fmt.Sprintf("invalid thinking_model_blacklist regex %q: pattern is empty", entry))
|
||||
continue
|
||||
}
|
||||
re, err := regexp.Compile(pattern)
|
||||
if err != nil {
|
||||
common.SysError(fmt.Sprintf("invalid thinking_model_blacklist regex %q: %v", entry, err))
|
||||
continue
|
||||
}
|
||||
regexes = append(regexes, re)
|
||||
continue
|
||||
}
|
||||
exact = append(exact, entry)
|
||||
}
|
||||
thinkingBlacklistCache = thinkingBlacklistCompiled{source: key, exact: exact, regexes: regexes}
|
||||
return exact, regexes
|
||||
}
|
||||
|
||||
// ShouldPreserveThinkingSuffix reports whether the full model name is exempt
|
||||
// from host thinking-suffix and @-modifier parsing. Exact blacklist entries
|
||||
// match the complete name; entries prefixed with re: are Go regular expressions
|
||||
// matched with MatchString against the same full name.
|
||||
func ShouldPreserveThinkingSuffix(modelName string) bool {
|
||||
target := strings.TrimSpace(modelName)
|
||||
if target == "" {
|
||||
return false
|
||||
}
|
||||
|
||||
for _, entry := range globalSettings.ThinkingModelBlacklist {
|
||||
if strings.TrimSpace(entry) == target {
|
||||
exact, regexes := compiledThinkingBlacklist()
|
||||
for _, entry := range exact {
|
||||
if entry == target {
|
||||
return true
|
||||
}
|
||||
}
|
||||
for _, re := range regexes {
|
||||
if re.MatchString(target) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// ShouldPreserveEffortTail reports model IDs whose names already end in an
|
||||
// effort-like token and must not be treated as reasoning aliases.
|
||||
// ShouldPreserveEffortTail reports whether modelName is a real model ID whose
|
||||
// name already ends in an effort word. Entries match the complete name and the
|
||||
// de-namespaced bare name.
|
||||
func ShouldPreserveEffortTail(modelName string) bool {
|
||||
target := strings.TrimSpace(modelName)
|
||||
if target == "" {
|
||||
return false
|
||||
}
|
||||
bare := target
|
||||
if slash := strings.LastIndex(bare, "/"); slash >= 0 {
|
||||
bare = bare[slash+1:]
|
||||
if slash := strings.LastIndex(target, "/"); slash >= 0 {
|
||||
bare = target[slash+1:]
|
||||
}
|
||||
|
||||
for _, entry := range globalSettings.EffortTailModelIDs {
|
||||
entry = strings.TrimSpace(entry)
|
||||
if entry == "" {
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package model_setting
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestShouldPreserveThinkingSuffixExactAndRegex(t *testing.T) {
|
||||
settings := GetGlobalSettings()
|
||||
original := append([]string(nil), settings.ThinkingModelBlacklist...)
|
||||
t.Cleanup(func() { settings.ThinkingModelBlacklist = original })
|
||||
|
||||
assert.True(t, ShouldPreserveThinkingSuffix("kimi-k2-thinking"))
|
||||
assert.True(t, ShouldPreserveThinkingSuffix("moonshotai/kimi-k2-thinking"))
|
||||
assert.False(t, ShouldPreserveThinkingSuffix("m@sha256:abc"))
|
||||
|
||||
settings.ThinkingModelBlacklist = []string{
|
||||
"kimi-k2-thinking",
|
||||
"re:[",
|
||||
"re:",
|
||||
"re:.*@sha256:.*",
|
||||
}
|
||||
|
||||
var logged bytes.Buffer
|
||||
previous := gin.DefaultErrorWriter
|
||||
gin.DefaultErrorWriter = &logged
|
||||
t.Cleanup(func() { gin.DefaultErrorWriter = previous })
|
||||
|
||||
assert.True(t, ShouldPreserveThinkingSuffix("kimi-k2-thinking"))
|
||||
assert.True(t, ShouldPreserveThinkingSuffix("m@sha256:abc"))
|
||||
assert.False(t, ShouldPreserveThinkingSuffix("m@sha256"))
|
||||
assert.False(t, ShouldPreserveThinkingSuffix("qwen3-max@thinking:on"))
|
||||
require.Contains(t, logged.String(), `invalid thinking_model_blacklist regex "re:["`)
|
||||
require.Contains(t, logged.String(), `invalid thinking_model_blacklist regex "re:"`)
|
||||
|
||||
settings.ThinkingModelBlacklist = []string{"re:^beta@"}
|
||||
assert.False(t, ShouldPreserveThinkingSuffix("m@sha256:abc"))
|
||||
assert.True(t, ShouldPreserveThinkingSuffix("beta@sha256:abc"))
|
||||
assert.False(t, ShouldPreserveThinkingSuffix("alpha@sha256:abc"))
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package ratio_setting
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/QuantumNous/new-api/setting/model_setting"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestFormatMatchingModelNameDoesNotStripBase(t *testing.T) {
|
||||
assert.Equal(t, "qwen3-max@thinking:on", FormatMatchingModelName("qwen3-max@thinking:on"))
|
||||
assert.Equal(t, "claude-3-7-sonnet-thinking", FormatMatchingModelName("claude-3-7-sonnet-thinking"))
|
||||
assert.Equal(t, "gemini-2.5-flash-thinking-*", FormatMatchingModelName("gemini-2.5-flash-thinking-8192"))
|
||||
assert.Equal(t, "gpt-4-gizmo-*", FormatMatchingModelName("gpt-4-gizmo-abc"))
|
||||
}
|
||||
|
||||
func TestRoutingMatchModelNameStripsThenWildcards(t *testing.T) {
|
||||
assert.Equal(t, "qwen3-max", RoutingMatchModelName("qwen3-max@thinking:on@temperature:0.2"))
|
||||
assert.Equal(t, "claude-3-7-sonnet", RoutingMatchModelName("claude-3-7-sonnet-thinking"))
|
||||
assert.Equal(t, "gemini-2.5-flash-thinking-*", RoutingMatchModelName("gemini-2.5-flash-thinking-8192"))
|
||||
assert.Equal(t, "gpt-5.1-codex-max", RoutingMatchModelName("gpt-5.1-codex-max"))
|
||||
|
||||
geminiSettings := model_setting.GetGeminiSettings()
|
||||
old := geminiSettings.ThinkingAdapterEnabled
|
||||
geminiSettings.ThinkingAdapterEnabled = true
|
||||
t.Cleanup(func() { geminiSettings.ThinkingAdapterEnabled = old })
|
||||
assert.Equal(t, "gemini-2.5-flash", RoutingMatchModelName("gemini-2.5-flash-thinking-8192"))
|
||||
}
|
||||
|
||||
func TestRoutingMatchModelNamePreservesExemptAtName(t *testing.T) {
|
||||
settings := model_setting.GetGlobalSettings()
|
||||
original := append([]string(nil), settings.ThinkingModelBlacklist...)
|
||||
t.Cleanup(func() { settings.ThinkingModelBlacklist = original })
|
||||
settings.ThinkingModelBlacklist = append(original, "re:.*@sha256:.*")
|
||||
|
||||
assert.Equal(t, "opaque@sha256:deadbeef", RoutingMatchModelName("opaque@sha256:deadbeef"))
|
||||
assert.Equal(t, "kimi-k2-thinking", RoutingMatchModelName("kimi-k2-thinking"))
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
|
||||
"github.com/QuantumNous/new-api/common"
|
||||
"github.com/QuantumNous/new-api/setting/operation_setting"
|
||||
hostreasoning "github.com/QuantumNous/new-api/setting/reasoning"
|
||||
"github.com/QuantumNous/new-api/types"
|
||||
)
|
||||
|
||||
@@ -25,196 +26,196 @@ const (
|
||||
|
||||
var defaultModelRatio = map[string]float64{
|
||||
//"midjourney": 50,
|
||||
"gpt-4-gizmo-*": 15,
|
||||
"gpt-4o-gizmo-*": 2.5,
|
||||
"gpt-4-all": 15,
|
||||
"gpt-4o-all": 15,
|
||||
"gpt-4": 15,
|
||||
"gpt-4-0613": 15,
|
||||
"gpt-4-32k": 30,
|
||||
"gpt-4-32k-0613": 30,
|
||||
"gpt-4-1106-preview": 5, // $10 / 1M tokens
|
||||
"gpt-4-0125-preview": 5, // $10 / 1M tokens
|
||||
"gpt-4-turbo-preview": 5, // $10 / 1M tokens
|
||||
"gpt-4-vision-preview": 5, // $10 / 1M tokens
|
||||
"gpt-4-1106-vision-preview": 5, // $10 / 1M tokens
|
||||
"chatgpt-4o-latest": 2.5, // $5 / 1M tokens
|
||||
"gpt-4o": 1.25, // $2.5 / 1M tokens
|
||||
"gpt-4o-audio-preview": 1.25, // $2.5 / 1M tokens
|
||||
"gpt-4o-audio-preview-2024-10-01": 1.25, // $2.5 / 1M tokens
|
||||
"gpt-4o-2024-05-13": 2.5, // $5 / 1M tokens
|
||||
"gpt-4o-2024-08-06": 1.25, // $2.5 / 1M tokens
|
||||
"gpt-4o-2024-11-20": 1.25, // $2.5 / 1M tokens
|
||||
"gpt-4o-realtime-preview": 2.5,
|
||||
"gpt-4o-realtime-preview-2024-10-01": 2.5,
|
||||
"gpt-4o-realtime-preview-2024-12-17": 2.5,
|
||||
"gpt-4o-mini-realtime-preview": 0.3,
|
||||
"gpt-4o-mini-realtime-preview-2024-12-17": 0.3,
|
||||
"gpt-4.1": 1.0, // $2 / 1M tokens
|
||||
"gpt-4.1-2025-04-14": 1.0, // $2 / 1M tokens
|
||||
"gpt-4.1-mini": 0.2, // $0.4 / 1M tokens
|
||||
"gpt-4.1-mini-2025-04-14": 0.2, // $0.4 / 1M tokens
|
||||
"gpt-4.1-nano": 0.05, // $0.1 / 1M tokens
|
||||
"gpt-4.1-nano-2025-04-14": 0.05, // $0.1 / 1M tokens
|
||||
"gpt-image-1": 2.5, // $5 / 1M tokens
|
||||
"o1": 7.5, // $15 / 1M tokens
|
||||
"o1-2024-12-17": 7.5, // $15 / 1M tokens
|
||||
"o1-preview": 7.5, // $15 / 1M tokens
|
||||
"o1-preview-2024-09-12": 7.5, // $15 / 1M tokens
|
||||
"o1-mini": 0.55, // $1.1 / 1M tokens
|
||||
"o1-mini-2024-09-12": 0.55, // $1.1 / 1M tokens
|
||||
"o1-pro": 75.0, // $150 / 1M tokens
|
||||
"o1-pro-2025-03-19": 75.0, // $150 / 1M tokens
|
||||
"o3-mini": 0.55,
|
||||
"o3-mini-2025-01-31": 0.55,
|
||||
"o3-mini-high": 0.55,
|
||||
"o3-mini-2025-01-31-high": 0.55,
|
||||
"o3-mini-low": 0.55,
|
||||
"o3-mini-2025-01-31-low": 0.55,
|
||||
"o3-mini-medium": 0.55,
|
||||
"o3-mini-2025-01-31-medium": 0.55,
|
||||
"o3": 1.0, // $2 / 1M tokens
|
||||
"o3-2025-04-16": 1.0, // $2 / 1M tokens
|
||||
"o3-pro": 10.0, // $20 / 1M tokens
|
||||
"o3-pro-2025-06-10": 10.0, // $20 / 1M tokens
|
||||
"o3-deep-research": 5.0, // $10 / 1M tokens
|
||||
"o3-deep-research-2025-06-26": 5.0, // $10 / 1M tokens
|
||||
"o4-mini": 0.55, // $1.1 / 1M tokens
|
||||
"o4-mini-2025-04-16": 0.55, // $1.1 / 1M tokens
|
||||
"o4-mini-deep-research": 1.0, // $2 / 1M tokens
|
||||
"o4-mini-deep-research-2025-06-26": 1.0, // $2 / 1M tokens
|
||||
"gpt-4o-mini": 0.075,
|
||||
"gpt-4o-mini-2024-07-18": 0.075,
|
||||
"gpt-4-turbo": 5, // $0.01 / 1K tokens
|
||||
"gpt-4-turbo-2024-04-09": 5, // $0.01 / 1K tokens
|
||||
"gpt-4.5-preview": 37.5,
|
||||
"gpt-4.5-preview-2025-02-27": 37.5,
|
||||
"gpt-5": 0.625,
|
||||
"gpt-5-2025-08-07": 0.625,
|
||||
"gpt-5-chat-latest": 0.625,
|
||||
"gpt-5-mini": 0.125,
|
||||
"gpt-5-mini-2025-08-07": 0.125,
|
||||
"gpt-5-nano": 0.025,
|
||||
"gpt-5-nano-2025-08-07": 0.025,
|
||||
"gpt-5.5": 2.5, // $5 / 1M tokens
|
||||
"gpt-5.6-sol": 2.5,
|
||||
"gpt-5.6-terra": 1.25,
|
||||
"gpt-5.6-luna": 0.5,
|
||||
"gpt-3.5-turbo": 0.25,
|
||||
"gpt-3.5-turbo-0613": 0.75,
|
||||
"gpt-3.5-turbo-16k": 1.5, // $0.003 / 1K tokens
|
||||
"gpt-3.5-turbo-16k-0613": 1.5,
|
||||
"gpt-3.5-turbo-instruct": 0.75, // $0.0015 / 1K tokens
|
||||
"gpt-3.5-turbo-1106": 0.5, // $0.001 / 1K tokens
|
||||
"gpt-3.5-turbo-0125": 0.25,
|
||||
"text-ada-001": 0.2,
|
||||
"text-babbage-001": 0.25,
|
||||
"text-curie-001": 1,
|
||||
"text-davinci-edit-001": 10,
|
||||
"code-davinci-edit-001": 10,
|
||||
"whisper-1": 15, // $0.006 / minute -> $0.006 / 150 words -> $0.006 / 200 tokens -> $0.03 / 1k tokens
|
||||
"tts-1": 7.5, // 1k characters -> $0.015
|
||||
"tts-1-1106": 7.5, // 1k characters -> $0.015
|
||||
"tts-1-hd": 15, // 1k characters -> $0.03
|
||||
"tts-1-hd-1106": 15, // 1k characters -> $0.03
|
||||
"davinci": 10,
|
||||
"curie": 10,
|
||||
"text-embedding-3-small": 0.01,
|
||||
"text-embedding-3-large": 0.065,
|
||||
"text-embedding-ada-002": 0.05,
|
||||
"text-search-ada-doc-001": 10,
|
||||
"text-moderation-stable": 0.1,
|
||||
"text-moderation-latest": 0.1,
|
||||
"claude-3-haiku-20240307": 0.125, // $0.25 / 1M tokens
|
||||
"claude-3-5-haiku-20241022": 0.5, // $1 / 1M tokens
|
||||
"claude-haiku-4-5-20251001": 0.5, // $1 / 1M tokens
|
||||
"claude-3-sonnet-20240229": 1.5, // $3 / 1M tokens
|
||||
"claude-3-5-sonnet-20240620": 1.5,
|
||||
"claude-3-5-sonnet-20241022": 1.5,
|
||||
"claude-3-7-sonnet-20250219": 1.5,
|
||||
"claude-3-7-sonnet-20250219-thinking": 1.5,
|
||||
"claude-sonnet-4-20250514": 1.5,
|
||||
"claude-sonnet-4-5-20250929": 1.5,
|
||||
"claude-opus-4-5-20251101": 2.5,
|
||||
"claude-opus-4-6": 2.5,
|
||||
"claude-opus-4-6-max": 2.5,
|
||||
"claude-opus-4-6-high": 2.5,
|
||||
"claude-opus-4-6-medium": 2.5,
|
||||
"claude-opus-4-6-low": 2.5,
|
||||
"claude-opus-4-7": 2.5,
|
||||
"claude-opus-4-7-max": 2.5,
|
||||
"claude-opus-4-7-xhigh": 2.5,
|
||||
"claude-opus-4-7-high": 2.5,
|
||||
"claude-opus-4-7-medium": 2.5,
|
||||
"claude-opus-4-7-low": 2.5,
|
||||
"claude-opus-4-8": 2.5,
|
||||
"claude-opus-4-8-max": 2.5,
|
||||
"claude-opus-4-8-xhigh": 2.5,
|
||||
"claude-opus-4-8-high": 2.5,
|
||||
"claude-opus-4-8-medium": 2.5,
|
||||
"claude-opus-4-8-low": 2.5,
|
||||
"claude-3-opus-20240229": 7.5, // $15 / 1M tokens
|
||||
"claude-opus-4-20250514": 7.5,
|
||||
"claude-opus-4-1-20250805": 7.5,
|
||||
"ERNIE-4.0-8K": 0.120 * RMB,
|
||||
"ERNIE-3.5-8K": 0.012 * RMB,
|
||||
"ERNIE-3.5-8K-0205": 0.024 * RMB,
|
||||
"ERNIE-3.5-8K-1222": 0.012 * RMB,
|
||||
"ERNIE-Bot-8K": 0.024 * RMB,
|
||||
"ERNIE-3.5-4K-0205": 0.012 * RMB,
|
||||
"ERNIE-Speed-8K": 0.004 * RMB,
|
||||
"ERNIE-Speed-128K": 0.004 * RMB,
|
||||
"ERNIE-Lite-8K-0922": 0.008 * RMB,
|
||||
"ERNIE-Lite-8K-0308": 0.003 * RMB,
|
||||
"ERNIE-Tiny-8K": 0.001 * RMB,
|
||||
"BLOOMZ-7B": 0.004 * RMB,
|
||||
"Embedding-V1": 0.002 * RMB,
|
||||
"bge-large-zh": 0.002 * RMB,
|
||||
"bge-large-en": 0.002 * RMB,
|
||||
"tao-8k": 0.002 * RMB,
|
||||
"PaLM-2": 1,
|
||||
"gemini-1.5-pro-latest": 1.25, // $3.5 / 1M tokens
|
||||
"gemini-1.5-flash-latest": 0.075,
|
||||
"gemini-2.0-flash": 0.05,
|
||||
"gemini-2.5-pro-exp-03-25": 0.625,
|
||||
"gemini-2.5-pro-preview-03-25": 0.625,
|
||||
"gemini-2.5-pro": 0.625,
|
||||
"gemini-2.5-flash-preview-04-17": 0.075,
|
||||
"gemini-2.5-flash-preview-04-17-thinking": 0.075,
|
||||
"gemini-2.5-flash-preview-05-20": 0.075,
|
||||
"gemini-2.5-flash-preview-05-20-thinking": 0.075,
|
||||
"gemini-2.5-flash-thinking-*": 0.075, // 用于为后续所有2.5 flash thinking budget 模型设置默认倍率
|
||||
"gemini-2.5-pro-thinking-*": 0.625, // 用于为后续所有2.5 pro thinking budget 模型设置默认倍率
|
||||
"gemini-2.5-flash-lite-preview-thinking-*": 0.05,
|
||||
"gemini-2.5-flash-lite-preview-06-17": 0.05,
|
||||
"gemini-2.5-flash": 0.15,
|
||||
"gemini-robotics-er-1.5-preview": 0.15,
|
||||
"gemini-embedding-001": 0.075,
|
||||
"text-embedding-004": 0.001,
|
||||
"chatglm_turbo": 0.3572, // ¥0.005 / 1k tokens
|
||||
"chatglm_pro": 0.7143, // ¥0.01 / 1k tokens
|
||||
"chatglm_std": 0.3572, // ¥0.005 / 1k tokens
|
||||
"chatglm_lite": 0.1429, // ¥0.002 / 1k tokens
|
||||
"glm-4": 7.143, // ¥0.1 / 1k tokens
|
||||
"glm-4v": 0.05 * RMB, // ¥0.05 / 1k tokens
|
||||
"glm-4-alltools": 0.1 * RMB, // ¥0.1 / 1k tokens
|
||||
"glm-3-turbo": 0.3572,
|
||||
"glm-4-plus": 0.05 * RMB,
|
||||
"glm-4-0520": 0.1 * RMB,
|
||||
"glm-4-air": 0.001 * RMB,
|
||||
"glm-4-airx": 0.01 * RMB,
|
||||
"glm-4-long": 0.001 * RMB,
|
||||
"glm-4-flash": 0,
|
||||
"glm-4v-plus": 0.01 * RMB,
|
||||
"qwen-turbo": 0.8572, // ¥0.012 / 1k tokens
|
||||
"qwen-plus": 10, // ¥0.14 / 1k tokens
|
||||
"text-embedding-v1": 0.05, // ¥0.0007 / 1k tokens
|
||||
"SparkDesk-v1.1": 1.2858, // ¥0.018 / 1k tokens
|
||||
"SparkDesk-v2.1": 1.2858, // ¥0.018 / 1k tokens
|
||||
"SparkDesk-v3.1": 1.2858, // ¥0.018 / 1k tokens
|
||||
"SparkDesk-v3.5": 1.2858, // ¥0.018 / 1k tokens
|
||||
"SparkDesk-v4.0": 1.2858,
|
||||
"hunyuan": 7.143, // ¥0.1 / 1k tokens // https://cloud.tencent.com/document/product/1729/97731#e0e6be58-60c8-469f-bdeb-6c264ce3b4d0
|
||||
"gpt-4-gizmo-*": 15,
|
||||
"gpt-4o-gizmo-*": 2.5,
|
||||
"gpt-4-all": 15,
|
||||
"gpt-4o-all": 15,
|
||||
"gpt-4": 15,
|
||||
"gpt-4-0613": 15,
|
||||
"gpt-4-32k": 30,
|
||||
"gpt-4-32k-0613": 30,
|
||||
"gpt-4-1106-preview": 5, // $10 / 1M tokens
|
||||
"gpt-4-0125-preview": 5, // $10 / 1M tokens
|
||||
"gpt-4-turbo-preview": 5, // $10 / 1M tokens
|
||||
"gpt-4-vision-preview": 5, // $10 / 1M tokens
|
||||
"gpt-4-1106-vision-preview": 5, // $10 / 1M tokens
|
||||
"chatgpt-4o-latest": 2.5, // $5 / 1M tokens
|
||||
"gpt-4o": 1.25, // $2.5 / 1M tokens
|
||||
"gpt-4o-audio-preview": 1.25, // $2.5 / 1M tokens
|
||||
"gpt-4o-audio-preview-2024-10-01": 1.25, // $2.5 / 1M tokens
|
||||
"gpt-4o-2024-05-13": 2.5, // $5 / 1M tokens
|
||||
"gpt-4o-2024-08-06": 1.25, // $2.5 / 1M tokens
|
||||
"gpt-4o-2024-11-20": 1.25, // $2.5 / 1M tokens
|
||||
"gpt-4o-realtime-preview": 2.5,
|
||||
"gpt-4o-realtime-preview-2024-10-01": 2.5,
|
||||
"gpt-4o-realtime-preview-2024-12-17": 2.5,
|
||||
"gpt-4o-mini-realtime-preview": 0.3,
|
||||
"gpt-4o-mini-realtime-preview-2024-12-17": 0.3,
|
||||
"gpt-4.1": 1.0, // $2 / 1M tokens
|
||||
"gpt-4.1-2025-04-14": 1.0, // $2 / 1M tokens
|
||||
"gpt-4.1-mini": 0.2, // $0.4 / 1M tokens
|
||||
"gpt-4.1-mini-2025-04-14": 0.2, // $0.4 / 1M tokens
|
||||
"gpt-4.1-nano": 0.05, // $0.1 / 1M tokens
|
||||
"gpt-4.1-nano-2025-04-14": 0.05, // $0.1 / 1M tokens
|
||||
"gpt-image-1": 2.5, // $5 / 1M tokens
|
||||
"o1": 7.5, // $15 / 1M tokens
|
||||
"o1-2024-12-17": 7.5, // $15 / 1M tokens
|
||||
"o1-preview": 7.5, // $15 / 1M tokens
|
||||
"o1-preview-2024-09-12": 7.5, // $15 / 1M tokens
|
||||
"o1-mini": 0.55, // $1.1 / 1M tokens
|
||||
"o1-mini-2024-09-12": 0.55, // $1.1 / 1M tokens
|
||||
"o1-pro": 75.0, // $150 / 1M tokens
|
||||
"o1-pro-2025-03-19": 75.0, // $150 / 1M tokens
|
||||
"o3-mini": 0.55,
|
||||
"o3-mini-2025-01-31": 0.55,
|
||||
"o3-mini-high": 0.55,
|
||||
"o3-mini-2025-01-31-high": 0.55,
|
||||
"o3-mini-low": 0.55,
|
||||
"o3-mini-2025-01-31-low": 0.55,
|
||||
"o3-mini-medium": 0.55,
|
||||
"o3-mini-2025-01-31-medium": 0.55,
|
||||
"o3": 1.0, // $2 / 1M tokens
|
||||
"o3-2025-04-16": 1.0, // $2 / 1M tokens
|
||||
"o3-pro": 10.0, // $20 / 1M tokens
|
||||
"o3-pro-2025-06-10": 10.0, // $20 / 1M tokens
|
||||
"o3-deep-research": 5.0, // $10 / 1M tokens
|
||||
"o3-deep-research-2025-06-26": 5.0, // $10 / 1M tokens
|
||||
"o4-mini": 0.55, // $1.1 / 1M tokens
|
||||
"o4-mini-2025-04-16": 0.55, // $1.1 / 1M tokens
|
||||
"o4-mini-deep-research": 1.0, // $2 / 1M tokens
|
||||
"o4-mini-deep-research-2025-06-26": 1.0, // $2 / 1M tokens
|
||||
"gpt-4o-mini": 0.075,
|
||||
"gpt-4o-mini-2024-07-18": 0.075,
|
||||
"gpt-4-turbo": 5, // $0.01 / 1K tokens
|
||||
"gpt-4-turbo-2024-04-09": 5, // $0.01 / 1K tokens
|
||||
"gpt-4.5-preview": 37.5,
|
||||
"gpt-4.5-preview-2025-02-27": 37.5,
|
||||
"gpt-5": 0.625,
|
||||
"gpt-5-2025-08-07": 0.625,
|
||||
"gpt-5-chat-latest": 0.625,
|
||||
"gpt-5-mini": 0.125,
|
||||
"gpt-5-mini-2025-08-07": 0.125,
|
||||
"gpt-5-nano": 0.025,
|
||||
"gpt-5-nano-2025-08-07": 0.025,
|
||||
"gpt-5.5": 2.5, // $5 / 1M tokens
|
||||
"gpt-5.6-sol": 2.5,
|
||||
"gpt-5.6-terra": 1.25,
|
||||
"gpt-5.6-luna": 0.5,
|
||||
"gpt-3.5-turbo": 0.25,
|
||||
"gpt-3.5-turbo-0613": 0.75,
|
||||
"gpt-3.5-turbo-16k": 1.5, // $0.003 / 1K tokens
|
||||
"gpt-3.5-turbo-16k-0613": 1.5,
|
||||
"gpt-3.5-turbo-instruct": 0.75, // $0.0015 / 1K tokens
|
||||
"gpt-3.5-turbo-1106": 0.5, // $0.001 / 1K tokens
|
||||
"gpt-3.5-turbo-0125": 0.25,
|
||||
"text-ada-001": 0.2,
|
||||
"text-babbage-001": 0.25,
|
||||
"text-curie-001": 1,
|
||||
"text-davinci-edit-001": 10,
|
||||
"code-davinci-edit-001": 10,
|
||||
"whisper-1": 15, // $0.006 / minute -> $0.006 / 150 words -> $0.006 / 200 tokens -> $0.03 / 1k tokens
|
||||
"tts-1": 7.5, // 1k characters -> $0.015
|
||||
"tts-1-1106": 7.5, // 1k characters -> $0.015
|
||||
"tts-1-hd": 15, // 1k characters -> $0.03
|
||||
"tts-1-hd-1106": 15, // 1k characters -> $0.03
|
||||
"davinci": 10,
|
||||
"curie": 10,
|
||||
"text-embedding-3-small": 0.01,
|
||||
"text-embedding-3-large": 0.065,
|
||||
"text-embedding-ada-002": 0.05,
|
||||
"text-search-ada-doc-001": 10,
|
||||
"text-moderation-stable": 0.1,
|
||||
"text-moderation-latest": 0.1,
|
||||
"claude-3-haiku-20240307": 0.125, // $0.25 / 1M tokens
|
||||
"claude-3-5-haiku-20241022": 0.5, // $1 / 1M tokens
|
||||
"claude-haiku-4-5-20251001": 0.5, // $1 / 1M tokens
|
||||
"claude-3-sonnet-20240229": 1.5, // $3 / 1M tokens
|
||||
"claude-3-5-sonnet-20240620": 1.5,
|
||||
"claude-3-5-sonnet-20241022": 1.5,
|
||||
"claude-3-7-sonnet-20250219": 1.5,
|
||||
"claude-3-7-sonnet-20250219-thinking": 1.5,
|
||||
"claude-sonnet-4-20250514": 1.5,
|
||||
"claude-sonnet-4-5-20250929": 1.5,
|
||||
"claude-opus-4-5-20251101": 2.5,
|
||||
"claude-opus-4-6": 2.5,
|
||||
"claude-opus-4-6-max": 2.5,
|
||||
"claude-opus-4-6-high": 2.5,
|
||||
"claude-opus-4-6-medium": 2.5,
|
||||
"claude-opus-4-6-low": 2.5,
|
||||
"claude-opus-4-7": 2.5,
|
||||
"claude-opus-4-7-max": 2.5,
|
||||
"claude-opus-4-7-xhigh": 2.5,
|
||||
"claude-opus-4-7-high": 2.5,
|
||||
"claude-opus-4-7-medium": 2.5,
|
||||
"claude-opus-4-7-low": 2.5,
|
||||
"claude-opus-4-8": 2.5,
|
||||
"claude-opus-4-8-max": 2.5,
|
||||
"claude-opus-4-8-xhigh": 2.5,
|
||||
"claude-opus-4-8-high": 2.5,
|
||||
"claude-opus-4-8-medium": 2.5,
|
||||
"claude-opus-4-8-low": 2.5,
|
||||
"claude-3-opus-20240229": 7.5, // $15 / 1M tokens
|
||||
"claude-opus-4-20250514": 7.5,
|
||||
"claude-opus-4-1-20250805": 7.5,
|
||||
"ERNIE-4.0-8K": 0.120 * RMB,
|
||||
"ERNIE-3.5-8K": 0.012 * RMB,
|
||||
"ERNIE-3.5-8K-0205": 0.024 * RMB,
|
||||
"ERNIE-3.5-8K-1222": 0.012 * RMB,
|
||||
"ERNIE-Bot-8K": 0.024 * RMB,
|
||||
"ERNIE-3.5-4K-0205": 0.012 * RMB,
|
||||
"ERNIE-Speed-8K": 0.004 * RMB,
|
||||
"ERNIE-Speed-128K": 0.004 * RMB,
|
||||
"ERNIE-Lite-8K-0922": 0.008 * RMB,
|
||||
"ERNIE-Lite-8K-0308": 0.003 * RMB,
|
||||
"ERNIE-Tiny-8K": 0.001 * RMB,
|
||||
"BLOOMZ-7B": 0.004 * RMB,
|
||||
"Embedding-V1": 0.002 * RMB,
|
||||
"bge-large-zh": 0.002 * RMB,
|
||||
"bge-large-en": 0.002 * RMB,
|
||||
"tao-8k": 0.002 * RMB,
|
||||
"PaLM-2": 1,
|
||||
"gemini-1.5-pro-latest": 1.25, // $3.5 / 1M tokens
|
||||
"gemini-1.5-flash-latest": 0.075,
|
||||
"gemini-2.0-flash": 0.05,
|
||||
"gemini-2.5-pro-exp-03-25": 0.625,
|
||||
"gemini-2.5-pro-preview-03-25": 0.625,
|
||||
"gemini-2.5-pro": 0.625,
|
||||
"gemini-2.5-flash-preview-04-17": 0.075,
|
||||
"gemini-2.5-flash-preview-04-17-thinking": 0.075,
|
||||
"gemini-2.5-flash-preview-05-20": 0.075,
|
||||
"gemini-2.5-flash-preview-05-20-thinking": 0.075,
|
||||
"gemini-2.5-flash-thinking-*": 0.075, // 用于为后续所有2.5 flash thinking budget 模型设置默认倍率
|
||||
"gemini-2.5-pro-thinking-*": 0.625, // 用于为后续所有2.5 pro thinking budget 模型设置默认倍率
|
||||
"gemini-2.5-flash-lite-preview-thinking-*": 0.05,
|
||||
"gemini-2.5-flash-lite-preview-06-17": 0.05,
|
||||
"gemini-2.5-flash": 0.15,
|
||||
"gemini-robotics-er-1.5-preview": 0.15,
|
||||
"gemini-embedding-001": 0.075,
|
||||
"text-embedding-004": 0.001,
|
||||
"chatglm_turbo": 0.3572, // ¥0.005 / 1k tokens
|
||||
"chatglm_pro": 0.7143, // ¥0.01 / 1k tokens
|
||||
"chatglm_std": 0.3572, // ¥0.005 / 1k tokens
|
||||
"chatglm_lite": 0.1429, // ¥0.002 / 1k tokens
|
||||
"glm-4": 7.143, // ¥0.1 / 1k tokens
|
||||
"glm-4v": 0.05 * RMB, // ¥0.05 / 1k tokens
|
||||
"glm-4-alltools": 0.1 * RMB, // ¥0.1 / 1k tokens
|
||||
"glm-3-turbo": 0.3572,
|
||||
"glm-4-plus": 0.05 * RMB,
|
||||
"glm-4-0520": 0.1 * RMB,
|
||||
"glm-4-air": 0.001 * RMB,
|
||||
"glm-4-airx": 0.01 * RMB,
|
||||
"glm-4-long": 0.001 * RMB,
|
||||
"glm-4-flash": 0,
|
||||
"glm-4v-plus": 0.01 * RMB,
|
||||
"qwen-turbo": 0.8572, // ¥0.012 / 1k tokens
|
||||
"qwen-plus": 10, // ¥0.14 / 1k tokens
|
||||
"text-embedding-v1": 0.05, // ¥0.0007 / 1k tokens
|
||||
"SparkDesk-v1.1": 1.2858, // ¥0.018 / 1k tokens
|
||||
"SparkDesk-v2.1": 1.2858, // ¥0.018 / 1k tokens
|
||||
"SparkDesk-v3.1": 1.2858, // ¥0.018 / 1k tokens
|
||||
"SparkDesk-v3.5": 1.2858, // ¥0.018 / 1k tokens
|
||||
"SparkDesk-v4.0": 1.2858,
|
||||
"hunyuan": 7.143, // ¥0.1 / 1k tokens // https://cloud.tencent.com/document/product/1729/97731#e0e6be58-60c8-469f-bdeb-6c264ce3b4d0
|
||||
// https://platform.lingyiwanwu.com/docs#-计费单元
|
||||
// 已经按照 7.2 来换算美元价格
|
||||
"yi-34b-chat-0205": 0.18,
|
||||
@@ -693,9 +694,23 @@ func GetAudioCompletionRatioCopy() map[string]float64 {
|
||||
return audioCompletionRatioMap.ReadAll()
|
||||
}
|
||||
|
||||
// RoutingMatchModelName returns the name used for channel-ability and token-limit
|
||||
// fallback matching: strip @ modifiers and legacy aliases first, then apply
|
||||
// wildcard normalization.
|
||||
func RoutingMatchModelName(name string) string {
|
||||
return FormatMatchingModelName(hostreasoning.BaseModelName(name))
|
||||
}
|
||||
|
||||
// HasConfiguredModelRatio reports whether name has an explicit ratio entry
|
||||
// after wildcard normalization. Self-use fallback does not count.
|
||||
func HasConfiguredModelRatio(name string) bool {
|
||||
name = FormatMatchingModelName(name)
|
||||
_, ok := modelRatioMap.Get(name)
|
||||
return ok
|
||||
}
|
||||
|
||||
// 转换模型名,减少渠道必须配置各种带参数模型
|
||||
func FormatMatchingModelName(name string) string {
|
||||
|
||||
if strings.HasPrefix(name, "gemini-2.5-flash-lite") {
|
||||
name = handleThinkingBudgetModel(name, "gemini-2.5-flash-lite", "gemini-2.5-flash-lite-thinking-*")
|
||||
} else if strings.HasPrefix(name, "gemini-2.5-flash") {
|
||||
|
||||
+208
-2
@@ -4,6 +4,8 @@
|
||||
package reasoning
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
kitreasoning "github.com/QuantumNous/new-api/relaykit/relayconvert/reasoning"
|
||||
"github.com/QuantumNous/new-api/setting/model_setting"
|
||||
)
|
||||
@@ -20,8 +22,212 @@ var (
|
||||
TrimGeminiThinkingSuffix = kitreasoning.TrimGeminiThinkingSuffix
|
||||
)
|
||||
|
||||
// ParseOpenAIReasoningEffortFromModelSuffix applies the host effort-tail
|
||||
// whitelist so real model IDs such as qwen-max are not treated as aliases.
|
||||
// ParseOpenAIReasoningEffortFromModelSuffix applies RelayKit's positive family
|
||||
// whitelist and the host EffortTailModelIDs escape hatch so real model IDs
|
||||
// such as gpt-5.1-codex-max remain opaque.
|
||||
func ParseOpenAIReasoningEffortFromModelSuffix(modelName string) (string, string) {
|
||||
return kitreasoning.ParseOpenAIReasoningEffortFromModelSuffix(modelName, model_setting.ShouldPreserveEffortTail)
|
||||
}
|
||||
|
||||
// ParseLegacyModelSuffix parses the old naked aliases only for positively
|
||||
// matched GPT/o-series, Claude, and Gemini model families. The provider prefix
|
||||
// before the final path segment is kept opaque.
|
||||
func ParseLegacyModelSuffix(modelName string, allowClaudeThinkingAlias bool, allowGeminiThinkingAlias bool) (string, kitreasoning.Intent, bool, error) {
|
||||
prefix, bare := splitModelNamespace(modelName)
|
||||
|
||||
var (
|
||||
base string
|
||||
intent kitreasoning.Intent
|
||||
found bool
|
||||
err error
|
||||
)
|
||||
switch {
|
||||
case strings.HasPrefix(bare, "claude-"):
|
||||
base, intent, found, err = kitreasoning.ParseClaudeModelSuffix(bare, allowClaudeThinkingAlias)
|
||||
case strings.HasPrefix(bare, "gemini-"):
|
||||
base, intent, found, err = kitreasoning.ParseGeminiModelSuffix(bare, allowGeminiThinkingAlias)
|
||||
default:
|
||||
effort, openAIBase := ParseOpenAIReasoningEffortFromModelSuffix(bare)
|
||||
if effort == "" {
|
||||
return modelName, kitreasoning.Intent{}, false, nil
|
||||
}
|
||||
parsedEffort, parseErr := kitreasoning.ParseEffort(effort)
|
||||
if parseErr != nil {
|
||||
return modelName, kitreasoning.Intent{}, false, parseErr
|
||||
}
|
||||
mode := kitreasoning.ModeEnabled
|
||||
if parsedEffort == kitreasoning.EffortNone {
|
||||
mode = kitreasoning.ModeDisabled
|
||||
}
|
||||
base = openAIBase
|
||||
intent = kitreasoning.Intent{Mode: mode, Effort: parsedEffort, Source: kitreasoning.SourceSuffix}
|
||||
found = true
|
||||
}
|
||||
if err != nil || !found {
|
||||
return modelName, kitreasoning.Intent{}, false, err
|
||||
}
|
||||
return prefix + base, intent, true, nil
|
||||
}
|
||||
|
||||
// BaseModelName strips explicit model modifiers and any enabled legacy alias.
|
||||
// Names on the thinking-suffix blacklist stay verbatim, including @ tails.
|
||||
// Malformed legacy aliases stay intact so request conversion can report the
|
||||
// precise validation error later.
|
||||
func BaseModelName(modelName string) string {
|
||||
if model_setting.ShouldPreserveThinkingSuffix(modelName) {
|
||||
return modelName
|
||||
}
|
||||
base := kitreasoning.ParseModelModifiers(modelName).Base
|
||||
if model_setting.ShouldPreserveThinkingSuffix(base) {
|
||||
return base
|
||||
}
|
||||
legacyBase, _, found, err := ParseLegacyModelSuffix(
|
||||
base,
|
||||
model_setting.GetClaudeSettings().ThinkingAdapterEnabled,
|
||||
model_setting.GetGeminiSettings().ThinkingAdapterEnabled,
|
||||
)
|
||||
if err != nil {
|
||||
return base
|
||||
}
|
||||
if found {
|
||||
return legacyBase
|
||||
}
|
||||
return base
|
||||
}
|
||||
|
||||
func splitModelNamespace(modelName string) (string, string) {
|
||||
if slash := strings.LastIndex(modelName, "/"); slash >= 0 {
|
||||
return modelName[:slash+1], modelName[slash+1:]
|
||||
}
|
||||
return "", modelName
|
||||
}
|
||||
|
||||
// CanonicalBillingModelNames returns specificity-descending canonical billing
|
||||
// name candidates (without the raw request name or the bare base). Explicit
|
||||
// @ modifiers and legacy aliases normalize through the same Intent, so order,
|
||||
// duplicates, and case do not matter. Temperature and topp never appear.
|
||||
func CanonicalBillingModelNames(modelName string) []string {
|
||||
if model_setting.ShouldPreserveThinkingSuffix(modelName) {
|
||||
return nil
|
||||
}
|
||||
spec := kitreasoning.ParseModelModifiers(modelName)
|
||||
base := spec.Base
|
||||
intent, hasThinking := billingIntentFromModifiers(spec)
|
||||
|
||||
if !model_setting.ShouldPreserveThinkingSuffix(base) {
|
||||
legacyBase, legacyIntent, found, err := ParseLegacyModelSuffix(
|
||||
base,
|
||||
model_setting.GetClaudeSettings().ThinkingAdapterEnabled,
|
||||
model_setting.GetGeminiSettings().ThinkingAdapterEnabled,
|
||||
)
|
||||
if err == nil && found {
|
||||
base = legacyBase
|
||||
if !hasThinking {
|
||||
intent = legacyIntent
|
||||
hasThinking = true
|
||||
}
|
||||
}
|
||||
}
|
||||
if !hasThinking {
|
||||
return nil
|
||||
}
|
||||
return canonicalNamesFromIntent(base, intent)
|
||||
}
|
||||
|
||||
func billingIntentFromModifiers(spec kitreasoning.ModelModifierSpec) (kitreasoning.Intent, bool) {
|
||||
last := make(map[string]int, len(spec.Modifiers))
|
||||
for index, modifier := range spec.Modifiers {
|
||||
last[modifier.Key] = index
|
||||
}
|
||||
|
||||
var (
|
||||
intent kitreasoning.Intent
|
||||
hasThinking bool
|
||||
)
|
||||
for index, modifier := range spec.Modifiers {
|
||||
if last[modifier.Key] != index {
|
||||
continue
|
||||
}
|
||||
switch modifier.Key {
|
||||
case "thinking":
|
||||
parsed, ok := kitreasoning.ParseThinkingModifier(modifier.Value)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
if hasThinking && parsed.Mode != kitreasoning.ModeDisabled && parsed.BudgetTokens == nil {
|
||||
intent.Mode = parsed.Mode
|
||||
intent.Source = kitreasoning.SourceSuffix
|
||||
} else if hasThinking && parsed.Mode != kitreasoning.ModeDisabled {
|
||||
intent.Mode = parsed.Mode
|
||||
intent.BudgetTokens = parsed.BudgetTokens
|
||||
intent.BudgetSource = parsed.BudgetSource
|
||||
intent.Source = kitreasoning.SourceSuffix
|
||||
} else {
|
||||
intent = parsed
|
||||
}
|
||||
hasThinking = true
|
||||
case "effort":
|
||||
effort, err := kitreasoning.ParseEffort(modifier.Value)
|
||||
if err != nil || effort == "" {
|
||||
continue
|
||||
}
|
||||
if effort == kitreasoning.EffortNone {
|
||||
intent = kitreasoning.Intent{Mode: kitreasoning.ModeDisabled, Effort: kitreasoning.EffortNone, Source: kitreasoning.SourceSuffix}
|
||||
} else {
|
||||
if intent.Mode == kitreasoning.ModeUnset || intent.Mode == kitreasoning.ModeDisabled {
|
||||
intent.Mode = kitreasoning.ModeEnabled
|
||||
}
|
||||
intent.Effort = effort
|
||||
intent.Source = kitreasoning.SourceSuffix
|
||||
}
|
||||
hasThinking = true
|
||||
}
|
||||
}
|
||||
return intent, hasThinking
|
||||
}
|
||||
|
||||
func canonicalNamesFromIntent(base string, intent kitreasoning.Intent) []string {
|
||||
thinking, effort, ok := normalizeBillingThinking(intent)
|
||||
if !ok || base == "" {
|
||||
return nil
|
||||
}
|
||||
|
||||
var names []string
|
||||
if effort != "" {
|
||||
names = append(names, base+"@effort:"+effort+"@thinking:"+thinking)
|
||||
}
|
||||
thinkingForm := base + "@thinking:" + thinking
|
||||
if thinkingForm != base {
|
||||
names = append(names, thinkingForm)
|
||||
}
|
||||
|
||||
seen := make(map[string]struct{}, len(names))
|
||||
out := make([]string, 0, len(names))
|
||||
for _, name := range names {
|
||||
if name == "" || name == base {
|
||||
continue
|
||||
}
|
||||
if _, exists := seen[name]; exists {
|
||||
continue
|
||||
}
|
||||
seen[name] = struct{}{}
|
||||
out = append(out, name)
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
func normalizeBillingThinking(intent kitreasoning.Intent) (thinking string, effort string, ok bool) {
|
||||
if intent.Effort == kitreasoning.EffortNone || intent.Mode == kitreasoning.ModeDisabled {
|
||||
return "off", "", true
|
||||
}
|
||||
if intent.BudgetTokens != nil && *intent.BudgetTokens == 0 {
|
||||
return "off", "", true
|
||||
}
|
||||
if intent.Effort != "" && intent.Effort != kitreasoning.EffortNone {
|
||||
return "on", strings.ToLower(string(intent.Effort)), true
|
||||
}
|
||||
if intent.Mode == kitreasoning.ModeEnabled || intent.Mode == kitreasoning.ModeAdaptive || intent.BudgetTokens != nil {
|
||||
return "on", "", true
|
||||
}
|
||||
return "", "", false
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
package reasoning
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/QuantumNous/new-api/setting/model_setting"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestCanonicalBillingModelNames(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
in string
|
||||
want []string
|
||||
}{
|
||||
{
|
||||
name: "thinking on",
|
||||
in: "qwen3-max@thinking:on",
|
||||
want: []string{"qwen3-max@thinking:on"},
|
||||
},
|
||||
{
|
||||
name: "shuffled temperature and thinking",
|
||||
in: "qwen3-max@temperature:0.2@thinking:on",
|
||||
want: []string{"qwen3-max@thinking:on"},
|
||||
},
|
||||
{
|
||||
name: "thinking first then temperature",
|
||||
in: "qwen3-max@thinking:on@temperature:0.2",
|
||||
want: []string{"qwen3-max@thinking:on"},
|
||||
},
|
||||
{
|
||||
name: "budget normalizes to on",
|
||||
in: "qwen3-max@thinking:8192",
|
||||
want: []string{"qwen3-max@thinking:on"},
|
||||
},
|
||||
{
|
||||
name: "minus one normalizes to on",
|
||||
in: "qwen3-max@thinking:-1",
|
||||
want: []string{"qwen3-max@thinking:on"},
|
||||
},
|
||||
{
|
||||
name: "adaptive normalizes to on",
|
||||
in: "qwen3-max@thinking:adaptive",
|
||||
want: []string{"qwen3-max@thinking:on"},
|
||||
},
|
||||
{
|
||||
name: "thinking off",
|
||||
in: "qwen3-max@thinking:off",
|
||||
want: []string{"qwen3-max@thinking:off"},
|
||||
},
|
||||
{
|
||||
name: "effort none becomes thinking off",
|
||||
in: "qwen3-max@effort:none",
|
||||
want: []string{"qwen3-max@thinking:off"},
|
||||
},
|
||||
{
|
||||
name: "effort high implies thinking on",
|
||||
in: "qwen3-max@effort:high",
|
||||
want: []string{"qwen3-max@effort:high@thinking:on", "qwen3-max@thinking:on"},
|
||||
},
|
||||
{
|
||||
name: "effort and thinking keys sorted",
|
||||
in: "qwen3-max@thinking:on@effort:high@temperature:0.2",
|
||||
want: []string{"qwen3-max@effort:high@thinking:on", "qwen3-max@thinking:on"},
|
||||
},
|
||||
{
|
||||
name: "duplicate last wins then normalize",
|
||||
in: "qwen3-max@thinking:off@thinking:on@effort:low@effort:high",
|
||||
want: []string{"qwen3-max@effort:high@thinking:on", "qwen3-max@thinking:on"},
|
||||
},
|
||||
{
|
||||
name: "legacy thinking alias",
|
||||
in: "claude-3-7-sonnet-thinking",
|
||||
want: []string{"claude-3-7-sonnet@thinking:on"},
|
||||
},
|
||||
{
|
||||
name: "legacy thinking budget matches explicit budget",
|
||||
in: "gemini-2.5-flash-thinking-8192",
|
||||
want: []string{"gemini-2.5-flash@thinking:on"},
|
||||
},
|
||||
{
|
||||
name: "legacy nothinking",
|
||||
in: "claude-3-7-sonnet-nothinking",
|
||||
want: []string{"claude-3-7-sonnet@thinking:off"},
|
||||
},
|
||||
{
|
||||
name: "temperature only has no reasoning state",
|
||||
in: "qwen3-max@temperature:0.7",
|
||||
want: nil,
|
||||
},
|
||||
}
|
||||
|
||||
geminiSettings := model_setting.GetGeminiSettings()
|
||||
oldGemini := geminiSettings.ThinkingAdapterEnabled
|
||||
geminiSettings.ThinkingAdapterEnabled = true
|
||||
t.Cleanup(func() { geminiSettings.ThinkingAdapterEnabled = oldGemini })
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
assert.Equal(t, tt.want, CanonicalBillingModelNames(tt.in))
|
||||
})
|
||||
}
|
||||
|
||||
assert.Equal(t,
|
||||
CanonicalBillingModelNames("gemini-2.5-flash@thinking:8192"),
|
||||
CanonicalBillingModelNames("gemini-2.5-flash-thinking-8192"),
|
||||
)
|
||||
assert.Equal(t, "gpt-5.1-codex-max", BaseModelName("gpt-5.1-codex-max"))
|
||||
assert.Empty(t, CanonicalBillingModelNames("gpt-5.1-codex-max"))
|
||||
}
|
||||
|
||||
func TestParseOpenAIReasoningEffortPreservesCodexMax(t *testing.T) {
|
||||
effort, base := ParseOpenAIReasoningEffortFromModelSuffix("gpt-5.1-codex-max")
|
||||
assert.Empty(t, effort)
|
||||
assert.Equal(t, "gpt-5.1-codex-max", base)
|
||||
}
|
||||
|
||||
func TestBaseModelNameStripsModifiers(t *testing.T) {
|
||||
require.Equal(t, "qwen3-max", BaseModelName("qwen3-max@thinking:on@temperature:0.2"))
|
||||
}
|
||||
|
||||
func TestExemptAtNameIsOpaqueForBillingIdentity(t *testing.T) {
|
||||
settings := model_setting.GetGlobalSettings()
|
||||
original := append([]string(nil), settings.ThinkingModelBlacklist...)
|
||||
t.Cleanup(func() { settings.ThinkingModelBlacklist = original })
|
||||
settings.ThinkingModelBlacklist = append(original, "re:.*@sha256:.*")
|
||||
|
||||
const model = "opaque@sha256:deadbeef"
|
||||
assert.Equal(t, model, BaseModelName(model))
|
||||
assert.Empty(t, CanonicalBillingModelNames(model))
|
||||
assert.Equal(t, "kimi-k2-thinking", BaseModelName("kimi-k2-thinking"))
|
||||
assert.Empty(t, CanonicalBillingModelNames("kimi-k2-thinking"))
|
||||
}
|
||||
@@ -50,7 +50,7 @@ import { SettingsSection } from '../components/settings-section'
|
||||
import { useUpdateOption } from '../hooks/use-update-option'
|
||||
|
||||
const thinkingBlacklistExample = JSON.stringify(
|
||||
['moonshotai/kimi-k2-thinking', 'kimi-k2-thinking'],
|
||||
['moonshotai/kimi-k2-thinking', 'kimi-k2-thinking', 're:.*@sha256:.*'],
|
||||
null,
|
||||
2
|
||||
)
|
||||
@@ -230,7 +230,7 @@ export function GlobalSettingsCard({ defaultValues }: GlobalSettingsCardProps) {
|
||||
</FormControl>
|
||||
<FormDescription>
|
||||
{t(
|
||||
'Models listed here will not automatically append or remove -thinking / -nothinking suffixes.'
|
||||
'Models listed here skip automatic -thinking / -nothinking suffix handling. Matched names are also exempt from @-modifier parsing and 400 validation. Prefix an entry with re: to match the full model name as a Go regular expression, for example re:.*@sha256:.*'
|
||||
)}
|
||||
</FormDescription>
|
||||
<FormMessage />
|
||||
|
||||
@@ -672,9 +672,9 @@
|
||||
"Bind a Pancake store + product": "Bind a Pancake store + product",
|
||||
"Bind an email address to your account.": "Bind an email address to your account.",
|
||||
"Bind Email": "Bind Email",
|
||||
"Bind task plugins": "Bind task plugins",
|
||||
"Bind Telegram Account": "Bind Telegram Account",
|
||||
"Bind WeChat Account": "Bind WeChat Account",
|
||||
"Bind task plugins": "Bind task plugins",
|
||||
"Binding Information": "Binding Information",
|
||||
"Binding successful!": "Binding successful!",
|
||||
"Binding your {{provider}} account": "Binding your {{provider}} account",
|
||||
@@ -689,6 +689,7 @@
|
||||
"Blocked keywords": "Blocked keywords",
|
||||
"Blocks messages when sensitive keywords are detected.": "Blocks messages when sensitive keywords are detected.",
|
||||
"Body param": "Body param",
|
||||
"Boolean": "Boolean",
|
||||
"Border radius": "Border radius",
|
||||
"Bot Name": "Bot Name",
|
||||
"Bot Protection": "Bot Protection",
|
||||
@@ -713,9 +714,8 @@
|
||||
"Built for developers,": "Built for developers,",
|
||||
"Built-in": "Built-in",
|
||||
"Built-in Device": "Built-in Device",
|
||||
"Built-in v{{factory}} / marketplace v{{market}}": "Built-in v{{factory}} / marketplace v{{market}}",
|
||||
"Updates with the system": "Updates with the system",
|
||||
"Built-in is v{{factory}}; delete the custom version to return to it": "Built-in is v{{factory}}; delete the custom version to return to it",
|
||||
"Built-in v{{factory}} / marketplace v{{market}}": "Built-in v{{factory}} / marketplace v{{market}}",
|
||||
"Built-in: phone fingerprint/face, or Windows Hello; External: USB security key": "Built-in: phone fingerprint/face, or Windows Hello; External: USB security key",
|
||||
"by": "by",
|
||||
"By category": "By category",
|
||||
@@ -857,11 +857,13 @@
|
||||
"Choose a username": "Choose a username",
|
||||
"Choose an amount and payment method": "Choose an amount and payment method",
|
||||
"Choose and order the groups this API key will try.": "Choose and order the groups this API key will try.",
|
||||
"Choose another file": "Choose another file",
|
||||
"Choose between default expanded, compact icon-only, or full layout mode": "Choose between default expanded, compact icon-only, or full layout mode",
|
||||
"Choose between inset, floating, or standard sidebar layout": "Choose between inset, floating, or standard sidebar layout",
|
||||
"Choose between left-to-right or right-to-left site direction": "Choose between left-to-right or right-to-left site direction",
|
||||
"Choose between system preference, light mode, or dark mode": "Choose between system preference, light mode, or dark mode",
|
||||
"Choose channels to sync upstream ratio configurations from": "Choose channels to sync upstream ratio configurations from",
|
||||
"Choose file": "Choose file",
|
||||
"Choose Group": "Choose Group",
|
||||
"Choose how flow widths are calculated.": "Choose how flow widths are calculated.",
|
||||
"Choose how quota values are shown to users": "Choose how quota values are shown to users",
|
||||
@@ -1448,11 +1450,11 @@
|
||||
"Disable 2FA": "Disable 2FA",
|
||||
"Disable All": "Disable All",
|
||||
"Disable custom task plugins?": "Disable custom task plugins?",
|
||||
"Disable task plugins?": "Disable task plugins?",
|
||||
"Disable on failure": "Disable on failure",
|
||||
"Disable selected channels": "Disable selected channels",
|
||||
"Disable selected models": "Disable selected models",
|
||||
"Disable store passthrough": "Disable store passthrough",
|
||||
"Disable task plugins?": "Disable task plugins?",
|
||||
"Disable this key?": "Disable this key?",
|
||||
"Disable threshold (seconds)": "Disable threshold (seconds)",
|
||||
"Disable Two-Factor Authentication": "Disable Two-Factor Authentication",
|
||||
@@ -1530,6 +1532,7 @@
|
||||
"Drawing Logs": "Drawing Logs",
|
||||
"Drawing task polling": "Drawing task polling",
|
||||
"Drawing task records": "Drawing task records",
|
||||
"Drop a JavaScript plugin file here": "Drop a JavaScript plugin file here",
|
||||
"Dry run result": "Dry run result",
|
||||
"Duplicate": "Duplicate",
|
||||
"Duplicate group names: {{names}}": "Duplicate group names: {{names}}",
|
||||
@@ -1652,7 +1655,6 @@
|
||||
"Enable All": "Enable All",
|
||||
"Enable check-in feature": "Enable check-in feature",
|
||||
"Enable custom task plugins": "Enable custom task plugins",
|
||||
"Enable task plugins": "Enable task plugins",
|
||||
"Enable Data Dashboard": "Enable Data Dashboard",
|
||||
"Enable demo mode with limited functionality": "Enable demo mode with limited functionality",
|
||||
"Enable Discord OAuth": "Enable Discord OAuth",
|
||||
@@ -1681,6 +1683,7 @@
|
||||
"Enable SSRF Protection": "Enable SSRF Protection",
|
||||
"Enable STARTTLS": "Enable STARTTLS",
|
||||
"Enable streaming mode for the test request.": "Enable streaming mode for the test request.",
|
||||
"Enable task plugins": "Enable task plugins",
|
||||
"Enable Telegram OAuth": "Enable Telegram OAuth",
|
||||
"Enable test mode for Creem payments": "Enable test mode for Creem payments",
|
||||
"Enable this key?": "Enable this key?",
|
||||
@@ -1792,7 +1795,6 @@
|
||||
"Enterprise-grade security with comprehensive permission management": "Enterprise-grade security with comprehensive permission management",
|
||||
"Entrypoint (space separated)": "Entrypoint (space separated)",
|
||||
"Enum": "Enum",
|
||||
"Boolean": "Boolean",
|
||||
"Enum values": "Enum values",
|
||||
"Env (JSON object)": "Env (JSON object)",
|
||||
"Environment variables": "Environment variables",
|
||||
@@ -1877,6 +1879,7 @@
|
||||
"extras": "extras",
|
||||
"Factory": "Factory",
|
||||
"Factory and custom plugin behavior": "Factory and custom plugin behavior",
|
||||
"Factory and custom plugins all stop serving immediately. In-flight tasks will be handled by timeout cleanup.": "Factory and custom plugins all stop serving immediately. In-flight tasks will be handled by timeout cleanup.",
|
||||
"Factory plugins cannot be deleted or disabled individually. A custom version can override them; deleting or disabling that version restores the factory plugin. Third-party-only platforms become unavailable when their plugin is deleted or disabled.": "Factory plugins cannot be deleted or disabled individually. A custom version can override them; deleting or disabling that version restores the factory plugin. Third-party-only platforms become unavailable when their plugin is deleted or disabled.",
|
||||
"Fail Reason": "Fail Reason",
|
||||
"Fail Reason Details": "Fail Reason Details",
|
||||
@@ -2040,8 +2043,8 @@
|
||||
"Fetch available models for:": "Fetch available models for:",
|
||||
"Fetch available models from upstream": "Fetch available models from upstream",
|
||||
"Fetch from Upstream": "Fetch from Upstream",
|
||||
"Fetch Models": "Fetch Models",
|
||||
"Fetch mode": "Fetch mode",
|
||||
"Fetch Models": "Fetch Models",
|
||||
"Fetched {{count}} model(s) from upstream": "Fetched {{count}} model(s) from upstream",
|
||||
"Fetched {{count}} models": "Fetched {{count}} models",
|
||||
"Fetched in your browser and placed in the source field below for review. GitHub and gist page URLs are rewritten to their raw URL automatically.": "Fetched in your browser and placed in the source field below for review. GitHub and gist page URLs are rewritten to their raw URL automatically.",
|
||||
@@ -2879,6 +2882,7 @@
|
||||
"Models exposed by this channel": "Models exposed by this channel",
|
||||
"Models fetched successfully": "Models fetched successfully",
|
||||
"Models filled to form": "Models filled to form",
|
||||
"Models listed here skip automatic -thinking / -nothinking suffix handling. Matched names are also exempt from @-modifier parsing and 400 validation. Prefix an entry with re: to match the full model name as a Go regular expression, for example re:.*@sha256:.*": "Models listed here skip automatic -thinking / -nothinking suffix handling. Matched names are also exempt from @-modifier parsing and 400 validation. Prefix an entry with re: to match the full model name as a Go regular expression, for example re:.*@sha256:.*",
|
||||
"Models listed here will not automatically append or remove -thinking / -nothinking suffixes.": "Models listed here will not automatically append or remove -thinking / -nothinking suffixes.",
|
||||
"Models losing positions": "Models losing positions",
|
||||
"Models losing the most positions": "Models losing the most positions",
|
||||
@@ -2964,9 +2968,9 @@
|
||||
"Native Claude Messages plus OpenAI Chat compatibility forwarding.": "Native Claude Messages plus OpenAI Chat compatibility forwarding.",
|
||||
"Native format": "Native format",
|
||||
"Native forwarding": "Native forwarding",
|
||||
"Native routes": "Native routes",
|
||||
"Native Gemini routes plus OpenAI Chat and Responses compatibility forwarding.": "Native Gemini routes plus OpenAI Chat and Responses compatibility forwarding.",
|
||||
"Native OpenAI routes plus optional Claude and Gemini compatibility routes.": "Native OpenAI routes plus optional Claude and Gemini compatibility routes.",
|
||||
"Native routes": "Native routes",
|
||||
"Need a redemption code?": "Need a redemption code?",
|
||||
"Needs API key": "Needs API key",
|
||||
"Nested JSON defining per-group rules for adding (+:), removing (-:), or appending usable groups.": "Nested JSON defining per-group rules for adding (+:), removing (-:), or appending usable groups.",
|
||||
@@ -3334,6 +3338,7 @@
|
||||
"Optional JSON policy to restrict access based on user info fields": "Optional JSON policy to restrict access based on user info fields",
|
||||
"Optional minimum recharge amount for this method.": "Optional minimum recharge amount for this method.",
|
||||
"Optional multiplier per user group used when calculating recharge pricing. Provide a JSON object such as": "Optional multiplier per user group used when calculating recharge pricing. Provide a JSON object such as",
|
||||
"Optional note describing this version": "Optional note describing this version",
|
||||
"Optional notes about this channel": "Optional notes about this channel",
|
||||
"Optional notes about when to use this group": "Optional notes about when to use this group",
|
||||
"Optional ratio used when upstream cache hits occur.": "Optional ratio used when upstream cache hits occur.",
|
||||
@@ -3614,11 +3619,6 @@
|
||||
"Plugin key": "Plugin key",
|
||||
"Plugin metadata": "Plugin metadata",
|
||||
"Plugin source": "Plugin source",
|
||||
"Choose file": "Choose file",
|
||||
"Choose another file": "Choose another file",
|
||||
"Drop a JavaScript plugin file here": "Drop a JavaScript plugin file here",
|
||||
"Single .js file, up to 1 MiB. Its source is shown below before upload.": "Single .js file, up to 1 MiB. Its source is shown below before upload.",
|
||||
"Optional note describing this version": "Optional note describing this version",
|
||||
"Plugin source exceeds the 1 MiB limit.": "Plugin source exceeds the 1 MiB limit.",
|
||||
"Plugin uploaded successfully": "Plugin uploaded successfully",
|
||||
"Plugin version activated": "Plugin version activated",
|
||||
@@ -3639,8 +3639,8 @@
|
||||
"Pre-Consume for Free Models": "Pre-Consume for Free Models",
|
||||
"Pre-consumed": "Pre-consumed",
|
||||
"Pre-Consumed Quota": "Pre-Consumed Quota",
|
||||
"Preference saved as {{pref}}, but no active subscription. Wallet will be used automatically.": "Preference saved as {{pref}}, but no active subscription. Wallet will be used automatically.",
|
||||
"Preference saved as {{pref}}, but no active subscription. Requests will be rejected.": "Preference saved as {{pref}}, but no active subscription. Requests will be rejected.",
|
||||
"Preference saved as {{pref}}, but no active subscription. Wallet will be used automatically.": "Preference saved as {{pref}}, but no active subscription. Wallet will be used automatically.",
|
||||
"Preferences": "Preferences",
|
||||
"Prefill Group Management": "Prefill Group Management",
|
||||
"Prefill Groups": "Prefill Groups",
|
||||
@@ -4452,6 +4452,7 @@
|
||||
"Simple": "Simple",
|
||||
"Simple mode only returns message; status code and error type use system defaults.": "Simple mode only returns message; status code and error type use system defaults.",
|
||||
"Simple mode: prune objects by type, e.g. redacted_thinking.": "Simple mode: prune objects by type, e.g. redacted_thinking.",
|
||||
"Single .js file, up to 1 MiB. Its source is shown below before upload.": "Single .js file, up to 1 MiB. Its source is shown below before upload.",
|
||||
"Single Key": "Single Key",
|
||||
"Site & Branding": "Site & Branding",
|
||||
"Site Key": "Site Key",
|
||||
@@ -4679,8 +4680,8 @@
|
||||
"Task logs": "Task logs",
|
||||
"Task Logs": "Task Logs",
|
||||
"Task Plugin": "Task Plugin",
|
||||
"Task plugin setting updated": "Task plugin setting updated",
|
||||
"Task plugin *": "Task plugin *",
|
||||
"Task plugin setting updated": "Task plugin setting updated",
|
||||
"Task Plugins": "Task Plugins",
|
||||
"Task pricing": "Task pricing",
|
||||
"Task pricing not configured": "Task pricing not configured",
|
||||
@@ -4791,7 +4792,6 @@
|
||||
"Third-party plugin risk": "Third-party plugin risk",
|
||||
"Third-party source risk": "Third-party source risk",
|
||||
"Third-party-only plugins become unavailable immediately. In-flight tasks will be handled by timeout cleanup.": "Third-party-only plugins become unavailable immediately. In-flight tasks will be handled by timeout cleanup.",
|
||||
"Factory and custom plugins all stop serving immediately. In-flight tasks will be handled by timeout cleanup.": "Factory and custom plugins all stop serving immediately. In-flight tasks will be handled by timeout cleanup.",
|
||||
"This action cannot be undone.": "This action cannot be undone.",
|
||||
"This action cannot be undone. This will permanently delete your account and remove all your data from our servers.": "This action cannot be undone. This will permanently delete your account and remove all your data from our servers.",
|
||||
"This action will permanently remove 2FA protection from your account.": "This action will permanently remove 2FA protection from your account.",
|
||||
@@ -5137,6 +5137,7 @@
|
||||
"Updated successfully": "Updated successfully",
|
||||
"Updated system setting {{key}}": "Updated system setting {{key}}",
|
||||
"Updated user {{username}} (ID: {{id}})": "Updated user {{username}} (ID: {{id}})",
|
||||
"Updates with the system": "Updates with the system",
|
||||
"Updating all channel balances. This may take a while. Please refresh to see results.": "Updating all channel balances. This may take a while. Please refresh to see results.",
|
||||
"Updating...": "Updating...",
|
||||
"Upgrade {{name}}": "Upgrade {{name}}",
|
||||
@@ -5539,4 +5540,4 @@
|
||||
"Zhipu V4": "Zhipu V4",
|
||||
"Zoom": "Zoom"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -672,9 +672,9 @@
|
||||
"Bind a Pancake store + product": "Associer une boutique et un produit Pancake",
|
||||
"Bind an email address to your account.": "Associez une adresse e-mail à votre compte.",
|
||||
"Bind Email": "Lier l'e-mail",
|
||||
"Bind task plugins": "Lier des plugins de tâche",
|
||||
"Bind Telegram Account": "Lier le compte Telegram",
|
||||
"Bind WeChat Account": "Lier le compte WeChat",
|
||||
"Bind task plugins": "Lier des plugins de tâche",
|
||||
"Binding Information": "Informations de liaison",
|
||||
"Binding successful!": "Liaison réussie !",
|
||||
"Binding your {{provider}} account": "Liaison de votre compte {{provider}}",
|
||||
@@ -689,6 +689,7 @@
|
||||
"Blocked keywords": "Mots-clés bloqués",
|
||||
"Blocks messages when sensitive keywords are detected.": "Bloque les messages lorsque des mots-clés sensibles sont détectés.",
|
||||
"Body param": "Paramètre de corps",
|
||||
"Boolean": "Booléen",
|
||||
"Border radius": "Rayon de bordure",
|
||||
"Bot Name": "Nom du bot",
|
||||
"Bot Protection": "Protection des bots",
|
||||
@@ -713,9 +714,8 @@
|
||||
"Built for developers,": "Conçu pour les développeurs,",
|
||||
"Built-in": "Intégré",
|
||||
"Built-in Device": "Appareil intégré",
|
||||
"Built-in v{{factory}} / marketplace v{{market}}": "Intégré v{{factory}} / marché v{{market}}",
|
||||
"Updates with the system": "Mise à jour système",
|
||||
"Built-in is v{{factory}}; delete the custom version to return to it": "La version intégrée est v{{factory}} ; supprimez la version personnalisée pour y revenir",
|
||||
"Built-in v{{factory}} / marketplace v{{market}}": "Intégré v{{factory}} / marché v{{market}}",
|
||||
"Built-in: phone fingerprint/face, or Windows Hello; External: USB security key": "Intégré : empreinte digitale/visage du téléphone, ou Windows Hello ; Externe : clé de sécurité USB",
|
||||
"by": "par",
|
||||
"By category": "Par catégorie",
|
||||
@@ -857,11 +857,13 @@
|
||||
"Choose a username": "Choisir un nom d'utilisateur",
|
||||
"Choose an amount and payment method": "Choisir un montant et un mode de paiement",
|
||||
"Choose and order the groups this API key will try.": "Sélectionnez et ordonnez les groupes que cette clé API essaiera.",
|
||||
"Choose another file": "Choisir un autre fichier",
|
||||
"Choose between default expanded, compact icon-only, or full layout mode": "Choisissez entre le mode d'affichage étendu par défaut, compact (icône uniquement) ou complet",
|
||||
"Choose between inset, floating, or standard sidebar layout": "Choisissez entre la disposition de la barre latérale intégrée, flottante ou standard",
|
||||
"Choose between left-to-right or right-to-left site direction": "Choisissez entre la direction du site de gauche à droite ou de droite à gauche",
|
||||
"Choose between system preference, light mode, or dark mode": "Choisissez entre la préférence système, le mode clair ou le mode sombre",
|
||||
"Choose channels to sync upstream ratio configurations from": "Choisissez les canaux à partir desquels synchroniser les configurations de ratio amont",
|
||||
"Choose file": "Choisir un fichier",
|
||||
"Choose Group": "Choisir un groupe",
|
||||
"Choose how flow widths are calculated.": "Choisissez comment l'épaisseur des flux est calculée.",
|
||||
"Choose how quota values are shown to users": "Choisissez comment les valeurs de quota sont affichées aux utilisateurs",
|
||||
@@ -1448,11 +1450,11 @@
|
||||
"Disable 2FA": "Désactiver la 2FA",
|
||||
"Disable All": "Désactiver tout",
|
||||
"Disable custom task plugins?": "Désactiver les plugins personnalisés ?",
|
||||
"Disable task plugins?": "Désactiver les plugins de tâche ?",
|
||||
"Disable on failure": "Désactiver en cas d'échec",
|
||||
"Disable selected channels": "Désactiver les canaux sélectionnés",
|
||||
"Disable selected models": "Désactiver les modèles sélectionnés",
|
||||
"Disable store passthrough": "Désactiver la transmission du champ store",
|
||||
"Disable task plugins?": "Désactiver les plugins de tâche ?",
|
||||
"Disable this key?": "Désactiver cette clé ?",
|
||||
"Disable threshold (seconds)": "Seuil de désactivation (secondes)",
|
||||
"Disable Two-Factor Authentication": "Désactiver l'authentification à deux facteurs",
|
||||
@@ -1530,6 +1532,7 @@
|
||||
"Drawing Logs": "Journaux de dessin",
|
||||
"Drawing task polling": "Interrogation des tâches de dessin",
|
||||
"Drawing task records": "Historique des tâches de dessin",
|
||||
"Drop a JavaScript plugin file here": "Déposez ici un fichier de plugin JavaScript",
|
||||
"Dry run result": "Résultat de la simulation",
|
||||
"Duplicate": "Dupliquer",
|
||||
"Duplicate group names: {{names}}": "Noms de groupe en double : {{names}}",
|
||||
@@ -1652,7 +1655,6 @@
|
||||
"Enable All": "Tout activer",
|
||||
"Enable check-in feature": "Activer la fonction de connexion",
|
||||
"Enable custom task plugins": "Activer les plugins de tâches personnalisés",
|
||||
"Enable task plugins": "Activer les plugins de tâche",
|
||||
"Enable Data Dashboard": "Activer le tableau de bord des données",
|
||||
"Enable demo mode with limited functionality": "Activer le mode démo avec des fonctionnalités limitées",
|
||||
"Enable Discord OAuth": "Activer OAuth Discord",
|
||||
@@ -1681,6 +1683,7 @@
|
||||
"Enable SSRF Protection": "Activer la protection SSRF",
|
||||
"Enable STARTTLS": "Activer STARTTLS",
|
||||
"Enable streaming mode for the test request.": "Activer le mode streaming pour la requête de test.",
|
||||
"Enable task plugins": "Activer les plugins de tâche",
|
||||
"Enable Telegram OAuth": "Activer Telegram OAuth",
|
||||
"Enable test mode for Creem payments": "Activer le mode test pour les paiements Creem",
|
||||
"Enable this key?": "Activer cette clé ?",
|
||||
@@ -1792,7 +1795,6 @@
|
||||
"Enterprise-grade security with comprehensive permission management": "Sécurité de niveau entreprise avec gestion complète des autorisations",
|
||||
"Entrypoint (space separated)": "Point d'entrée (séparés par des espaces)",
|
||||
"Enum": "Énumération",
|
||||
"Boolean": "Booléen",
|
||||
"Enum values": "Valeurs de l'énumération",
|
||||
"Env (JSON object)": "Env (objet JSON)",
|
||||
"Environment variables": "Variables d'environnement",
|
||||
@@ -1877,6 +1879,7 @@
|
||||
"extras": "suppléments",
|
||||
"Factory": "Intégré",
|
||||
"Factory and custom plugin behavior": "Comportement des plugins intégrés et personnalisés",
|
||||
"Factory and custom plugins all stop serving immediately. In-flight tasks will be handled by timeout cleanup.": "Les plugins d’usine et personnalisés cessent immédiatement de servir. Les tâches en cours seront traitées par le nettoyage des délais d’attente.",
|
||||
"Factory plugins cannot be deleted or disabled individually. A custom version can override them; deleting or disabling that version restores the factory plugin. Third-party-only platforms become unavailable when their plugin is deleted or disabled.": "Les plugins intégrés ne peuvent pas être supprimés ni désactivés individuellement. Une version personnalisée peut les remplacer ; sa suppression ou désactivation restaure le plugin intégré. Une plateforme tierce devient indisponible si son plugin est supprimé ou désactivé.",
|
||||
"Fail Reason": "Raison de l'échec",
|
||||
"Fail Reason Details": "Détails de la raison de l'échec",
|
||||
@@ -2040,8 +2043,8 @@
|
||||
"Fetch available models for:": "Récupérer les modèles disponibles pour :",
|
||||
"Fetch available models from upstream": "Récupérer les modèles disponibles en amont",
|
||||
"Fetch from Upstream": "Récupérer depuis l'amont",
|
||||
"Fetch Models": "Récupérer les modèles",
|
||||
"Fetch mode": "Mode de récupération",
|
||||
"Fetch Models": "Récupérer les modèles",
|
||||
"Fetched {{count}} model(s) from upstream": "{{count}} modèle(s) récupéré(s) depuis l'amont",
|
||||
"Fetched {{count}} models": "{{count}} modèles récupérés",
|
||||
"Fetched in your browser and placed in the source field below for review. GitHub and gist page URLs are rewritten to their raw URL automatically.": "Récupéré par votre navigateur et placé dans le champ de code ci-dessous pour examen. Les URL de pages GitHub et gist sont automatiquement réécrites en URL raw.",
|
||||
@@ -2879,6 +2882,7 @@
|
||||
"Models exposed by this channel": "Modeles exposes par ce canal",
|
||||
"Models fetched successfully": "Modèles récupérés avec succès",
|
||||
"Models filled to form": "Modèles remplis pour le formulaire",
|
||||
"Models listed here skip automatic -thinking / -nothinking suffix handling. Matched names are also exempt from @-modifier parsing and 400 validation. Prefix an entry with re: to match the full model name as a Go regular expression, for example re:.*@sha256:.*": "Les modèles listés ici n'ajoutent ni ne retirent automatiquement les suffixes -thinking / -nothinking. Les noms correspondants sont aussi exemptés de l'analyse et de la validation des modificateurs @ (erreur 400). Un préfixe re: interprète l'entrée comme une expression régulière Go sur le nom complet, par exemple re:.*@sha256:.*",
|
||||
"Models listed here will not automatically append or remove -thinking / -nothinking suffixes.": "Les modèles listés ici n'ajouteront ni ne supprimeront automatiquement les suffixes -thinking / -nothinking.",
|
||||
"Models losing positions": "Modèles perdant des positions",
|
||||
"Models losing the most positions": "Modèles qui perdent le plus de places",
|
||||
@@ -2964,9 +2968,9 @@
|
||||
"Native Claude Messages plus OpenAI Chat compatibility forwarding.": "Claude Messages natif avec transfert compatible OpenAI Chat.",
|
||||
"Native format": "Format natif",
|
||||
"Native forwarding": "Transfert natif",
|
||||
"Native routes": "Routes natives",
|
||||
"Native Gemini routes plus OpenAI Chat and Responses compatibility forwarding.": "Routes Gemini natives avec transfert compatible OpenAI Chat et Responses.",
|
||||
"Native OpenAI routes plus optional Claude and Gemini compatibility routes.": "Routes OpenAI natives avec compatibilité Claude et Gemini en option.",
|
||||
"Native routes": "Routes natives",
|
||||
"Need a redemption code?": "Besoin d'un code d'échange ?",
|
||||
"Needs API key": "Clé API requise",
|
||||
"Nested JSON defining per-group rules for adding (+:), removing (-:), or appending usable groups.": "JSON imbriqué définissant des règles par groupe pour ajouter (+:), supprimer (-:), ou ajouter des groupes utilisables.",
|
||||
@@ -3334,6 +3338,7 @@
|
||||
"Optional JSON policy to restrict access based on user info fields": "Politique JSON optionnelle pour restreindre l'accès en fonction des champs d'informations utilisateur",
|
||||
"Optional minimum recharge amount for this method.": "Montant minimum de recharge optionnel pour cette méthode.",
|
||||
"Optional multiplier per user group used when calculating recharge pricing. Provide a JSON object such as": "Multiplicateur optionnel par groupe d'utilisateurs utilisé lors du calcul des prix de recharge. Fournissez un objet JSON tel que",
|
||||
"Optional note describing this version": "Note facultative décrivant cette version",
|
||||
"Optional notes about this channel": "Notes optionnelles sur ce canal",
|
||||
"Optional notes about when to use this group": "Notes optionnelles sur le moment d'utiliser ce groupe",
|
||||
"Optional ratio used when upstream cache hits occur.": "Ratio optionnel utilisé en cas de succès du cache en amont.",
|
||||
@@ -3614,11 +3619,6 @@
|
||||
"Plugin key": "Clé du plugin",
|
||||
"Plugin metadata": "Métadonnées du plugin",
|
||||
"Plugin source": "Source du plugin",
|
||||
"Choose file": "Choisir un fichier",
|
||||
"Choose another file": "Choisir un autre fichier",
|
||||
"Drop a JavaScript plugin file here": "Déposez ici un fichier de plugin JavaScript",
|
||||
"Single .js file, up to 1 MiB. Its source is shown below before upload.": "Un seul fichier .js, jusqu’à 1 Mio. Sa source est affichée ci-dessous avant l’envoi.",
|
||||
"Optional note describing this version": "Note facultative décrivant cette version",
|
||||
"Plugin source exceeds the 1 MiB limit.": "Le code du plugin dépasse la limite de 1 Mio.",
|
||||
"Plugin uploaded successfully": "Plugin importé avec succès",
|
||||
"Plugin version activated": "Version du plugin activée",
|
||||
@@ -3639,8 +3639,8 @@
|
||||
"Pre-Consume for Free Models": "Pré-consommation pour les modèles gratuits",
|
||||
"Pre-consumed": "Pré-consommé",
|
||||
"Pre-Consumed Quota": "Quota pré-consommé",
|
||||
"Preference saved as {{pref}}, but no active subscription. Wallet will be used automatically.": "Préférence enregistrée comme {{pref}}, mais aucun abonnement actif. Le portefeuille sera utilisé automatiquement.",
|
||||
"Preference saved as {{pref}}, but no active subscription. Requests will be rejected.": "Préférence enregistrée comme {{pref}}, mais aucun abonnement actif. Les demandes seront rejetées.",
|
||||
"Preference saved as {{pref}}, but no active subscription. Wallet will be used automatically.": "Préférence enregistrée comme {{pref}}, mais aucun abonnement actif. Le portefeuille sera utilisé automatiquement.",
|
||||
"Preferences": "Préférences",
|
||||
"Prefill Group Management": "Gestion des groupes de préremplissage",
|
||||
"Prefill Groups": "Groupes de préremplissage",
|
||||
@@ -4452,6 +4452,7 @@
|
||||
"Simple": "Simple",
|
||||
"Simple mode only returns message; status code and error type use system defaults.": "Le mode simple ne retourne que le message ; le code de statut et le type d'erreur utilisent les valeurs par défaut.",
|
||||
"Simple mode: prune objects by type, e.g. redacted_thinking.": "Mode simple : nettoyer les objets par type, ex. redacted_thinking.",
|
||||
"Single .js file, up to 1 MiB. Its source is shown below before upload.": "Un seul fichier .js, jusqu’à 1 Mio. Sa source est affichée ci-dessous avant l’envoi.",
|
||||
"Single Key": "Clé unique",
|
||||
"Site & Branding": "Site et marque",
|
||||
"Site Key": "Clé du site",
|
||||
@@ -4679,8 +4680,8 @@
|
||||
"Task logs": "Journaux des tâches",
|
||||
"Task Logs": "Journaux de tâches",
|
||||
"Task Plugin": "Plugin de tâche",
|
||||
"Task plugin setting updated": "Paramètre des plugins de tâche mis à jour",
|
||||
"Task plugin *": "Plugin de tâche *",
|
||||
"Task plugin setting updated": "Paramètre des plugins de tâche mis à jour",
|
||||
"Task Plugins": "Plugins de tâches",
|
||||
"Task pricing": "Tarification des tâches",
|
||||
"Task pricing not configured": "Tarification des tâches non configurée",
|
||||
@@ -4791,7 +4792,6 @@
|
||||
"Third-party plugin risk": "Risque des plugins tiers",
|
||||
"Third-party source risk": "Risque des sources tierces",
|
||||
"Third-party-only plugins become unavailable immediately. In-flight tasks will be handled by timeout cleanup.": "Les plugins tiers deviennent immédiatement indisponibles. Les tâches en cours seront gérées par le nettoyage après expiration.",
|
||||
"Factory and custom plugins all stop serving immediately. In-flight tasks will be handled by timeout cleanup.": "Les plugins d’usine et personnalisés cessent immédiatement de servir. Les tâches en cours seront traitées par le nettoyage des délais d’attente.",
|
||||
"This action cannot be undone.": "Cette action est irréversible.",
|
||||
"This action cannot be undone. This will permanently delete your account and remove all your data from our servers.": "Cette action est irréversible. Cela supprimera définitivement votre compte et toutes vos données de nos serveurs.",
|
||||
"This action will permanently remove 2FA protection from your account.": "Cette action supprimera définitivement la protection 2FA de votre compte.",
|
||||
@@ -5137,6 +5137,7 @@
|
||||
"Updated successfully": "Mise à jour réussie",
|
||||
"Updated system setting {{key}}": "Paramètre système {{key}} mis à jour",
|
||||
"Updated user {{username}} (ID: {{id}})": "Utilisateur {{username}} mis à jour (ID : {{id}})",
|
||||
"Updates with the system": "Mise à jour système",
|
||||
"Updating all channel balances. This may take a while. Please refresh to see results.": "Mise à jour de tous les soldes des canaux. Cela peut prendre un certain temps. Veuillez actualiser pour voir les résultats.",
|
||||
"Updating...": "Mise à jour...",
|
||||
"Upgrade {{name}}": "Mettre à jour {{name}}",
|
||||
@@ -5539,4 +5540,4 @@
|
||||
"Zhipu V4": "Zhipu V4",
|
||||
"Zoom": "Zoom"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -672,9 +672,9 @@
|
||||
"Bind a Pancake store + product": "Pancake のストアと商品を紐付ける",
|
||||
"Bind an email address to your account.": "アカウントにメールアドレスを紐付けます。",
|
||||
"Bind Email": "メールアドレス連携",
|
||||
"Bind task plugins": "タスクプラグインを紐付け",
|
||||
"Bind Telegram Account": "Telegram連携",
|
||||
"Bind WeChat Account": "WeChatアカウント連携",
|
||||
"Bind task plugins": "タスクプラグインを紐付け",
|
||||
"Binding Information": "連携情報",
|
||||
"Binding successful!": "紐付けが成功しました!",
|
||||
"Binding your {{provider}} account": "{{provider}} アカウントをバインド中",
|
||||
@@ -689,6 +689,7 @@
|
||||
"Blocked keywords": "ブロックされたキーワード",
|
||||
"Blocks messages when sensitive keywords are detected.": "機密性の高いキーワードが検出された場合にメッセージをブロックします。",
|
||||
"Body param": "ボディパラメータ",
|
||||
"Boolean": "真偽値",
|
||||
"Border radius": "角丸",
|
||||
"Bot Name": "ボット名",
|
||||
"Bot Protection": "ボット保護",
|
||||
@@ -713,9 +714,8 @@
|
||||
"Built for developers,": "開発者のために構築、",
|
||||
"Built-in": "組み込み",
|
||||
"Built-in Device": "内蔵デバイス",
|
||||
"Built-in v{{factory}} / marketplace v{{market}}": "組み込み v{{factory}} / マーケット v{{market}}",
|
||||
"Updates with the system": "システムとともに更新",
|
||||
"Built-in is v{{factory}}; delete the custom version to return to it": "組み込みは v{{factory}} です。カスタム版を削除すると戻ります",
|
||||
"Built-in v{{factory}} / marketplace v{{market}}": "組み込み v{{factory}} / マーケット v{{market}}",
|
||||
"Built-in: phone fingerprint/face, or Windows Hello; External: USB security key": "内蔵: 電話の指紋/顔認証、またはWindows Hello。外部: USBセキュリティキー",
|
||||
"by": "によって",
|
||||
"By category": "カテゴリ別",
|
||||
@@ -857,11 +857,13 @@
|
||||
"Choose a username": "ユーザー名を選択",
|
||||
"Choose an amount and payment method": "金額と支払い方法を選択してください",
|
||||
"Choose and order the groups this API key will try.": "この API キーが試行するグループを選択して並べ替えます。",
|
||||
"Choose another file": "別のファイルを選択",
|
||||
"Choose between default expanded, compact icon-only, or full layout mode": "デフォルトの展開表示、コンパクトなアイコンのみ、またはフルレイアウトモードから選択します",
|
||||
"Choose between inset, floating, or standard sidebar layout": "インセット、フローティング、または標準のサイドバーレイアウトから選択します",
|
||||
"Choose between left-to-right or right-to-left site direction": "左から右、または右から左のサイトの方向を選択します",
|
||||
"Choose between system preference, light mode, or dark mode": "システム設定、ライトモード、またはダークモードから選択します",
|
||||
"Choose channels to sync upstream ratio configurations from": "アップストリームの比率設定を同期するチャネルを選択してください",
|
||||
"Choose file": "ファイルを選択",
|
||||
"Choose Group": "グループを選択",
|
||||
"Choose how flow widths are calculated.": "フローの線幅をどの指標で計算するかを選択します。",
|
||||
"Choose how quota values are shown to users": "クォータ値がユーザーにどのように表示されるかを選択してください",
|
||||
@@ -1448,11 +1450,11 @@
|
||||
"Disable 2FA": "2FAを無効にする",
|
||||
"Disable All": "すべて無効にする",
|
||||
"Disable custom task plugins?": "カスタムタスクプラグインを無効化しますか?",
|
||||
"Disable task plugins?": "タスクプラグインを無効化しますか?",
|
||||
"Disable on failure": "失敗時に無効にする",
|
||||
"Disable selected channels": "選択したチャネルを無効にする",
|
||||
"Disable selected models": "選択したモデルを無効にする",
|
||||
"Disable store passthrough": "ストアパススルーを無効にする",
|
||||
"Disable task plugins?": "タスクプラグインを無効化しますか?",
|
||||
"Disable this key?": "このキーを無効にしますか?",
|
||||
"Disable threshold (seconds)": "無効化しきい値(秒)",
|
||||
"Disable Two-Factor Authentication": "二要素認証を無効にする",
|
||||
@@ -1530,6 +1532,7 @@
|
||||
"Drawing Logs": "画像生成履歴",
|
||||
"Drawing task polling": "描画タスクのポーリング",
|
||||
"Drawing task records": "描画タスク記録",
|
||||
"Drop a JavaScript plugin file here": "JavaScript プラグインファイルをここにドロップ",
|
||||
"Dry run result": "ドライラン結果",
|
||||
"Duplicate": "複製",
|
||||
"Duplicate group names: {{names}}": "重複するグループ名: {{names}}",
|
||||
@@ -1652,7 +1655,6 @@
|
||||
"Enable All": "すべて有効にする",
|
||||
"Enable check-in feature": "チェックイン機能を有効にする",
|
||||
"Enable custom task plugins": "カスタムタスクプラグインを有効化",
|
||||
"Enable task plugins": "タスクプラグインを有効化",
|
||||
"Enable Data Dashboard": "データダッシュボードを有効にする",
|
||||
"Enable demo mode with limited functionality": "機能が制限されたデモモードを有効にする",
|
||||
"Enable Discord OAuth": "Discord OAuthを有効にする",
|
||||
@@ -1681,6 +1683,7 @@
|
||||
"Enable SSRF Protection": "SSRF保護を有効にする",
|
||||
"Enable STARTTLS": "STARTTLSを有効にする",
|
||||
"Enable streaming mode for the test request.": "テストリクエストのストリーミングモードを有効にします。",
|
||||
"Enable task plugins": "タスクプラグインを有効化",
|
||||
"Enable Telegram OAuth": "Telegram OAuthを有効にする",
|
||||
"Enable test mode for Creem payments": "Creem 決済のテストモードを有効にする",
|
||||
"Enable this key?": "このキーを有効にしますか?",
|
||||
@@ -1792,7 +1795,6 @@
|
||||
"Enterprise-grade security with comprehensive permission management": "包括的な権限管理を備えたエンタープライズグレードのセキュリティ",
|
||||
"Entrypoint (space separated)": "Entrypoint (スペース区切り)",
|
||||
"Enum": "列挙",
|
||||
"Boolean": "真偽値",
|
||||
"Enum values": "列挙値",
|
||||
"Env (JSON object)": "Env (JSON オブジェクト)",
|
||||
"Environment variables": "環境変数",
|
||||
@@ -1877,6 +1879,7 @@
|
||||
"extras": "追加項目",
|
||||
"Factory": "組み込み",
|
||||
"Factory and custom plugin behavior": "組み込み版とカスタム版の動作",
|
||||
"Factory and custom plugins all stop serving immediately. In-flight tasks will be handled by timeout cleanup.": "ファクトリープラグインとカスタムプラグインは直ちに停止します。実行中のタスクはタイムアウトクリーンアップで処理されます。",
|
||||
"Factory plugins cannot be deleted or disabled individually. A custom version can override them; deleting or disabling that version restores the factory plugin. Third-party-only platforms become unavailable when their plugin is deleted or disabled.": "組み込みプラグインは個別に削除・無効化できません。カスタム版で上書きでき、その版を削除または無効化すると組み込み版に戻ります。サードパーティ専用プラットフォームはプラグインを削除または無効化すると利用できなくなります。",
|
||||
"Fail Reason": "失敗理由",
|
||||
"Fail Reason Details": "失敗理由の詳細",
|
||||
@@ -2040,8 +2043,8 @@
|
||||
"Fetch available models for:": "利用可能なモデルを取得:",
|
||||
"Fetch available models from upstream": "アップストリームから利用可能なモデルを取得する",
|
||||
"Fetch from Upstream": "Upstreamからフェッチ",
|
||||
"Fetch Models": "モデルを取得",
|
||||
"Fetch mode": "取得モード",
|
||||
"Fetch Models": "モデルを取得",
|
||||
"Fetched {{count}} model(s) from upstream": "上流から {{count}} 個のモデルを取得しました",
|
||||
"Fetched {{count}} models": "{{count}} 個のモデルを取得しました",
|
||||
"Fetched in your browser and placed in the source field below for review. GitHub and gist page URLs are rewritten to their raw URL automatically.": "ブラウザで取得し、確認用に下のソース欄へ挿入します。GitHub と gist のページ URL は自動的に raw URL へ書き換えられます。",
|
||||
@@ -2879,6 +2882,7 @@
|
||||
"Models exposed by this channel": "このチャンネルで公開するモデル",
|
||||
"Models fetched successfully": "モデルが正常に取得されました",
|
||||
"Models filled to form": "フォームにモデルが記入されました",
|
||||
"Models listed here skip automatic -thinking / -nothinking suffix handling. Matched names are also exempt from @-modifier parsing and 400 validation. Prefix an entry with re: to match the full model name as a Go regular expression, for example re:.*@sha256:.*": "ここに記載されたモデルは、-thinking / -nothinking サフィックスの自動付与・削除を行いません。一致した名前は @ 修飾子の解析および 400 バリデーションからも除外されます。re: で始まる項目は完全なモデル名に対する Go 正規表現として扱われます(例: re:.*@sha256:.*)。",
|
||||
"Models listed here will not automatically append or remove -thinking / -nothinking suffixes.": "ここに記載されたモデルは、-thinking / -nothinking サフィックスの自動付与・削除を行いません。",
|
||||
"Models losing positions": "順位を下げているモデル",
|
||||
"Models losing the most positions": "順位を最も落としているモデル",
|
||||
@@ -2964,9 +2968,9 @@
|
||||
"Native Claude Messages plus OpenAI Chat compatibility forwarding.": "Claude Messages ネイティブ転送と OpenAI Chat 互換転送。",
|
||||
"Native format": "ネイティブ形式",
|
||||
"Native forwarding": "ネイティブ転送",
|
||||
"Native routes": "ネイティブルート",
|
||||
"Native Gemini routes plus OpenAI Chat and Responses compatibility forwarding.": "Gemini ネイティブルートと OpenAI Chat / Responses 互換転送。",
|
||||
"Native OpenAI routes plus optional Claude and Gemini compatibility routes.": "OpenAI ネイティブルートと、任意の Claude / Gemini 互換ルート。",
|
||||
"Native routes": "ネイティブルート",
|
||||
"Need a redemption code?": "引き換えコードが必要ですか?",
|
||||
"Needs API key": "API キーが必要",
|
||||
"Nested JSON defining per-group rules for adding (+:), removing (-:), or appending usable groups.": "追加 (+:)、削除 (-:)、または使用可能なグループの追加を行うグループごとのルールを定義するネストされたJSON。",
|
||||
@@ -3334,6 +3338,7 @@
|
||||
"Optional JSON policy to restrict access based on user info fields": "ユーザー情報フィールドに基づいてアクセスを制限するためのオプションのJSONポリシー",
|
||||
"Optional minimum recharge amount for this method.": "この方法のオプションの最小チャージ額。",
|
||||
"Optional multiplier per user group used when calculating recharge pricing. Provide a JSON object such as": "チャージ料金を計算する際に使用されるユーザーグループごとのオプションの乗数。次のようなJSONオブジェクトを提供してください",
|
||||
"Optional note describing this version": "このバージョンを説明する任意のメモ",
|
||||
"Optional notes about this channel": "このチャネルに関するオプションのノート",
|
||||
"Optional notes about when to use this group": "このグループを使用する時期に関するオプションのメモ",
|
||||
"Optional ratio used when upstream cache hits occur.": "アップストリームキャッシュヒットが発生したときに使用されるオプションの比率。",
|
||||
@@ -3614,11 +3619,6 @@
|
||||
"Plugin key": "プラグインキー",
|
||||
"Plugin metadata": "プラグインメタデータ",
|
||||
"Plugin source": "プラグインソース",
|
||||
"Choose file": "ファイルを選択",
|
||||
"Choose another file": "別のファイルを選択",
|
||||
"Drop a JavaScript plugin file here": "JavaScript プラグインファイルをここにドロップ",
|
||||
"Single .js file, up to 1 MiB. Its source is shown below before upload.": "単一の .js ファイル、最大 1 MiB。アップロード前に下部でソースを確認できます。",
|
||||
"Optional note describing this version": "このバージョンを説明する任意のメモ",
|
||||
"Plugin source exceeds the 1 MiB limit.": "プラグインのソースが 1 MiB の上限を超えています。",
|
||||
"Plugin uploaded successfully": "プラグインをアップロードしました",
|
||||
"Plugin version activated": "プラグインバージョンを有効化しました",
|
||||
@@ -3639,8 +3639,8 @@
|
||||
"Pre-Consume for Free Models": "無料モデルの事前消費",
|
||||
"Pre-consumed": "事前消費",
|
||||
"Pre-Consumed Quota": "事前消費クォータ",
|
||||
"Preference saved as {{pref}}, but no active subscription. Wallet will be used automatically.": "設定は{{pref}}として保存されましたが、アクティブなサブスクリプションがありません。ウォレットが自動的に使用されます。",
|
||||
"Preference saved as {{pref}}, but no active subscription. Requests will be rejected.": "設定は{{pref}}として保存されましたが、アクティブなサブスクリプションがありません。リクエストは拒否されます。",
|
||||
"Preference saved as {{pref}}, but no active subscription. Wallet will be used automatically.": "設定は{{pref}}として保存されましたが、アクティブなサブスクリプションがありません。ウォレットが自動的に使用されます。",
|
||||
"Preferences": "環境設定",
|
||||
"Prefill Group Management": "プリフィルグループ管理",
|
||||
"Prefill Groups": "プリフィルグループ",
|
||||
@@ -4452,6 +4452,7 @@
|
||||
"Simple": "シンプル",
|
||||
"Simple mode only returns message; status code and error type use system defaults.": "シンプルモードはメッセージのみ返します。ステータスコードとエラータイプはシステムデフォルトを使用します。",
|
||||
"Simple mode: prune objects by type, e.g. redacted_thinking.": "シンプルモード:typeでオブジェクトを削除(例:redacted_thinking)。",
|
||||
"Single .js file, up to 1 MiB. Its source is shown below before upload.": "単一の .js ファイル、最大 1 MiB。アップロード前に下部でソースを確認できます。",
|
||||
"Single Key": "単一キー",
|
||||
"Site & Branding": "サイトとブランド",
|
||||
"Site Key": "サイトキー",
|
||||
@@ -4679,8 +4680,8 @@
|
||||
"Task logs": "タスクログ",
|
||||
"Task Logs": "タスクログ",
|
||||
"Task Plugin": "タスクプラグイン",
|
||||
"Task plugin setting updated": "タスクプラグイン設定を更新しました",
|
||||
"Task plugin *": "タスクプラグイン *",
|
||||
"Task plugin setting updated": "タスクプラグイン設定を更新しました",
|
||||
"Task Plugins": "タスクプラグイン",
|
||||
"Task pricing": "タスク料金",
|
||||
"Task pricing not configured": "タスク料金が未設定",
|
||||
@@ -4791,7 +4792,6 @@
|
||||
"Third-party plugin risk": "サードパーティプラグインのリスク",
|
||||
"Third-party source risk": "サードパーティソースのリスク",
|
||||
"Third-party-only plugins become unavailable immediately. In-flight tasks will be handled by timeout cleanup.": "サードパーティ専用プラグインは直ちに利用不可になります。処理中タスクはタイムアウト清掃で処理されます。",
|
||||
"Factory and custom plugins all stop serving immediately. In-flight tasks will be handled by timeout cleanup.": "ファクトリープラグインとカスタムプラグインは直ちに停止します。実行中のタスクはタイムアウトクリーンアップで処理されます。",
|
||||
"This action cannot be undone.": "この操作は元に戻せません。",
|
||||
"This action cannot be undone. This will permanently delete your account and remove all your data from our servers.": "この操作は元に戻せません。これにより、あなたのアカウントは完全に削除され、すべてのデータがサーバーから削除されます。",
|
||||
"This action will permanently remove 2FA protection from your account.": "この操作により、アカウントから2FA保護が完全に削除されます。",
|
||||
@@ -5137,6 +5137,7 @@
|
||||
"Updated successfully": "正常に更新されました",
|
||||
"Updated system setting {{key}}": "システム設定 {{key}} を更新しました",
|
||||
"Updated user {{username}} (ID: {{id}})": "ユーザー {{username}} を更新しました(ID: {{id}})",
|
||||
"Updates with the system": "システムとともに更新",
|
||||
"Updating all channel balances. This may take a while. Please refresh to see results.": "すべてのチャネル残高を更新中です。これには少し時間がかかる場合があります。結果を確認するには更新してください。",
|
||||
"Updating...": "更新中...",
|
||||
"Upgrade {{name}}": "{{name}} をアップグレード",
|
||||
@@ -5539,4 +5540,4 @@
|
||||
"Zhipu V4": "Zhipu V 4",
|
||||
"Zoom": "ズーム"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -672,9 +672,9 @@
|
||||
"Bind a Pancake store + product": "Привязать магазин и продукт Pancake",
|
||||
"Bind an email address to your account.": "Привяжите адрес электронной почты к вашему аккаунту.",
|
||||
"Bind Email": "Привязать Email",
|
||||
"Bind task plugins": "Привязать плагины задач",
|
||||
"Bind Telegram Account": "Привязать аккаунт Telegram",
|
||||
"Bind WeChat Account": "Привязка аккаунта WeChat",
|
||||
"Bind task plugins": "Привязать плагины задач",
|
||||
"Binding Information": "Информация о привязке",
|
||||
"Binding successful!": "Привязка успешна!",
|
||||
"Binding your {{provider}} account": "Привязка вашего аккаунта {{provider}}",
|
||||
@@ -689,6 +689,7 @@
|
||||
"Blocked keywords": "Заблокированные ключевые слова",
|
||||
"Blocks messages when sensitive keywords are detected.": "Блокирует сообщения при обнаружении конфиденциальных ключевых слов.",
|
||||
"Body param": "Параметр тела запроса",
|
||||
"Boolean": "Логический",
|
||||
"Border radius": "Радиус скругления",
|
||||
"Bot Name": "Имя бота",
|
||||
"Bot Protection": "Защита от ботов",
|
||||
@@ -713,9 +714,8 @@
|
||||
"Built for developers,": "Создано для разработчиков,",
|
||||
"Built-in": "Встроенный",
|
||||
"Built-in Device": "Встроенное устройство",
|
||||
"Built-in v{{factory}} / marketplace v{{market}}": "Встроенный v{{factory}} / магазин v{{market}}",
|
||||
"Updates with the system": "Обновляется с системой",
|
||||
"Built-in is v{{factory}}; delete the custom version to return to it": "Встроенная версия — v{{factory}}; удалите свою, чтобы вернуться к ней",
|
||||
"Built-in v{{factory}} / marketplace v{{market}}": "Встроенный v{{factory}} / магазин v{{market}}",
|
||||
"Built-in: phone fingerprint/face, or Windows Hello; External: USB security key": "Встроенное: отпечаток пальца/лицо телефона или Windows Hello; Внешнее: USB-ключ безопасности",
|
||||
"by": "от",
|
||||
"By category": "По категориям",
|
||||
@@ -857,11 +857,13 @@
|
||||
"Choose a username": "Выберите имя пользователя",
|
||||
"Choose an amount and payment method": "Выберите сумму и способ оплаты",
|
||||
"Choose and order the groups this API key will try.": "Выберите и упорядочьте группы, которые будет использовать этот API-ключ.",
|
||||
"Choose another file": "Выбрать другой файл",
|
||||
"Choose between default expanded, compact icon-only, or full layout mode": "Выберите между развернутым по умолчанию, компактным (только иконки) или полным режимом макета",
|
||||
"Choose between inset, floating, or standard sidebar layout": "Выберите между встроенным, плавающим или стандартным макетом боковой панели",
|
||||
"Choose between left-to-right or right-to-left site direction": "Выберите между направлением сайта слева направо или справа налево",
|
||||
"Choose between system preference, light mode, or dark mode": "Выберите между системными настройками, светлым режимом или темным режимом",
|
||||
"Choose channels to sync upstream ratio configurations from": "Выберите каналы для синхронизации конфигураций соотношений из вышестоящих источников",
|
||||
"Choose file": "Выбрать файл",
|
||||
"Choose Group": "Выбрать группу",
|
||||
"Choose how flow widths are calculated.": "Выберите, как рассчитывается ширина потоков.",
|
||||
"Choose how quota values are shown to users": "Выберите, как значения квоты отображаются пользователям",
|
||||
@@ -1448,11 +1450,11 @@
|
||||
"Disable 2FA": "Отключить 2FA",
|
||||
"Disable All": "Отключить все",
|
||||
"Disable custom task plugins?": "Отключить пользовательские плагины задач?",
|
||||
"Disable task plugins?": "Отключить плагины задач?",
|
||||
"Disable on failure": "Отключить при сбое",
|
||||
"Disable selected channels": "Отключить выбранные каналы",
|
||||
"Disable selected models": "Отключить выбранные модели",
|
||||
"Disable store passthrough": "Отключить сквозной переход магазина",
|
||||
"Disable task plugins?": "Отключить плагины задач?",
|
||||
"Disable this key?": "Отключить этот ключ?",
|
||||
"Disable threshold (seconds)": "Порог отключения (секунды)",
|
||||
"Disable Two-Factor Authentication": "Отключить двухфакторную аутентификацию",
|
||||
@@ -1530,6 +1532,7 @@
|
||||
"Drawing Logs": "Журнал рисования",
|
||||
"Drawing task polling": "Опрос задач рисования",
|
||||
"Drawing task records": "Записи задач рисования",
|
||||
"Drop a JavaScript plugin file here": "Перетащите сюда файл плагина JavaScript",
|
||||
"Dry run result": "Результат пробного запуска",
|
||||
"Duplicate": "Дублировать",
|
||||
"Duplicate group names: {{names}}": "Повторяющиеся имена групп: {{names}}",
|
||||
@@ -1652,7 +1655,6 @@
|
||||
"Enable All": "Включить все",
|
||||
"Enable check-in feature": "Включить функцию прибытия",
|
||||
"Enable custom task plugins": "Включить пользовательские плагины задач",
|
||||
"Enable task plugins": "Включить плагины задач",
|
||||
"Enable Data Dashboard": "Включить панель данных",
|
||||
"Enable demo mode with limited functionality": "Включить демонстрационный режим с ограниченной функциональностью",
|
||||
"Enable Discord OAuth": "Включить Discord OAuth",
|
||||
@@ -1681,6 +1683,7 @@
|
||||
"Enable SSRF Protection": "Включить защиту от SSRF",
|
||||
"Enable STARTTLS": "Включить STARTTLS",
|
||||
"Enable streaming mode for the test request.": "Включить потоковый режим для тестового запроса.",
|
||||
"Enable task plugins": "Включить плагины задач",
|
||||
"Enable Telegram OAuth": "Включить Telegram OAuth",
|
||||
"Enable test mode for Creem payments": "Включить тестовый режим для платежей Creem",
|
||||
"Enable this key?": "Включить этот ключ?",
|
||||
@@ -1792,7 +1795,6 @@
|
||||
"Enterprise-grade security with comprehensive permission management": "Безопасность корпоративного уровня с комплексным управлением разрешениями",
|
||||
"Entrypoint (space separated)": "Точка входа (через пробелы)",
|
||||
"Enum": "Перечисление",
|
||||
"Boolean": "Логический",
|
||||
"Enum values": "Значения перечисления",
|
||||
"Env (JSON object)": "Env (объект JSON)",
|
||||
"Environment variables": "Переменные окружения",
|
||||
@@ -1877,6 +1879,7 @@
|
||||
"extras": "доп. пункты",
|
||||
"Factory": "Встроенный",
|
||||
"Factory and custom plugin behavior": "Поведение встроенных и пользовательских плагинов",
|
||||
"Factory and custom plugins all stop serving immediately. In-flight tasks will be handled by timeout cleanup.": "Заводские и пользовательские плагины сразу перестают обслуживать запросы. Текущие задачи обработает очистка по таймауту.",
|
||||
"Factory plugins cannot be deleted or disabled individually. A custom version can override them; deleting or disabling that version restores the factory plugin. Third-party-only platforms become unavailable when their plugin is deleted or disabled.": "Встроенные плагины нельзя удалять или отключать отдельно. Пользовательская версия может заменить их; её удаление или отключение восстанавливает встроенный плагин. Сторонняя платформа становится недоступной при удалении или отключении её плагина.",
|
||||
"Fail Reason": "Причина сбоя",
|
||||
"Fail Reason Details": "Детали причины сбоя",
|
||||
@@ -2040,8 +2043,8 @@
|
||||
"Fetch available models for:": "Получить доступные модели для:",
|
||||
"Fetch available models from upstream": "Получить доступные модели от вышестоящего поставщика",
|
||||
"Fetch from Upstream": "Получить из Upstream",
|
||||
"Fetch Models": "Получить модели",
|
||||
"Fetch mode": "Режим получения",
|
||||
"Fetch Models": "Получить модели",
|
||||
"Fetched {{count}} model(s) from upstream": "Получено {{count}} моделей из upstream",
|
||||
"Fetched {{count}} models": "Получено {{count}} моделей",
|
||||
"Fetched in your browser and placed in the source field below for review. GitHub and gist page URLs are rewritten to their raw URL automatically.": "Загружается браузером и помещается в поле кода ниже для проверки. URL страниц GitHub и gist автоматически преобразуются в raw URL.",
|
||||
@@ -2879,6 +2882,7 @@
|
||||
"Models exposed by this channel": "Модели, доступные через этот канал",
|
||||
"Models fetched successfully": "Модели успешно получены",
|
||||
"Models filled to form": "Модели заполнены в форму",
|
||||
"Models listed here skip automatic -thinking / -nothinking suffix handling. Matched names are also exempt from @-modifier parsing and 400 validation. Prefix an entry with re: to match the full model name as a Go regular expression, for example re:.*@sha256:.*": "Модели из этого списка не получают и не теряют автоматически суффиксы -thinking / -nothinking. Совпавшие имена также освобождаются от разбора модификаторов @ и проверки с ответом 400. Запись с префиксом re: — регулярное выражение Go по полному имени модели, например re:.*@sha256:.*",
|
||||
"Models listed here will not automatically append or remove -thinking / -nothinking suffixes.": "Модели из этого списка не будут автоматически добавлять или удалять суффиксы -thinking / -nothinking.",
|
||||
"Models losing positions": "Модели, теряющие позиции",
|
||||
"Models losing the most positions": "Модели, потерявшие больше всего позиций",
|
||||
@@ -2964,9 +2968,9 @@
|
||||
"Native Claude Messages plus OpenAI Chat compatibility forwarding.": "Нативный Claude Messages и совместимая пересылка OpenAI Chat.",
|
||||
"Native format": "Собственный формат",
|
||||
"Native forwarding": "Нативная пересылка",
|
||||
"Native routes": "Нативные маршруты",
|
||||
"Native Gemini routes plus OpenAI Chat and Responses compatibility forwarding.": "Нативные маршруты Gemini и совместимая пересылка OpenAI Chat и Responses.",
|
||||
"Native OpenAI routes plus optional Claude and Gemini compatibility routes.": "Нативные маршруты OpenAI и дополнительные маршруты совместимости Claude и Gemini.",
|
||||
"Native routes": "Нативные маршруты",
|
||||
"Need a redemption code?": "Нужен код активации?",
|
||||
"Needs API key": "Нужен API-ключ",
|
||||
"Nested JSON defining per-group rules for adding (+:), removing (-:), or appending usable groups.": "Вложенный JSON, определяющий правила для каждой группы для добавления (+:), удаления (-:) или добавления используемых групп.",
|
||||
@@ -3334,6 +3338,7 @@
|
||||
"Optional JSON policy to restrict access based on user info fields": "Необязательная политика JSON для ограничения доступа на основе полей информации о пользователе",
|
||||
"Optional minimum recharge amount for this method.": "Необязательная минимальная сумма пополнения для этого метода.",
|
||||
"Optional multiplier per user group used when calculating recharge pricing. Provide a JSON object such as": "Необязательный множитель для группы пользователей, используемый при расчете цен на пополнение. Предоставьте JSON-объект, например",
|
||||
"Optional note describing this version": "Необязательное примечание к этой версии",
|
||||
"Optional notes about this channel": "Необязательные заметки об этом канале",
|
||||
"Optional notes about when to use this group": "Необязательные примечания о том, когда использовать эту группу",
|
||||
"Optional ratio used when upstream cache hits occur.": "Необязательное соотношение, используемое при попаданиях в вышестоящий кэш.",
|
||||
@@ -3614,11 +3619,6 @@
|
||||
"Plugin key": "Ключ плагина",
|
||||
"Plugin metadata": "Метаданные плагина",
|
||||
"Plugin source": "Исходный код плагина",
|
||||
"Choose file": "Выбрать файл",
|
||||
"Choose another file": "Выбрать другой файл",
|
||||
"Drop a JavaScript plugin file here": "Перетащите сюда файл плагина JavaScript",
|
||||
"Single .js file, up to 1 MiB. Its source is shown below before upload.": "Один файл .js размером до 1 МиБ. Его исходный код показан ниже перед загрузкой.",
|
||||
"Optional note describing this version": "Необязательное примечание к этой версии",
|
||||
"Plugin source exceeds the 1 MiB limit.": "Код плагина превышает лимит 1 МиБ.",
|
||||
"Plugin uploaded successfully": "Плагин успешно загружен",
|
||||
"Plugin version activated": "Версия плагина активирована",
|
||||
@@ -3639,8 +3639,8 @@
|
||||
"Pre-Consume for Free Models": "Предварительное потребление для бесплатных моделей",
|
||||
"Pre-consumed": "Предоплата",
|
||||
"Pre-Consumed Quota": "Предварительно потребленная квота",
|
||||
"Preference saved as {{pref}}, but no active subscription. Wallet will be used automatically.": "Настройка сохранена как {{pref}}, но нет активной подписки. Кошелёк будет использоваться автоматически.",
|
||||
"Preference saved as {{pref}}, but no active subscription. Requests will be rejected.": "Настройка сохранена как {{pref}}, но нет активной подписки. Запросы будут отклонены.",
|
||||
"Preference saved as {{pref}}, but no active subscription. Wallet will be used automatically.": "Настройка сохранена как {{pref}}, но нет активной подписки. Кошелёк будет использоваться автоматически.",
|
||||
"Preferences": "Настройки",
|
||||
"Prefill Group Management": "Управление группами автозаполнения",
|
||||
"Prefill Groups": "Группы автозаполнения",
|
||||
@@ -4452,6 +4452,7 @@
|
||||
"Simple": "Простой",
|
||||
"Simple mode only returns message; status code and error type use system defaults.": "Простой режим возвращает только сообщение; код статуса и тип ошибки используют системные значения по умолчанию.",
|
||||
"Simple mode: prune objects by type, e.g. redacted_thinking.": "Простой режим: очистка объектов по типу, например redacted_thinking.",
|
||||
"Single .js file, up to 1 MiB. Its source is shown below before upload.": "Один файл .js размером до 1 МиБ. Его исходный код показан ниже перед загрузкой.",
|
||||
"Single Key": "Одиночный ключ",
|
||||
"Site & Branding": "Сайт и брендинг",
|
||||
"Site Key": "Ключ сайта",
|
||||
@@ -4679,8 +4680,8 @@
|
||||
"Task logs": "Журналы задач",
|
||||
"Task Logs": "Журнал задач",
|
||||
"Task Plugin": "Плагин задач",
|
||||
"Task plugin setting updated": "Настройка плагинов задач обновлена",
|
||||
"Task plugin *": "Плагин задач *",
|
||||
"Task plugin setting updated": "Настройка плагинов задач обновлена",
|
||||
"Task Plugins": "Плагины задач",
|
||||
"Task pricing": "Тарификация задач",
|
||||
"Task pricing not configured": "Тарификация задач не настроена",
|
||||
@@ -4791,7 +4792,6 @@
|
||||
"Third-party plugin risk": "Риск стороннего плагина",
|
||||
"Third-party source risk": "Риск сторонних источников",
|
||||
"Third-party-only plugins become unavailable immediately. In-flight tasks will be handled by timeout cleanup.": "Сторонние плагины сразу станут недоступны. Активные задачи обработает очистка по тайм-ауту.",
|
||||
"Factory and custom plugins all stop serving immediately. In-flight tasks will be handled by timeout cleanup.": "Заводские и пользовательские плагины сразу перестают обслуживать запросы. Текущие задачи обработает очистка по таймауту.",
|
||||
"This action cannot be undone.": "Это действие невозможно отменить.",
|
||||
"This action cannot be undone. This will permanently delete your account and remove all your data from our servers.": "Это действие невозможно отменить. Это безвозвратно удалит вашу учетную запись и все ваши данные с наших серверов.",
|
||||
"This action will permanently remove 2FA protection from your account.": "Это действие безвозвратно удалит защиту 2FA из вашей учетной записи.",
|
||||
@@ -5137,6 +5137,7 @@
|
||||
"Updated successfully": "Обновлено успешно",
|
||||
"Updated system setting {{key}}": "Обновлён системный параметр {{key}}",
|
||||
"Updated user {{username}} (ID: {{id}})": "Обновлён пользователь {{username}} (ID: {{id}})",
|
||||
"Updates with the system": "Обновляется с системой",
|
||||
"Updating all channel balances. This may take a while. Please refresh to see results.": "Обновление балансов всех каналов. Это может занять некоторое время. Пожалуйста, обновите страницу, чтобы увидеть результаты.",
|
||||
"Updating...": "Обновление...",
|
||||
"Upgrade {{name}}": "Обновление {{name}}",
|
||||
@@ -5539,4 +5540,4 @@
|
||||
"Zhipu V4": "Zhipu V4",
|
||||
"Zoom": "Zoom"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -672,9 +672,9 @@
|
||||
"Bind a Pancake store + product": "Liên kết cửa hàng + sản phẩm Pancake",
|
||||
"Bind an email address to your account.": "Liên kết địa chỉ email với tài khoản của bạn.",
|
||||
"Bind Email": "Liên kết Email",
|
||||
"Bind task plugins": "Gắn plugin tác vụ",
|
||||
"Bind Telegram Account": "Liên kết tài khoản Telegram",
|
||||
"Bind WeChat Account": "Liên kết tài khoản WeChat",
|
||||
"Bind task plugins": "Gắn plugin tác vụ",
|
||||
"Binding Information": "Thông tin Ràng buộc",
|
||||
"Binding successful!": "Liên kết thành công!",
|
||||
"Binding your {{provider}} account": "Đang liên kết tài khoản {{provider}} của bạn",
|
||||
@@ -689,6 +689,7 @@
|
||||
"Blocked keywords": "Blocked keyword",
|
||||
"Blocks messages when sensitive keywords are detected.": "Chặn tin nhắn khi phát hiện từ khóa nhạy cảm.",
|
||||
"Body param": "Tham số body",
|
||||
"Boolean": "Boolean",
|
||||
"Border radius": "Độ bo góc",
|
||||
"Bot Name": "Tên Bot",
|
||||
"Bot Protection": "Bảo vệ Bot",
|
||||
@@ -713,9 +714,8 @@
|
||||
"Built for developers,": "Được xây dựng cho nhà phát triển,",
|
||||
"Built-in": "Tích hợp sẵn",
|
||||
"Built-in Device": "Thiết bị tích hợp",
|
||||
"Built-in v{{factory}} / marketplace v{{market}}": "Tích hợp v{{factory}} / chợ v{{market}}",
|
||||
"Updates with the system": "Cập nhật cùng hệ thống",
|
||||
"Built-in is v{{factory}}; delete the custom version to return to it": "Bản tích hợp là v{{factory}}; xóa bản tùy chỉnh để trở lại",
|
||||
"Built-in v{{factory}} / marketplace v{{market}}": "Tích hợp v{{factory}} / chợ v{{market}}",
|
||||
"Built-in: phone fingerprint/face, or Windows Hello; External: USB security key": "Tích hợp sẵn: vân tay/khuôn mặt điện thoại, hoặc Windows Hello; Bên ngoài: khóa bảo mật USB",
|
||||
"by": "by",
|
||||
"By category": "Theo danh mục",
|
||||
@@ -857,11 +857,13 @@
|
||||
"Choose a username": "Chọn tên người dùng",
|
||||
"Choose an amount and payment method": "Chọn số tiền và phương thức thanh toán",
|
||||
"Choose and order the groups this API key will try.": "Chọn và sắp xếp các nhóm mà khóa API này sẽ thử.",
|
||||
"Choose another file": "Chọn tệp khác",
|
||||
"Choose between default expanded, compact icon-only, or full layout mode": "Chọn giữa chế độ mở rộng mặc định, chế độ chỉ biểu tượng thu gọn, hoặc chế độ bố cục đầy đủ",
|
||||
"Choose between inset, floating, or standard sidebar layout": "Chọn giữa bố cục thanh bên chìm, nổi hoặc tiêu chuẩn",
|
||||
"Choose between left-to-right or right-to-left site direction": "Chọn giữa hướng trang từ trái sang phải hoặc từ phải sang trái",
|
||||
"Choose between system preference, light mode, or dark mode": "Lựa chọn giữa tùy chọn hệ thống, chế độ sáng hoặc chế độ tối",
|
||||
"Choose channels to sync upstream ratio configurations from": "Chọn các kênh để đồng bộ cấu hình tỷ lệ đường lên từ",
|
||||
"Choose file": "Chọn tệp",
|
||||
"Choose Group": "Chọn Nhóm",
|
||||
"Choose how flow widths are calculated.": "Chọn cách tính độ rộng của các luồng.",
|
||||
"Choose how quota values are shown to users": "Chọn cách hiển thị giá trị hạn ngạch cho người dùng",
|
||||
@@ -1448,11 +1450,11 @@
|
||||
"Disable 2FA": "Tắt 2FA",
|
||||
"Disable All": "Vô hiệu hóa tất cả",
|
||||
"Disable custom task plugins?": "Tắt plugin tác vụ tùy chỉnh?",
|
||||
"Disable task plugins?": "Tắt plugin tác vụ?",
|
||||
"Disable on failure": "Vô hiệu hóa khi lỗi",
|
||||
"Disable selected channels": "Vô hiệu hóa các kênh đã chọn",
|
||||
"Disable selected models": "Vô hiệu hóa các mô hình đã chọn",
|
||||
"Disable store passthrough": "Vô hiệu hóa chuyển tiếp store",
|
||||
"Disable task plugins?": "Tắt plugin tác vụ?",
|
||||
"Disable this key?": "Vô hiệu hóa khóa này?",
|
||||
"Disable threshold (seconds)": "Vô hiệu hóa ngưỡng (giây)",
|
||||
"Disable Two-Factor Authentication": "Vô hiệu hóa Xác thực hai yếu tố",
|
||||
@@ -1530,6 +1532,7 @@
|
||||
"Drawing Logs": "Nhật ký bản vẽ",
|
||||
"Drawing task polling": "Thăm dò tác vụ vẽ",
|
||||
"Drawing task records": "Lịch sử tác vụ vẽ",
|
||||
"Drop a JavaScript plugin file here": "Kéo tệp plugin JavaScript vào đây",
|
||||
"Dry run result": "Kết quả chạy thử",
|
||||
"Duplicate": "Nhân bản",
|
||||
"Duplicate group names: {{names}}": "Tên nhóm bị trùng: {{names}}",
|
||||
@@ -1652,7 +1655,6 @@
|
||||
"Enable All": "Bật tất cả",
|
||||
"Enable check-in feature": "Bật tính năng điểm danh",
|
||||
"Enable custom task plugins": "Bật plugin tác vụ tùy chỉnh",
|
||||
"Enable task plugins": "Bật plugin tác vụ",
|
||||
"Enable Data Dashboard": "Kích hoạt Trang tổng quan Dữ liệu",
|
||||
"Enable demo mode with limited functionality": "Bật chế độ demo với chức năng hạn chế",
|
||||
"Enable Discord OAuth": "Bật Discord OAuth",
|
||||
@@ -1681,6 +1683,7 @@
|
||||
"Enable SSRF Protection": "Kích hoạt Bảo vệ SSRF",
|
||||
"Enable STARTTLS": "Bật STARTTLS",
|
||||
"Enable streaming mode for the test request.": "Bật chế độ streaming cho yêu cầu thử nghiệm.",
|
||||
"Enable task plugins": "Bật plugin tác vụ",
|
||||
"Enable Telegram OAuth": "Bật Telegram OAuth",
|
||||
"Enable test mode for Creem payments": "Bật chế độ thử nghiệm cho thanh toán Creem",
|
||||
"Enable this key?": "Kích hoạt khóa này?",
|
||||
@@ -1792,7 +1795,6 @@
|
||||
"Enterprise-grade security with comprehensive permission management": "Bảo mật cấp doanh nghiệp với quản lý quyền toàn diện",
|
||||
"Entrypoint (space separated)": "Entrypoint (cách nhau bằng dấu cách)",
|
||||
"Enum": "Liệt kê",
|
||||
"Boolean": "Boolean",
|
||||
"Enum values": "Các giá trị liệt kê",
|
||||
"Env (JSON object)": "Env (đối tượng JSON)",
|
||||
"Environment variables": "Biến môi trường",
|
||||
@@ -1877,6 +1879,7 @@
|
||||
"extras": "mục bổ sung",
|
||||
"Factory": "Tích hợp",
|
||||
"Factory and custom plugin behavior": "Cách hoạt động của plugin tích hợp và tùy chỉnh",
|
||||
"Factory and custom plugins all stop serving immediately. In-flight tasks will be handled by timeout cleanup.": "Plugin gốc và plugin tùy chỉnh sẽ ngay lập tức ngừng phục vụ. Các tác vụ đang chạy sẽ được xử lý bằng dọn dẹp hết hạn.",
|
||||
"Factory plugins cannot be deleted or disabled individually. A custom version can override them; deleting or disabling that version restores the factory plugin. Third-party-only platforms become unavailable when their plugin is deleted or disabled.": "Không thể xóa hoặc tắt riêng plugin tích hợp. Phiên bản tùy chỉnh có thể ghi đè; xóa hoặc tắt phiên bản đó sẽ khôi phục plugin tích hợp. Nền tảng chỉ có plugin bên thứ ba sẽ không khả dụng khi plugin bị xóa hoặc tắt.",
|
||||
"Fail Reason": "Lý do thất bại",
|
||||
"Fail Reason Details": "Chi tiết lý do thất bại",
|
||||
@@ -2040,8 +2043,8 @@
|
||||
"Fetch available models for:": "Tìm nạp các mô hình khả dụng cho:",
|
||||
"Fetch available models from upstream": "Lấy các mô hình khả dụng từ nguồn trên",
|
||||
"Fetch from Upstream": "Lấy từ nguồn",
|
||||
"Fetch Models": "Tìm nạp Mô hình",
|
||||
"Fetch mode": "Chế độ lấy dữ liệu",
|
||||
"Fetch Models": "Tìm nạp Mô hình",
|
||||
"Fetched {{count}} model(s) from upstream": "Đã lấy {{count}} mô hình từ upstream",
|
||||
"Fetched {{count}} models": "Đã lấy {{count}} mô hình",
|
||||
"Fetched in your browser and placed in the source field below for review. GitHub and gist page URLs are rewritten to their raw URL automatically.": "Được trình duyệt tải về và đưa vào ô mã nguồn bên dưới để bạn xem lại. URL trang GitHub và gist sẽ tự động được đổi thành URL raw.",
|
||||
@@ -2879,6 +2882,7 @@
|
||||
"Models exposed by this channel": "Model được kênh này công bố",
|
||||
"Models fetched successfully": "Các mô hình đã được tải thành công",
|
||||
"Models filled to form": "Mô hình đã được điền vào biểu mẫu",
|
||||
"Models listed here skip automatic -thinking / -nothinking suffix handling. Matched names are also exempt from @-modifier parsing and 400 validation. Prefix an entry with re: to match the full model name as a Go regular expression, for example re:.*@sha256:.*": "Các mô hình được liệt kê ở đây sẽ không tự động thêm hoặc xóa hậu tố -thinking / -nothinking. Tên khớp cũng được miễn phân tích và kiểm tra (400) cho bộ sửa đổi @. Mục bắt đầu bằng re: được coi là biểu thức chính quy Go khớp toàn bộ tên mô hình, ví dụ re:.*@sha256:.*",
|
||||
"Models listed here will not automatically append or remove -thinking / -nothinking suffixes.": "Các mô hình được liệt kê ở đây sẽ không tự động thêm hoặc xóa hậu tố -thinking / -nothinking.",
|
||||
"Models losing positions": "Các mô hình đang mất vị trí",
|
||||
"Models losing the most positions": "Mô hình tụt hạng nhiều nhất",
|
||||
@@ -2964,9 +2968,9 @@
|
||||
"Native Claude Messages plus OpenAI Chat compatibility forwarding.": "Chuyển tiếp Claude Messages nguyên bản và tương thích OpenAI Chat.",
|
||||
"Native format": "Định dạng gốc",
|
||||
"Native forwarding": "Chuyển tiếp nguyên bản",
|
||||
"Native routes": "Tuyến nguyên bản",
|
||||
"Native Gemini routes plus OpenAI Chat and Responses compatibility forwarding.": "Route Gemini nguyên bản cùng chuyển tiếp tương thích OpenAI Chat và Responses.",
|
||||
"Native OpenAI routes plus optional Claude and Gemini compatibility routes.": "Route OpenAI nguyên bản cùng các route tương thích Claude và Gemini tùy chọn.",
|
||||
"Native routes": "Tuyến nguyên bản",
|
||||
"Need a redemption code?": "Cần mã đổi thưởng?",
|
||||
"Needs API key": "Cần khóa API",
|
||||
"Nested JSON defining per-group rules for adding (+:), removing (-:), or appending usable groups.": "JSON lồng nhau xác định quy tắc theo nhóm để thêm (+:), xóa (-:), hoặc nối các nhóm có thể sử dụng.",
|
||||
@@ -3334,6 +3338,7 @@
|
||||
"Optional JSON policy to restrict access based on user info fields": "Chính sách JSON tùy chọn để hạn chế truy cập dựa trên các trường thông tin người dùng",
|
||||
"Optional minimum recharge amount for this method.": "Số tiền nạp tối thiểu tùy chọn cho phương thức này.",
|
||||
"Optional multiplier per user group used when calculating recharge pricing. Provide a JSON object such as": "Hệ số nhân tùy chọn cho mỗi nhóm người dùng, được sử dụng khi tính toán giá nạp tiền. Cung cấp một đối tượng JSON như",
|
||||
"Optional note describing this version": "Ghi chú tùy chọn mô tả phiên bản này",
|
||||
"Optional notes about this channel": "Ghi chú tùy chọn về kênh này",
|
||||
"Optional notes about when to use this group": "Các ghi chú tùy chọn về thời điểm sử dụng nhóm này",
|
||||
"Optional ratio used when upstream cache hits occur.": "Tỷ lệ tùy chọn được sử dụng khi xảy ra các lượt truy cập bộ nhớ đệm ngược dòng.",
|
||||
@@ -3614,11 +3619,6 @@
|
||||
"Plugin key": "Khóa plugin",
|
||||
"Plugin metadata": "Siêu dữ liệu plugin",
|
||||
"Plugin source": "Mã nguồn plugin",
|
||||
"Choose file": "Chọn tệp",
|
||||
"Choose another file": "Chọn tệp khác",
|
||||
"Drop a JavaScript plugin file here": "Kéo tệp plugin JavaScript vào đây",
|
||||
"Single .js file, up to 1 MiB. Its source is shown below before upload.": "Một tệp .js duy nhất, tối đa 1 MiB. Mã nguồn được hiển thị bên dưới trước khi tải lên.",
|
||||
"Optional note describing this version": "Ghi chú tùy chọn mô tả phiên bản này",
|
||||
"Plugin source exceeds the 1 MiB limit.": "Mã nguồn plugin vượt giới hạn 1 MiB.",
|
||||
"Plugin uploaded successfully": "Đã tải plugin lên",
|
||||
"Plugin version activated": "Đã kích hoạt phiên bản plugin",
|
||||
@@ -3639,8 +3639,8 @@
|
||||
"Pre-Consume for Free Models": "Dùng trước các mô hình miễn phí",
|
||||
"Pre-consumed": "Khấu trừ trước",
|
||||
"Pre-Consumed Quota": "Hạn mức đã tiêu thụ trước",
|
||||
"Preference saved as {{pref}}, but no active subscription. Wallet will be used automatically.": "Tùy chọn đã lưu là {{pref}}, nhưng không có gói đăng ký đang hoạt động. Ví sẽ được sử dụng tự động.",
|
||||
"Preference saved as {{pref}}, but no active subscription. Requests will be rejected.": "Tùy chọn đã lưu là {{pref}}, nhưng không có gói đăng ký đang hoạt động. Các yêu cầu sẽ bị từ chối.",
|
||||
"Preference saved as {{pref}}, but no active subscription. Wallet will be used automatically.": "Tùy chọn đã lưu là {{pref}}, nhưng không có gói đăng ký đang hoạt động. Ví sẽ được sử dụng tự động.",
|
||||
"Preferences": "Tùy chọn",
|
||||
"Prefill Group Management": "Quản lý Nhóm Điền sẵn",
|
||||
"Prefill Groups": "Điền sẵn các nhóm",
|
||||
@@ -4452,6 +4452,7 @@
|
||||
"Simple": "Đơn giản",
|
||||
"Simple mode only returns message; status code and error type use system defaults.": "Chế độ đơn giản chỉ trả về message; mã trạng thái và loại lỗi sử dụng giá trị mặc định.",
|
||||
"Simple mode: prune objects by type, e.g. redacted_thinking.": "Chế độ đơn giản: dọn dẹp đối tượng theo type, ví dụ redacted_thinking.",
|
||||
"Single .js file, up to 1 MiB. Its source is shown below before upload.": "Một tệp .js duy nhất, tối đa 1 MiB. Mã nguồn được hiển thị bên dưới trước khi tải lên.",
|
||||
"Single Key": "Khóa đơn",
|
||||
"Site & Branding": "Trang web & thương hiệu",
|
||||
"Site Key": "Khóa trang web",
|
||||
@@ -4679,8 +4680,8 @@
|
||||
"Task logs": "Nhật ký tác vụ",
|
||||
"Task Logs": "Nhật ký tác vụ",
|
||||
"Task Plugin": "Plugin tác vụ",
|
||||
"Task plugin setting updated": "Đã cập nhật cài đặt plugin tác vụ",
|
||||
"Task plugin *": "Plugin tác vụ *",
|
||||
"Task plugin setting updated": "Đã cập nhật cài đặt plugin tác vụ",
|
||||
"Task Plugins": "Plugin tác vụ",
|
||||
"Task pricing": "Giá tác vụ",
|
||||
"Task pricing not configured": "Chưa cấu hình giá tác vụ",
|
||||
@@ -4791,7 +4792,6 @@
|
||||
"Third-party plugin risk": "Rủi ro plugin bên thứ ba",
|
||||
"Third-party source risk": "Rủi ro nguồn bên thứ ba",
|
||||
"Third-party-only plugins become unavailable immediately. In-flight tasks will be handled by timeout cleanup.": "Plugin chỉ có từ bên thứ ba sẽ ngừng hoạt động ngay. Tác vụ đang chạy sẽ được xử lý khi dọn dẹp quá hạn.",
|
||||
"Factory and custom plugins all stop serving immediately. In-flight tasks will be handled by timeout cleanup.": "Plugin gốc và plugin tùy chỉnh sẽ ngay lập tức ngừng phục vụ. Các tác vụ đang chạy sẽ được xử lý bằng dọn dẹp hết hạn.",
|
||||
"This action cannot be undone.": "Hành động này không thể hoàn tác.",
|
||||
"This action cannot be undone. This will permanently delete your account and remove all your data from our servers.": "Hành động này không thể hoàn tác. Việc này sẽ xóa vĩnh viễn tài khoản của bạn và loại bỏ tất cả dữ liệu của bạn khỏi máy chủ của chúng tôi.",
|
||||
"This action will permanently remove 2FA protection from your account.": "Hành động này sẽ vĩnh viễn gỡ bỏ tính năng bảo vệ",
|
||||
@@ -5137,6 +5137,7 @@
|
||||
"Updated successfully": "Cập nhật thành công",
|
||||
"Updated system setting {{key}}": "Đã cập nhật cài đặt hệ thống {{key}}",
|
||||
"Updated user {{username}} (ID: {{id}})": "Đã cập nhật người dùng {{username}} (ID: {{id}})",
|
||||
"Updates with the system": "Cập nhật cùng hệ thống",
|
||||
"Updating all channel balances. This may take a while. Please refresh to see results.": "Đang cập nhật tất cả số dư kênh. Quá trình này có thể mất một chút thời gian. Vui lòng làm mới để xem kết quả.",
|
||||
"Updating...": "Đang cập nhật...",
|
||||
"Upgrade {{name}}": "Nâng cấp {{name}}",
|
||||
@@ -5539,4 +5540,4 @@
|
||||
"Zhipu V4": "Zhipu V4",
|
||||
"Zoom": "Zoom"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -672,9 +672,9 @@
|
||||
"Bind a Pancake store + product": "連結 Pancake 店鋪和產品",
|
||||
"Bind an email address to your account.": "將電郵地址連結到您的用戶。",
|
||||
"Bind Email": "連結電郵",
|
||||
"Bind task plugins": "綁定任務外掛",
|
||||
"Bind Telegram Account": "連結 Telegram 用戶",
|
||||
"Bind WeChat Account": "連結微信用戶",
|
||||
"Bind task plugins": "綁定任務外掛",
|
||||
"Binding Information": "連結資訊",
|
||||
"Binding successful!": "連結成功!",
|
||||
"Binding your {{provider}} account": "正在連結您的 {{provider}} 賬號",
|
||||
@@ -689,6 +689,7 @@
|
||||
"Blocked keywords": "已阻止的關鍵詞",
|
||||
"Blocks messages when sensitive keywords are detected.": "偵測到敏感關鍵詞時阻止訊息。",
|
||||
"Body param": "請求體參數",
|
||||
"Boolean": "布林",
|
||||
"Border radius": "圓角",
|
||||
"Bot Name": "機械人名稱",
|
||||
"Bot Protection": "機械人保護",
|
||||
@@ -713,9 +714,8 @@
|
||||
"Built for developers,": "為開發者打造,",
|
||||
"Built-in": "內置",
|
||||
"Built-in Device": "內置設備",
|
||||
"Built-in v{{factory}} / marketplace v{{market}}": "內建 v{{factory}} / 市集 v{{market}}",
|
||||
"Updates with the system": "隨系統更新",
|
||||
"Built-in is v{{factory}}; delete the custom version to return to it": "內建版本為 v{{factory}};刪除自訂版本即可恢復",
|
||||
"Built-in v{{factory}} / marketplace v{{market}}": "內建 v{{factory}} / 市集 v{{market}}",
|
||||
"Built-in: phone fingerprint/face, or Windows Hello; External: USB security key": "內置:手機指紋/面部,或 Windows Hello;外部:USB 安全金鑰",
|
||||
"by": "由",
|
||||
"By category": "按行業",
|
||||
@@ -857,11 +857,13 @@
|
||||
"Choose a username": "選擇一個用戶名",
|
||||
"Choose an amount and payment method": "選擇金額和支付方式",
|
||||
"Choose and order the groups this API key will try.": "選擇此 API 金鑰要依序嘗試的分組並排序。",
|
||||
"Choose another file": "重新選擇檔案",
|
||||
"Choose between default expanded, compact icon-only, or full layout mode": "選擇預設展開、緊湊圖標模式或完整佈局模式",
|
||||
"Choose between inset, floating, or standard sidebar layout": "選擇嵌入式、浮動式或標準側邊欄佈局",
|
||||
"Choose between left-to-right or right-to-left site direction": "選擇從左到右或從右到左的站點方向",
|
||||
"Choose between system preference, light mode, or dark mode": "選擇系統偏好、淺色模式或深色模式",
|
||||
"Choose channels to sync upstream ratio configurations from": "選擇要同步上游比例設定的渠道",
|
||||
"Choose file": "選擇檔案",
|
||||
"Choose Group": "選擇分組",
|
||||
"Choose how flow widths are calculated.": "選擇分流圖連線寬度的計算方式。",
|
||||
"Choose how quota values are shown to users": "選擇如何向用戶展示配額值",
|
||||
@@ -1448,11 +1450,11 @@
|
||||
"Disable 2FA": "停用 2FA",
|
||||
"Disable All": "停用全部",
|
||||
"Disable custom task plugins?": "停用自訂任務外掛?",
|
||||
"Disable task plugins?": "停用任務外掛?",
|
||||
"Disable on failure": "失敗時停用",
|
||||
"Disable selected channels": "停用選定的渠道",
|
||||
"Disable selected models": "停用選定的模型",
|
||||
"Disable store passthrough": "禁止透傳 store",
|
||||
"Disable task plugins?": "停用任務外掛?",
|
||||
"Disable this key?": "停用此金鑰?",
|
||||
"Disable threshold (seconds)": "停用閾值(秒)",
|
||||
"Disable Two-Factor Authentication": "停用雙重身份驗證",
|
||||
@@ -1530,6 +1532,7 @@
|
||||
"Drawing Logs": "繪圖日誌",
|
||||
"Drawing task polling": "繪圖任務輪詢",
|
||||
"Drawing task records": "繪圖任務記錄",
|
||||
"Drop a JavaScript plugin file here": "將 JavaScript 外掛檔案拖放到此處",
|
||||
"Dry run result": "試跑結果",
|
||||
"Duplicate": "重複",
|
||||
"Duplicate group names: {{names}}": "存在重複的分組名稱:{{names}}",
|
||||
@@ -1652,7 +1655,6 @@
|
||||
"Enable All": "啟用全部",
|
||||
"Enable check-in feature": "啟用簽到功能",
|
||||
"Enable custom task plugins": "啟用自訂任務外掛",
|
||||
"Enable task plugins": "啟用任務外掛",
|
||||
"Enable Data Dashboard": "啟用數據儀表板",
|
||||
"Enable demo mode with limited functionality": "啟用功能受限的演示模式",
|
||||
"Enable Discord OAuth": "啟用 Discord OAuth",
|
||||
@@ -1681,6 +1683,7 @@
|
||||
"Enable SSRF Protection": "啟用 SSRF 保護",
|
||||
"Enable STARTTLS": "啟用 STARTTLS",
|
||||
"Enable streaming mode for the test request.": "為測試請求啟用串流模式。",
|
||||
"Enable task plugins": "啟用任務外掛",
|
||||
"Enable Telegram OAuth": "啟用 Telegram OAuth",
|
||||
"Enable test mode for Creem payments": "啟用 Creem 支付測試模式",
|
||||
"Enable this key?": "啟用此金鑰?",
|
||||
@@ -1792,7 +1795,6 @@
|
||||
"Enterprise-grade security with comprehensive permission management": "企業級安全性,提供全面的權限管理",
|
||||
"Entrypoint (space separated)": "入口點 (空格分隔)",
|
||||
"Enum": "列舉",
|
||||
"Boolean": "布林",
|
||||
"Enum values": "列舉值",
|
||||
"Env (JSON object)": "環境變數 (JSON 物件)",
|
||||
"Environment variables": "環境變數",
|
||||
@@ -1877,6 +1879,7 @@
|
||||
"extras": "額外項",
|
||||
"Factory": "內建",
|
||||
"Factory and custom plugin behavior": "內建与自定义外掛行为",
|
||||
"Factory and custom plugins all stop serving immediately. In-flight tasks will be handled by timeout cleanup.": "出廠外掛與自訂外掛將立即停止服務。進行中的任務將由逾時清理處理。",
|
||||
"Factory plugins cannot be deleted or disabled individually. A custom version can override them; deleting or disabling that version restores the factory plugin. Third-party-only platforms become unavailable when their plugin is deleted or disabled.": "內建外掛不可刪除或单独禁用。自定义版本可覆盖內建版;刪除或禁用自定义版会恢复內建版。纯第三方平台的外掛被刪除或禁用后将不可用。",
|
||||
"Fail Reason": "失敗原因",
|
||||
"Fail Reason Details": "失敗原因詳情",
|
||||
@@ -2040,8 +2043,8 @@
|
||||
"Fetch available models for:": "獲取可用模型:",
|
||||
"Fetch available models from upstream": "從上游獲取可用模型",
|
||||
"Fetch from Upstream": "從上游獲取",
|
||||
"Fetch Models": "獲取模型",
|
||||
"Fetch mode": "拉取模式",
|
||||
"Fetch Models": "獲取模型",
|
||||
"Fetched {{count}} model(s) from upstream": "從上游獲取了 {{count}} 個模型",
|
||||
"Fetched {{count}} models": "已獲取 {{count}} 個模型",
|
||||
"Fetched in your browser and placed in the source field below for review. GitHub and gist page URLs are rewritten to their raw URL automatically.": "由瀏覽器取得並填入下方原始碼欄位供你審查。GitHub 與 gist 頁面 URL 會自動改寫為 raw URL。",
|
||||
@@ -2879,6 +2882,7 @@
|
||||
"Models exposed by this channel": "此渠道暴露的模型",
|
||||
"Models fetched successfully": "模型獲取成功",
|
||||
"Models filled to form": "模型已填充到表單",
|
||||
"Models listed here skip automatic -thinking / -nothinking suffix handling. Matched names are also exempt from @-modifier parsing and 400 validation. Prefix an entry with re: to match the full model name as a Go regular expression, for example re:.*@sha256:.*": "此處列出的模型不會自動新增或移除 -thinking / -nothinking 後綴。命中的模型同時豁免 @ 修飾符解析與 400 校驗。以 re: 開頭的條目會以 Go 正規表示式匹配完整模型名稱,例如 re:.*@sha256:.*。",
|
||||
"Models listed here will not automatically append or remove -thinking / -nothinking suffixes.": "此處列出的模型不會自動新增或移除 -thinking / -nothinking 後綴。",
|
||||
"Models losing positions": "排名下滑的模型",
|
||||
"Models losing the most positions": "名次下滑最多的模型",
|
||||
@@ -2964,9 +2968,9 @@
|
||||
"Native Claude Messages plus OpenAI Chat compatibility forwarding.": "Claude Messages 原生轉發,並相容 OpenAI Chat 轉換。",
|
||||
"Native format": "原生格式",
|
||||
"Native forwarding": "原生轉發",
|
||||
"Native routes": "原生路由",
|
||||
"Native Gemini routes plus OpenAI Chat and Responses compatibility forwarding.": "Gemini 原生轉發,並相容 OpenAI Chat 和 Responses 轉換。",
|
||||
"Native OpenAI routes plus optional Claude and Gemini compatibility routes.": "OpenAI 原生轉發,並提供可選的 Claude 和 Gemini 相容轉換。",
|
||||
"Native routes": "原生路由",
|
||||
"Need a redemption code?": "需要兌換碼?",
|
||||
"Needs API key": "需要 API 金鑰",
|
||||
"Nested JSON defining per-group rules for adding (+:), removing (-:), or appending usable groups.": "嵌套 JSON,定義按分組新增(+:)、移除(-:)或追加可用分組的規則。",
|
||||
@@ -3334,6 +3338,7 @@
|
||||
"Optional JSON policy to restrict access based on user info fields": "可選的 JSON 政策,用於基於用戶資訊欄位限制存取",
|
||||
"Optional minimum recharge amount for this method.": "此方法的可選最低儲值金額。",
|
||||
"Optional multiplier per user group used when calculating recharge pricing. Provide a JSON object such as": "計算儲值定價時使用的每個用戶分組可選乘數。請提供一個 JSON 物件,例如",
|
||||
"Optional note describing this version": "選填,用於描述該版本的備註",
|
||||
"Optional notes about this channel": "關於此渠道的可選備註",
|
||||
"Optional notes about when to use this group": "關於何時使用此分組的可選說明",
|
||||
"Optional ratio used when upstream cache hits occur.": "上游緩存命中時使用的可選比率。",
|
||||
@@ -3614,11 +3619,6 @@
|
||||
"Plugin key": "外掛键",
|
||||
"Plugin metadata": "外掛元数据",
|
||||
"Plugin source": "外掛原始碼",
|
||||
"Choose file": "選擇檔案",
|
||||
"Choose another file": "重新選擇檔案",
|
||||
"Drop a JavaScript plugin file here": "將 JavaScript 外掛檔案拖放到此處",
|
||||
"Single .js file, up to 1 MiB. Its source is shown below before upload.": "單一 .js 檔案,最大 1 MiB。上傳前會在下方顯示其原始碼。",
|
||||
"Optional note describing this version": "選填,用於描述該版本的備註",
|
||||
"Plugin source exceeds the 1 MiB limit.": "外掛原始碼超過 1 MiB 上限。",
|
||||
"Plugin uploaded successfully": "外掛上傳成功",
|
||||
"Plugin version activated": "外掛版本已激活",
|
||||
@@ -3639,8 +3639,8 @@
|
||||
"Pre-Consume for Free Models": "免費模型預消耗",
|
||||
"Pre-consumed": "預扣費",
|
||||
"Pre-Consumed Quota": "預消耗配額",
|
||||
"Preference saved as {{pref}}, but no active subscription. Wallet will be used automatically.": "已儲存偏好為{{pref}},目前無生效訂閱,將自動使用錢包",
|
||||
"Preference saved as {{pref}}, but no active subscription. Requests will be rejected.": "已儲存偏好為{{pref}},目前無生效訂閱,請求將被拒絕",
|
||||
"Preference saved as {{pref}}, but no active subscription. Wallet will be used automatically.": "已儲存偏好為{{pref}},目前無生效訂閱,將自動使用錢包",
|
||||
"Preferences": "偏好設定",
|
||||
"Prefill Group Management": "預填充分組管理",
|
||||
"Prefill Groups": "預填充分組",
|
||||
@@ -4452,6 +4452,7 @@
|
||||
"Simple": "簡潔",
|
||||
"Simple mode only returns message; status code and error type use system defaults.": "簡潔模式僅回傳 message;狀態碼和錯誤類型將使用系統預設值。",
|
||||
"Simple mode: prune objects by type, e.g. redacted_thinking.": "簡潔模式:按 type 全量清理物件,例如 redacted_thinking。",
|
||||
"Single .js file, up to 1 MiB. Its source is shown below before upload.": "單一 .js 檔案,最大 1 MiB。上傳前會在下方顯示其原始碼。",
|
||||
"Single Key": "單金鑰",
|
||||
"Site & Branding": "站點與品牌",
|
||||
"Site Key": "站點金鑰",
|
||||
@@ -4679,8 +4680,8 @@
|
||||
"Task logs": "任務日誌",
|
||||
"Task Logs": "任務日誌",
|
||||
"Task Plugin": "任務外掛",
|
||||
"Task plugin setting updated": "任務外掛設定已更新",
|
||||
"Task plugin *": "任務外掛 *",
|
||||
"Task plugin setting updated": "任務外掛設定已更新",
|
||||
"Task Plugins": "任务外掛",
|
||||
"Task pricing": "任務定價",
|
||||
"Task pricing not configured": "尚未設定任務定價",
|
||||
@@ -4791,7 +4792,6 @@
|
||||
"Third-party plugin risk": "第三方外掛风险",
|
||||
"Third-party source risk": "第三方來源風險",
|
||||
"Third-party-only plugins become unavailable immediately. In-flight tasks will be handled by timeout cleanup.": "純第三方外掛將立即不可用,進行中的任務將由逾時清理處理。",
|
||||
"Factory and custom plugins all stop serving immediately. In-flight tasks will be handled by timeout cleanup.": "出廠外掛與自訂外掛將立即停止服務。進行中的任務將由逾時清理處理。",
|
||||
"This action cannot be undone.": "此操作無法撤銷。",
|
||||
"This action cannot be undone. This will permanently delete your account and remove all your data from our servers.": "此操作無法撤銷。這將永久刪除您的用戶並從我們的伺服器中移除您的所有數據。",
|
||||
"This action will permanently remove 2FA protection from your account.": "此操作將永久移除您用戶的 2FA 保護。",
|
||||
@@ -5137,6 +5137,7 @@
|
||||
"Updated successfully": "更新成功",
|
||||
"Updated system setting {{key}}": "修改系統設定 {{key}}",
|
||||
"Updated user {{username}} (ID: {{id}})": "更新用戶 {{username}}(ID: {{id}})",
|
||||
"Updates with the system": "隨系統更新",
|
||||
"Updating all channel balances. This may take a while. Please refresh to see results.": "正在更新所有渠道餘額。這可能需要一段時間。請重新整理以查看結果。",
|
||||
"Updating...": "正在更新...",
|
||||
"Upgrade {{name}}": "升級 {{name}}",
|
||||
@@ -5539,4 +5540,4 @@
|
||||
"Zhipu V4": "智譜 V4",
|
||||
"Zoom": "縮放"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -672,9 +672,9 @@
|
||||
"Bind a Pancake store + product": "绑定 Pancake 店铺和产品",
|
||||
"Bind an email address to your account.": "将邮箱地址绑定到您的账户。",
|
||||
"Bind Email": "绑定邮箱",
|
||||
"Bind task plugins": "绑定任务插件",
|
||||
"Bind Telegram Account": "绑定 Telegram 账户",
|
||||
"Bind WeChat Account": "绑定微信账户",
|
||||
"Bind task plugins": "绑定任务插件",
|
||||
"Binding Information": "绑定信息",
|
||||
"Binding successful!": "绑定成功!",
|
||||
"Binding your {{provider}} account": "正在绑定您的 {{provider}} 账号",
|
||||
@@ -689,6 +689,7 @@
|
||||
"Blocked keywords": "已阻止的关键词",
|
||||
"Blocks messages when sensitive keywords are detected.": "检测到敏感关键词时阻止消息。",
|
||||
"Body param": "请求体参数",
|
||||
"Boolean": "布尔",
|
||||
"Border radius": "圆角",
|
||||
"Bot Name": "机器人名称",
|
||||
"Bot Protection": "机器人保护",
|
||||
@@ -713,9 +714,8 @@
|
||||
"Built for developers,": "为开发者打造,",
|
||||
"Built-in": "内置",
|
||||
"Built-in Device": "内置设备",
|
||||
"Built-in v{{factory}} / marketplace v{{market}}": "内置 v{{factory}} / 市场 v{{market}}",
|
||||
"Updates with the system": "随系统更新",
|
||||
"Built-in is v{{factory}}; delete the custom version to return to it": "内置版本为 v{{factory}};删除自定义版本即可恢复",
|
||||
"Built-in v{{factory}} / marketplace v{{market}}": "内置 v{{factory}} / 市场 v{{market}}",
|
||||
"Built-in: phone fingerprint/face, or Windows Hello; External: USB security key": "内置:手机指纹/面部,或 Windows Hello;外部:USB 安全密钥",
|
||||
"by": "由",
|
||||
"By category": "按行业",
|
||||
@@ -857,11 +857,13 @@
|
||||
"Choose a username": "选择一个用户名",
|
||||
"Choose an amount and payment method": "选择金额和支付方式",
|
||||
"Choose and order the groups this API key will try.": "选择并排列此 API 密钥将依次尝试的分组。",
|
||||
"Choose another file": "重新选择文件",
|
||||
"Choose between default expanded, compact icon-only, or full layout mode": "选择默认展开、紧凑图标模式或完整布局模式",
|
||||
"Choose between inset, floating, or standard sidebar layout": "选择嵌入式、浮动式或标准侧边栏布局",
|
||||
"Choose between left-to-right or right-to-left site direction": "选择从左到右或从右到左的站点方向",
|
||||
"Choose between system preference, light mode, or dark mode": "选择系统偏好、浅色模式或深色模式",
|
||||
"Choose channels to sync upstream ratio configurations from": "选择要同步上游比例配置的渠道",
|
||||
"Choose file": "选择文件",
|
||||
"Choose Group": "选择分组",
|
||||
"Choose how flow widths are calculated.": "选择分流图连线宽度的计算方式。",
|
||||
"Choose how quota values are shown to users": "选择如何向用户展示配额值",
|
||||
@@ -1448,11 +1450,11 @@
|
||||
"Disable 2FA": "禁用 2FA",
|
||||
"Disable All": "禁用全部",
|
||||
"Disable custom task plugins?": "禁用自定义任务插件?",
|
||||
"Disable task plugins?": "禁用任务插件?",
|
||||
"Disable on failure": "失败时禁用",
|
||||
"Disable selected channels": "禁用选定的渠道",
|
||||
"Disable selected models": "禁用选定的模型",
|
||||
"Disable store passthrough": "禁止透传 store",
|
||||
"Disable task plugins?": "禁用任务插件?",
|
||||
"Disable this key?": "禁用此密钥?",
|
||||
"Disable threshold (seconds)": "禁用阈值(秒)",
|
||||
"Disable Two-Factor Authentication": "禁用双重身份验证",
|
||||
@@ -1530,6 +1532,7 @@
|
||||
"Drawing Logs": "绘图日志",
|
||||
"Drawing task polling": "绘图任务轮询",
|
||||
"Drawing task records": "绘图任务记录",
|
||||
"Drop a JavaScript plugin file here": "将 JavaScript 插件文件拖放到此处",
|
||||
"Dry run result": "干跑结果",
|
||||
"Duplicate": "重复",
|
||||
"Duplicate group names: {{names}}": "存在重复的分组名称:{{names}}",
|
||||
@@ -1652,7 +1655,6 @@
|
||||
"Enable All": "启用全部",
|
||||
"Enable check-in feature": "启用签到功能",
|
||||
"Enable custom task plugins": "启用自定义任务插件",
|
||||
"Enable task plugins": "启用任务插件",
|
||||
"Enable Data Dashboard": "启用数据仪表板",
|
||||
"Enable demo mode with limited functionality": "启用功能受限的演示模式",
|
||||
"Enable Discord OAuth": "启用 Discord OAuth",
|
||||
@@ -1681,6 +1683,7 @@
|
||||
"Enable SSRF Protection": "启用 SSRF 保护",
|
||||
"Enable STARTTLS": "启用 STARTTLS",
|
||||
"Enable streaming mode for the test request.": "为测试请求启用流式模式。",
|
||||
"Enable task plugins": "启用任务插件",
|
||||
"Enable Telegram OAuth": "启用 Telegram OAuth",
|
||||
"Enable test mode for Creem payments": "启用 Creem 支付测试模式",
|
||||
"Enable this key?": "启用此密钥?",
|
||||
@@ -1792,7 +1795,6 @@
|
||||
"Enterprise-grade security with comprehensive permission management": "企业级安全性,提供全面的权限管理",
|
||||
"Entrypoint (space separated)": "入口点 (空格分隔)",
|
||||
"Enum": "枚举",
|
||||
"Boolean": "布尔",
|
||||
"Enum values": "枚举值",
|
||||
"Env (JSON object)": "环境变量 (JSON 对象)",
|
||||
"Environment variables": "环境变量",
|
||||
@@ -1877,6 +1879,7 @@
|
||||
"extras": "额外项",
|
||||
"Factory": "出厂",
|
||||
"Factory and custom plugin behavior": "出厂与自定义插件行为",
|
||||
"Factory and custom plugins all stop serving immediately. In-flight tasks will be handled by timeout cleanup.": "出厂插件和自定义插件将立即停止服务。进行中的任务将由超时清理处理。",
|
||||
"Factory plugins cannot be deleted or disabled individually. A custom version can override them; deleting or disabling that version restores the factory plugin. Third-party-only platforms become unavailable when their plugin is deleted or disabled.": "出厂插件不可删除或单独禁用。自定义版本可覆盖出厂版;删除或禁用自定义版会恢复出厂版。纯第三方平台的插件被删除或禁用后将不可用。",
|
||||
"Fail Reason": "失败原因",
|
||||
"Fail Reason Details": "失败原因详情",
|
||||
@@ -2040,8 +2043,8 @@
|
||||
"Fetch available models for:": "获取可用模型:",
|
||||
"Fetch available models from upstream": "从上游获取可用模型",
|
||||
"Fetch from Upstream": "从上游获取",
|
||||
"Fetch Models": "获取模型",
|
||||
"Fetch mode": "拉取模式",
|
||||
"Fetch Models": "获取模型",
|
||||
"Fetched {{count}} model(s) from upstream": "从上游获取了 {{count}} 个模型",
|
||||
"Fetched {{count}} models": "已获取 {{count}} 个模型",
|
||||
"Fetched in your browser and placed in the source field below for review. GitHub and gist page URLs are rewritten to their raw URL automatically.": "由浏览器拉取并填入下方源码框供你审查。GitHub 与 gist 页面 URL 会自动改写为 raw URL。",
|
||||
@@ -2879,6 +2882,7 @@
|
||||
"Models exposed by this channel": "此渠道暴露的模型",
|
||||
"Models fetched successfully": "模型获取成功",
|
||||
"Models filled to form": "模型已填充到表单",
|
||||
"Models listed here skip automatic -thinking / -nothinking suffix handling. Matched names are also exempt from @-modifier parsing and 400 validation. Prefix an entry with re: to match the full model name as a Go regular expression, for example re:.*@sha256:.*": "此处列出的模型不会自动添加或移除 -thinking / -nothinking 后缀。命中的模型同时豁免 @ 修饰符解析与 400 校验。以 re: 开头的条目会按 Go 正则匹配完整模型名,例如 re:.*@sha256:.*。",
|
||||
"Models listed here will not automatically append or remove -thinking / -nothinking suffixes.": "此处列出的模型不会自动添加或移除 -thinking / -nothinking 后缀。",
|
||||
"Models losing positions": "排名下滑的模型",
|
||||
"Models losing the most positions": "名次下滑最多的模型",
|
||||
@@ -2964,9 +2968,9 @@
|
||||
"Native Claude Messages plus OpenAI Chat compatibility forwarding.": "Claude Messages 原生转发,并兼容 OpenAI Chat 转换。",
|
||||
"Native format": "原生格式",
|
||||
"Native forwarding": "原生转发",
|
||||
"Native routes": "原生路由",
|
||||
"Native Gemini routes plus OpenAI Chat and Responses compatibility forwarding.": "Gemini 原生转发,并兼容 OpenAI Chat 和 Responses 转换。",
|
||||
"Native OpenAI routes plus optional Claude and Gemini compatibility routes.": "OpenAI 原生转发,并提供可选的 Claude 和 Gemini 兼容转换。",
|
||||
"Native routes": "原生路由",
|
||||
"Need a redemption code?": "需要兑换码?",
|
||||
"Needs API key": "需要 API 密钥",
|
||||
"Nested JSON defining per-group rules for adding (+:), removing (-:), or appending usable groups.": "嵌套 JSON,定义按分组添加(+:)、移除(-:)或追加可用分组的规则。",
|
||||
@@ -3334,6 +3338,7 @@
|
||||
"Optional JSON policy to restrict access based on user info fields": "可选的 JSON 策略,用于基于用户信息字段限制访问",
|
||||
"Optional minimum recharge amount for this method.": "此方法的可选最低充值金额。",
|
||||
"Optional multiplier per user group used when calculating recharge pricing. Provide a JSON object such as": "计算充值定价时使用的每个用户分组可选乘数。请提供一个 JSON 对象,例如",
|
||||
"Optional note describing this version": "可选,用于描述该版本的备注",
|
||||
"Optional notes about this channel": "关于此渠道的可选备注",
|
||||
"Optional notes about when to use this group": "关于何时使用此分组的可选说明",
|
||||
"Optional ratio used when upstream cache hits occur.": "上游缓存命中时使用的可选比率。",
|
||||
@@ -3614,11 +3619,6 @@
|
||||
"Plugin key": "插件键",
|
||||
"Plugin metadata": "插件元数据",
|
||||
"Plugin source": "插件源码",
|
||||
"Choose file": "选择文件",
|
||||
"Choose another file": "重新选择文件",
|
||||
"Drop a JavaScript plugin file here": "将 JavaScript 插件文件拖放到此处",
|
||||
"Single .js file, up to 1 MiB. Its source is shown below before upload.": "单个 .js 文件,最大 1 MiB。上传前会在下方显示其源码。",
|
||||
"Optional note describing this version": "可选,用于描述该版本的备注",
|
||||
"Plugin source exceeds the 1 MiB limit.": "插件源码超过 1 MiB 上限。",
|
||||
"Plugin uploaded successfully": "插件上传成功",
|
||||
"Plugin version activated": "插件版本已激活",
|
||||
@@ -3639,8 +3639,8 @@
|
||||
"Pre-Consume for Free Models": "免费模型预消耗",
|
||||
"Pre-consumed": "预扣费",
|
||||
"Pre-Consumed Quota": "预消耗配额",
|
||||
"Preference saved as {{pref}}, but no active subscription. Wallet will be used automatically.": "已保存偏好为{{pref}},当前无生效订阅,将自动使用钱包",
|
||||
"Preference saved as {{pref}}, but no active subscription. Requests will be rejected.": "已保存偏好为{{pref}},当前无生效订阅,请求将被拒绝",
|
||||
"Preference saved as {{pref}}, but no active subscription. Wallet will be used automatically.": "已保存偏好为{{pref}},当前无生效订阅,将自动使用钱包",
|
||||
"Preferences": "偏好设置",
|
||||
"Prefill Group Management": "预填充分组管理",
|
||||
"Prefill Groups": "预填充分组",
|
||||
@@ -4452,6 +4452,7 @@
|
||||
"Simple": "简洁",
|
||||
"Simple mode only returns message; status code and error type use system defaults.": "简洁模式仅返回 message;状态码和错误类型将使用系统默认值。",
|
||||
"Simple mode: prune objects by type, e.g. redacted_thinking.": "简洁模式:按 type 全量清理对象,例如 redacted_thinking。",
|
||||
"Single .js file, up to 1 MiB. Its source is shown below before upload.": "单个 .js 文件,最大 1 MiB。上传前会在下方显示其源码。",
|
||||
"Single Key": "单密钥",
|
||||
"Site & Branding": "站点与品牌",
|
||||
"Site Key": "站点密钥",
|
||||
@@ -4679,8 +4680,8 @@
|
||||
"Task logs": "任务日志",
|
||||
"Task Logs": "任务日志",
|
||||
"Task Plugin": "任务插件",
|
||||
"Task plugin setting updated": "任务插件设置已更新",
|
||||
"Task plugin *": "任务插件 *",
|
||||
"Task plugin setting updated": "任务插件设置已更新",
|
||||
"Task Plugins": "任务插件",
|
||||
"Task pricing": "任务定价",
|
||||
"Task pricing not configured": "尚未配置任务定价",
|
||||
@@ -4791,7 +4792,6 @@
|
||||
"Third-party plugin risk": "第三方插件风险",
|
||||
"Third-party source risk": "第三方源风险",
|
||||
"Third-party-only plugins become unavailable immediately. In-flight tasks will be handled by timeout cleanup.": "纯第三方插件将立即不可用,在途任务将由超时清理处理。",
|
||||
"Factory and custom plugins all stop serving immediately. In-flight tasks will be handled by timeout cleanup.": "出厂插件和自定义插件将立即停止服务。进行中的任务将由超时清理处理。",
|
||||
"This action cannot be undone.": "此操作无法撤消。",
|
||||
"This action cannot be undone. This will permanently delete your account and remove all your data from our servers.": "此操作无法撤消。这将永久删除您的账户并从我们的服务器中移除您的所有数据。",
|
||||
"This action will permanently remove 2FA protection from your account.": "此操作将永久移除您账户的 2FA 保护。",
|
||||
@@ -5137,6 +5137,7 @@
|
||||
"Updated successfully": "更新成功",
|
||||
"Updated system setting {{key}}": "修改系统设置 {{key}}",
|
||||
"Updated user {{username}} (ID: {{id}})": "更新用户 {{username}}(ID: {{id}})",
|
||||
"Updates with the system": "随系统更新",
|
||||
"Updating all channel balances. This may take a while. Please refresh to see results.": "正在更新所有渠道余额。这可能需要一段时间。请刷新以查看结果。",
|
||||
"Updating...": "正在更新...",
|
||||
"Upgrade {{name}}": "升级 {{name}}",
|
||||
@@ -5539,4 +5540,4 @@
|
||||
"Zhipu V4": "智谱 V4",
|
||||
"Zoom": "缩放"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user