diff --git a/.changeset/few-swans-reply.md b/.changeset/few-swans-reply.md new file mode 100644 index 0000000..ddba445 --- /dev/null +++ b/.changeset/few-swans-reply.md @@ -0,0 +1,5 @@ +--- +'token.js': patch +--- + +fix unknown model error add max tokens for missing anthropic models diff --git a/src/handlers/anthropic.ts b/src/handlers/anthropic.ts index d356239..8567d20 100644 --- a/src/handlers/anthropic.ts +++ b/src/handlers/anthropic.ts @@ -341,9 +341,19 @@ export const getDefaultMaxTokens = (model: string): number => { model === 'claude-instant-1.2' ) { return 4096 - } else { - throw new InputError(`Unknown model: ${model}`) } + + 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 + } + + throw new InputError(`Unknown model: ${model}`) } export const convertMessages = async (