fix: add bedrock to ANTHROPIC_STYLE_PROVIDERS for correct token counting

- Added 'bedrock' to ANTHROPIC_STYLE_PROVIDERS array to ensure Bedrock provider uses Anthropic-style API protocol
- This fixes incorrect token counting for AWS Bedrock when using Claude models
- Resolves issue #6004 where token count was showing unrealistic values
This commit is contained in:
Daniel Riccio 2025-07-21 08:32:17 -05:00
parent 47235e0b00
commit c962050437
No known key found for this signature in database
GPG key ID: FFD5FD825F8E8209

View file

@ -301,9 +301,14 @@ export const getModelId = (settings: ProviderSettings): string | undefined => {
}
// Providers that use Anthropic-style API protocol
export const ANTHROPIC_STYLE_PROVIDERS: ProviderName[] = ["anthropic", "claude-code"]
export const ANTHROPIC_STYLE_PROVIDERS: ProviderName[] = ["anthropic", "claude-code", "bedrock"]
// Helper function to determine API protocol for a provider
export const getApiProtocol = (provider: ProviderName | undefined): "anthropic" | "openai" => {
return provider && ANTHROPIC_STYLE_PROVIDERS.includes(provider) ? "anthropic" : "openai"
// Check if provider uses Anthropic-style API by default
if (provider && ANTHROPIC_STYLE_PROVIDERS.includes(provider)) {
return "anthropic"
}
// Default to OpenAI style
return "openai"
}