|
|
@@ -596,8 +596,16 @@ function openaiCompatibleReasoningEfforts(id: string) {
|
|
|
return gpt5CodexReasoningEfforts(apiId) ?? versionedGpt5ReasoningEfforts(apiId) ?? OPENAI_EFFORTS
|
|
|
}
|
|
|
|
|
|
+function anthropicOpus47OrLater(apiId: string) {
|
|
|
+ const version = /opus-(\d+)[.-](\d+)(?:[.-]|$)/i.exec(apiId)
|
|
|
+ if (!version) return false
|
|
|
+ const major = Number(version[1])
|
|
|
+ const minor = Number(version[2])
|
|
|
+ return major > 4 || (major === 4 && minor >= 7)
|
|
|
+}
|
|
|
+
|
|
|
function anthropicAdaptiveEfforts(apiId: string): string[] | null {
|
|
|
- if (["opus-4-7", "opus-4.7"].some((v) => apiId.includes(v))) {
|
|
|
+ if (anthropicOpus47OrLater(apiId)) {
|
|
|
return ["low", "medium", "high", "xhigh", "max"]
|
|
|
}
|
|
|
if (["opus-4-6", "opus-4.6", "sonnet-4-6", "sonnet-4.6"].some((v) => apiId.includes(v))) {
|
|
|
@@ -625,6 +633,7 @@ export function variants(model: Provider.Model): Record<string, Record<string, a
|
|
|
if (!model.capabilities.reasoning) return {}
|
|
|
|
|
|
const id = model.id.toLowerCase()
|
|
|
+ const adaptiveOpus = anthropicOpus47OrLater(model.api.id)
|
|
|
const adaptiveEfforts = anthropicAdaptiveEfforts(model.api.id)
|
|
|
if (
|
|
|
id.includes("deepseek-chat") ||
|
|
|
@@ -833,9 +842,7 @@ export function variants(model: Provider.Model): Record<string, Record<string, a
|
|
|
{
|
|
|
thinking: {
|
|
|
type: "adaptive",
|
|
|
- ...(model.api.id.includes("opus-4-7") || model.api.id.includes("opus-4.7")
|
|
|
- ? { display: "summarized" }
|
|
|
- : {}),
|
|
|
+ ...(adaptiveOpus ? { display: "summarized" } : {}),
|
|
|
},
|
|
|
effort,
|
|
|
},
|
|
|
@@ -872,9 +879,7 @@ export function variants(model: Provider.Model): Record<string, Record<string, a
|
|
|
reasoningConfig: {
|
|
|
type: "adaptive",
|
|
|
maxReasoningEffort: effort,
|
|
|
- ...(model.api.id.includes("opus-4-7") || model.api.id.includes("opus-4.7")
|
|
|
- ? { display: "summarized" }
|
|
|
- : {}),
|
|
|
+ ...(adaptiveOpus ? { display: "summarized" } : {}),
|
|
|
},
|
|
|
},
|
|
|
]),
|