Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/old-tomatoes-pump.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'token.js': patch
---

Fix: resolve error where new anthropic models do not work due to hardcoded max token limit
11 changes: 10 additions & 1 deletion src/handlers/anthropic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,17 @@ export const getDefaultMaxTokens = (model: string): number => {
model === 'claude-instant-1.2'
) {
return 4096
} else if (
model === 'claude-3-5-sonnet-latest' ||
model === 'claude-3-5-sonnet-20241022' ||
model === 'claude-3-7-sonnet-latest' ||
model === 'claude-3-7-sonnet-20250219' ||
model === 'claude-3-5-haiku-20241022'
) {
return 8192
} else {
throw new InputError(`Unknown model: ${model}`)
// We default to 8192 when the model is not specifically handled here to avoid throwing errors
return 8192
}
}

Expand Down