Merge pull request #1016 from yuanhaitao/fix/block-1m-context-window

fix: 拦截 1M 上下文窗口请求,避免账户被误标记为限流
This commit is contained in:
Wesley Liddick
2026-02-26 09:00:14 +08:00
committed by GitHub

View File

@@ -197,6 +197,17 @@ async function handleMessagesRequest(req, res) {
}
}
// 拦截 1M 上下文窗口请求anthropic-beta 包含 context-1m
const betaHeader = (req.headers['anthropic-beta'] || '').toLowerCase()
if (betaHeader.includes('context-1m')) {
return res.status(403).json({
error: {
type: 'forbidden',
message: '暂不支持 1M 上下文窗口,请切换为非 [1m] 模型'
}
})
}
logger.api('📥 /v1/messages request received', {
model: req.body.model || null,
forcedVendor,