mirror of
https://github.com/Wei-Shaw/claude-relay-service.git
synced 2026-03-30 00:33:35 +00:00
Merge pull request #1016 from yuanhaitao/fix/block-1m-context-window
fix: 拦截 1M 上下文窗口请求,避免账户被误标记为限流
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user