fix: ensure anthropic models on OR also have variant support (#13498)
This commit is contained in:
1
bun.lock
1
bun.lock
@@ -504,6 +504,7 @@
|
|||||||
"tree-sitter-bash",
|
"tree-sitter-bash",
|
||||||
],
|
],
|
||||||
"patchedDependencies": {
|
"patchedDependencies": {
|
||||||
|
"@openrouter/ai-sdk-provider@1.5.4": "patches/@openrouter%2Fai-sdk-provider@1.5.4.patch",
|
||||||
"@standard-community/standard-openapi@0.2.9": "patches/@standard-community%2Fstandard-openapi@0.2.9.patch",
|
"@standard-community/standard-openapi@0.2.9": "patches/@standard-community%2Fstandard-openapi@0.2.9.patch",
|
||||||
},
|
},
|
||||||
"overrides": {
|
"overrides": {
|
||||||
|
|||||||
@@ -103,6 +103,7 @@
|
|||||||
"@types/node": "catalog:"
|
"@types/node": "catalog:"
|
||||||
},
|
},
|
||||||
"patchedDependencies": {
|
"patchedDependencies": {
|
||||||
"@standard-community/standard-openapi@0.2.9": "patches/@standard-community%2Fstandard-openapi@0.2.9.patch"
|
"@standard-community/standard-openapi@0.2.9": "patches/@standard-community%2Fstandard-openapi@0.2.9.patch",
|
||||||
|
"@openrouter/ai-sdk-provider@1.5.4": "patches/@openrouter%2Fai-sdk-provider@1.5.4.patch"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -361,7 +361,7 @@ export namespace ProviderTransform {
|
|||||||
|
|
||||||
switch (model.api.npm) {
|
switch (model.api.npm) {
|
||||||
case "@openrouter/ai-sdk-provider":
|
case "@openrouter/ai-sdk-provider":
|
||||||
if (!model.id.includes("gpt") && !model.id.includes("gemini-3")) return {}
|
if (!model.id.includes("gpt") && !model.id.includes("gemini-3") && !model.id.includes("claude")) return {}
|
||||||
return Object.fromEntries(OPENAI_EFFORTS.map((effort) => [effort, { reasoning: { effort } }]))
|
return Object.fromEntries(OPENAI_EFFORTS.map((effort) => [effort, { reasoning: { effort } }]))
|
||||||
|
|
||||||
case "@ai-sdk/gateway":
|
case "@ai-sdk/gateway":
|
||||||
@@ -763,6 +763,9 @@ export namespace ProviderTransform {
|
|||||||
result["promptCacheKey"] = input.sessionID
|
result["promptCacheKey"] = input.sessionID
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (input.model.providerID === "openrouter") {
|
||||||
|
result["prompt_cache_key"] = input.sessionID
|
||||||
|
}
|
||||||
if (input.model.api.npm === "@ai-sdk/gateway") {
|
if (input.model.api.npm === "@ai-sdk/gateway") {
|
||||||
result["gateway"] = {
|
result["gateway"] = {
|
||||||
caching: "auto",
|
caching: "auto",
|
||||||
|
|||||||
128
patches/@openrouter%2Fai-sdk-provider@1.5.4.patch
Normal file
128
patches/@openrouter%2Fai-sdk-provider@1.5.4.patch
Normal file
@@ -0,0 +1,128 @@
|
|||||||
|
diff --git a/dist/index.js b/dist/index.js
|
||||||
|
index f33510a50d11a2cb92a90ea70cc0ac84c89f29b9..e887a60352c0c08ab794b1e6821854dfeefd20cc 100644
|
||||||
|
--- a/dist/index.js
|
||||||
|
+++ b/dist/index.js
|
||||||
|
@@ -2110,7 +2110,12 @@ var OpenRouterChatLanguageModel = class {
|
||||||
|
if (reasoningStarted && !textStarted) {
|
||||||
|
controller.enqueue({
|
||||||
|
type: "reasoning-end",
|
||||||
|
- id: reasoningId || generateId()
|
||||||
|
+ id: reasoningId || generateId(),
|
||||||
|
+ providerMetadata: accumulatedReasoningDetails.length > 0 ? {
|
||||||
|
+ openrouter: {
|
||||||
|
+ reasoning_details: accumulatedReasoningDetails
|
||||||
|
+ }
|
||||||
|
+ } : undefined
|
||||||
|
});
|
||||||
|
reasoningStarted = false;
|
||||||
|
}
|
||||||
|
@@ -2307,7 +2312,12 @@ var OpenRouterChatLanguageModel = class {
|
||||||
|
if (reasoningStarted) {
|
||||||
|
controller.enqueue({
|
||||||
|
type: "reasoning-end",
|
||||||
|
- id: reasoningId || generateId()
|
||||||
|
+ id: reasoningId || generateId(),
|
||||||
|
+ providerMetadata: accumulatedReasoningDetails.length > 0 ? {
|
||||||
|
+ openrouter: {
|
||||||
|
+ reasoning_details: accumulatedReasoningDetails
|
||||||
|
+ }
|
||||||
|
+ } : undefined
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (textStarted) {
|
||||||
|
diff --git a/dist/index.mjs b/dist/index.mjs
|
||||||
|
index 8a688331b88b4af738ee4ca8062b5f24124d3d81..6310cb8b7c8d0a728d86e1eed09906c6b4c91ae2 100644
|
||||||
|
--- a/dist/index.mjs
|
||||||
|
+++ b/dist/index.mjs
|
||||||
|
@@ -2075,7 +2075,12 @@ var OpenRouterChatLanguageModel = class {
|
||||||
|
if (reasoningStarted && !textStarted) {
|
||||||
|
controller.enqueue({
|
||||||
|
type: "reasoning-end",
|
||||||
|
- id: reasoningId || generateId()
|
||||||
|
+ id: reasoningId || generateId(),
|
||||||
|
+ providerMetadata: accumulatedReasoningDetails.length > 0 ? {
|
||||||
|
+ openrouter: {
|
||||||
|
+ reasoning_details: accumulatedReasoningDetails
|
||||||
|
+ }
|
||||||
|
+ } : undefined
|
||||||
|
});
|
||||||
|
reasoningStarted = false;
|
||||||
|
}
|
||||||
|
@@ -2272,7 +2277,12 @@ var OpenRouterChatLanguageModel = class {
|
||||||
|
if (reasoningStarted) {
|
||||||
|
controller.enqueue({
|
||||||
|
type: "reasoning-end",
|
||||||
|
- id: reasoningId || generateId()
|
||||||
|
+ id: reasoningId || generateId(),
|
||||||
|
+ providerMetadata: accumulatedReasoningDetails.length > 0 ? {
|
||||||
|
+ openrouter: {
|
||||||
|
+ reasoning_details: accumulatedReasoningDetails
|
||||||
|
+ }
|
||||||
|
+ } : undefined
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (textStarted) {
|
||||||
|
diff --git a/dist/internal/index.js b/dist/internal/index.js
|
||||||
|
index d40fa66125941155ac13a4619503caba24d89f8a..8dd86d1b473f2fa31c1acd9881d72945b294a197 100644
|
||||||
|
--- a/dist/internal/index.js
|
||||||
|
+++ b/dist/internal/index.js
|
||||||
|
@@ -2064,7 +2064,12 @@ var OpenRouterChatLanguageModel = class {
|
||||||
|
if (reasoningStarted && !textStarted) {
|
||||||
|
controller.enqueue({
|
||||||
|
type: "reasoning-end",
|
||||||
|
- id: reasoningId || generateId()
|
||||||
|
+ id: reasoningId || generateId(),
|
||||||
|
+ providerMetadata: accumulatedReasoningDetails.length > 0 ? {
|
||||||
|
+ openrouter: {
|
||||||
|
+ reasoning_details: accumulatedReasoningDetails
|
||||||
|
+ }
|
||||||
|
+ } : undefined
|
||||||
|
});
|
||||||
|
reasoningStarted = false;
|
||||||
|
}
|
||||||
|
@@ -2261,7 +2266,12 @@ var OpenRouterChatLanguageModel = class {
|
||||||
|
if (reasoningStarted) {
|
||||||
|
controller.enqueue({
|
||||||
|
type: "reasoning-end",
|
||||||
|
- id: reasoningId || generateId()
|
||||||
|
+ id: reasoningId || generateId(),
|
||||||
|
+ providerMetadata: accumulatedReasoningDetails.length > 0 ? {
|
||||||
|
+ openrouter: {
|
||||||
|
+ reasoning_details: accumulatedReasoningDetails
|
||||||
|
+ }
|
||||||
|
+ } : undefined
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (textStarted) {
|
||||||
|
diff --git a/dist/internal/index.mjs b/dist/internal/index.mjs
|
||||||
|
index b0ed9d113549c5c55ea3b1e08abb3db6f92ae5a7..5695930a8e038facc071d58a4179a369a29be9c7 100644
|
||||||
|
--- a/dist/internal/index.mjs
|
||||||
|
+++ b/dist/internal/index.mjs
|
||||||
|
@@ -2030,7 +2030,12 @@ var OpenRouterChatLanguageModel = class {
|
||||||
|
if (reasoningStarted && !textStarted) {
|
||||||
|
controller.enqueue({
|
||||||
|
type: "reasoning-end",
|
||||||
|
- id: reasoningId || generateId()
|
||||||
|
+ id: reasoningId || generateId(),
|
||||||
|
+ providerMetadata: accumulatedReasoningDetails.length > 0 ? {
|
||||||
|
+ openrouter: {
|
||||||
|
+ reasoning_details: accumulatedReasoningDetails
|
||||||
|
+ }
|
||||||
|
+ } : undefined
|
||||||
|
});
|
||||||
|
reasoningStarted = false;
|
||||||
|
}
|
||||||
|
@@ -2227,7 +2232,12 @@ var OpenRouterChatLanguageModel = class {
|
||||||
|
if (reasoningStarted) {
|
||||||
|
controller.enqueue({
|
||||||
|
type: "reasoning-end",
|
||||||
|
- id: reasoningId || generateId()
|
||||||
|
+ id: reasoningId || generateId(),
|
||||||
|
+ providerMetadata: accumulatedReasoningDetails.length > 0 ? {
|
||||||
|
+ openrouter: {
|
||||||
|
+ reasoning_details: accumulatedReasoningDetails
|
||||||
|
+ }
|
||||||
|
+ } : undefined
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (textStarted) {
|
||||||
Reference in New Issue
Block a user