|
|
@@ -7,6 +7,7 @@ import (
|
|
|
"net/http"
|
|
|
"one-api/common"
|
|
|
"one-api/dto"
|
|
|
+ "one-api/relay/channel/openrouter"
|
|
|
relaycommon "one-api/relay/common"
|
|
|
"one-api/relay/helper"
|
|
|
"one-api/service"
|
|
|
@@ -122,6 +123,21 @@ func RequestOpenAI2ClaudeMessage(textRequest dto.GeneralOpenAIRequest) (*dto.Cla
|
|
|
claudeRequest.Model = strings.TrimSuffix(textRequest.Model, "-thinking")
|
|
|
}
|
|
|
|
|
|
+ if textRequest.Reasoning != nil {
|
|
|
+ var reasoning openrouter.RequestReasoning
|
|
|
+ if err := json.Unmarshal(textRequest.Reasoning, &reasoning); err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ budgetTokens := reasoning.MaxTokens
|
|
|
+ if budgetTokens > 0 {
|
|
|
+ claudeRequest.Thinking = &dto.Thinking{
|
|
|
+ Type: "enabled",
|
|
|
+ BudgetTokens: budgetTokens,
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
if textRequest.Stop != nil {
|
|
|
// stop maybe string/array string, convert to array string
|
|
|
switch textRequest.Stop.(type) {
|