(apiId: string)
| 598 | } |
| 599 | |
| 600 | function anthropicOpus47OrLater(apiId: string) { |
| 601 | // Matches "opus-4.7" (Anthropic/Bedrock/Vertex) and "claude-4.7-opus" (SAP AI Core inverted). |
| 602 | // Greedy \d+ correctly extends to multi-digit majors (e.g. "claude-10.0-opus") for forward compatibility. |
| 603 | const version = /opus-(\d+)[.-](\d+)(?:[.@-]|$)|claude-(\d+)[.-](\d+)-opus(?:[.@-]|$)/i.exec(apiId) |
| 604 | if (!version) return false |
| 605 | const major = Number(version[1] ?? version[3]) |
| 606 | const minor = Number(version[2] ?? version[4]) |
| 607 | return major > 4 || (major === 4 && minor >= 7) |
| 608 | } |
| 609 | |
| 610 | function anthropicSonnet5OrLater(apiId: string) { |
| 611 | const version = /sonnet-(\d+)(?:[.@-]|$)|claude-(\d+)-sonnet(?:[.@-]|$)/i.exec(apiId) |
no outgoing calls
no test coverage detected