Files
twenty/packages/twenty-server/src/engine/metadata-modules/ai/ai-models/constants/anthropic-models.const.ts
T
Félix Malfait 41f09c5a4c Add AI model pricing, Bedrock provider, and InferenceProvider/ModelFamily split (#18155)
## Summary

- **Model pricing overhaul**: All model constants updated with accurate
pricing in dollars per 1M tokens, including cached input rates, cache
creation rates, and tiered >200k context pricing
- **New providers**: Added Google (Gemini 3.x), Mistral, and AWS Bedrock
as inference providers. Bedrock serves Claude Opus 4.6 and Sonnet 4.6
via AWS, with proper credential handling following the existing S3/SES
pattern
- **InferenceProvider/ModelFamily split**: Refactored `ModelProvider`
into two orthogonal enums — `InferenceProvider` (who serves the model:
auth, SDK, metadata format) and `ModelFamily` (who created it: token
counting semantics). This eliminates growing `||` chains for token
normalization checks like `excludesCachedTokens`
- **Billing improvements**: Reasoning tokens charged at output rate,
cache token discounts applied accurately, real errors thrown to Sentry
on billing failures

## Test plan

- [x] All existing unit tests updated and passing (23 tests across 3
test files)
- [x] Lint passes for both twenty-server and twenty-front
- [ ] CI checks pass


Made with [Cursor](https://cursor.com)

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-22 14:39:04 +01:00

270 lines
7.3 KiB
TypeScript

import {
type AIModelConfig,
InferenceProvider,
ModelFamily,
} from './ai-models-types.const';
export const ANTHROPIC_MODELS: AIModelConfig[] = [
// Active models
{
modelId: 'claude-opus-4-6',
label: 'Claude Opus 4.6',
description:
'Flagship Claude model for software engineering, scientific reasoning, and agent teams',
modelFamily: ModelFamily.ANTHROPIC,
inferenceProvider: InferenceProvider.ANTHROPIC,
inputCostPerMillionTokens: 5.0,
outputCostPerMillionTokens: 25.0,
cachedInputCostPerMillionTokens: 0.5,
cacheCreationCostPerMillionTokens: 6.25,
longContextCost: {
inputCostPerMillionTokens: 10.0,
outputCostPerMillionTokens: 37.5,
cachedInputCostPerMillionTokens: 1.0,
cacheCreationCostPerMillionTokens: 12.5,
thresholdTokens: 200_000,
},
contextWindowTokens: 1000000,
maxOutputTokens: 128000,
supportedFileTypes: [
'image/png',
'image/jpeg',
'image/gif',
'image/webp',
'application/pdf',
'text/plain',
'text/html',
'text/csv',
],
doesSupportThinking: true,
nativeCapabilities: {
webSearch: true,
},
},
{
modelId: 'claude-sonnet-4-6',
label: 'Claude Sonnet 4.6',
description:
'Most capable Sonnet model with strong coding, computer use, and agent planning',
modelFamily: ModelFamily.ANTHROPIC,
inferenceProvider: InferenceProvider.ANTHROPIC,
inputCostPerMillionTokens: 3.0,
outputCostPerMillionTokens: 15.0,
cachedInputCostPerMillionTokens: 0.3,
cacheCreationCostPerMillionTokens: 3.75,
longContextCost: {
inputCostPerMillionTokens: 6.0,
outputCostPerMillionTokens: 22.5,
cachedInputCostPerMillionTokens: 0.6,
cacheCreationCostPerMillionTokens: 7.5,
thresholdTokens: 200_000,
},
contextWindowTokens: 200000,
maxOutputTokens: 64000,
supportedFileTypes: [
'image/png',
'image/jpeg',
'image/gif',
'image/webp',
'application/pdf',
'text/plain',
'text/html',
'text/csv',
],
doesSupportThinking: true,
nativeCapabilities: {
webSearch: true,
},
},
{
modelId: 'claude-sonnet-4-5-20250929',
label: 'Claude Sonnet 4.5',
description:
'Previous gen Sonnet with 1M native context for long-context workflows',
modelFamily: ModelFamily.ANTHROPIC,
inferenceProvider: InferenceProvider.ANTHROPIC,
inputCostPerMillionTokens: 3.0,
outputCostPerMillionTokens: 15.0,
cachedInputCostPerMillionTokens: 0.3,
cacheCreationCostPerMillionTokens: 3.75,
longContextCost: {
inputCostPerMillionTokens: 6.0,
outputCostPerMillionTokens: 22.5,
cachedInputCostPerMillionTokens: 0.6,
cacheCreationCostPerMillionTokens: 7.5,
thresholdTokens: 200_000,
},
contextWindowTokens: 1000000,
maxOutputTokens: 64000,
supportedFileTypes: [
'image/png',
'image/jpeg',
'image/gif',
'image/webp',
'application/pdf',
'text/plain',
'text/html',
'text/csv',
],
doesSupportThinking: true,
nativeCapabilities: {
webSearch: true,
},
},
{
modelId: 'claude-haiku-4-5-20251001',
label: 'Claude Haiku 4.5',
description: 'Fast and cost-effective model for high-speed processing',
modelFamily: ModelFamily.ANTHROPIC,
inferenceProvider: InferenceProvider.ANTHROPIC,
inputCostPerMillionTokens: 1.0,
outputCostPerMillionTokens: 5.0,
cachedInputCostPerMillionTokens: 0.1,
cacheCreationCostPerMillionTokens: 1.25,
contextWindowTokens: 200000,
maxOutputTokens: 64000,
supportedFileTypes: [
'image/png',
'image/jpeg',
'image/gif',
'image/webp',
'application/pdf',
'text/plain',
'text/html',
'text/csv',
],
doesSupportThinking: false,
nativeCapabilities: {
webSearch: true,
},
},
// Deprecated models - kept for backward compatibility with existing agents
{
modelId: 'claude-opus-4-5-20251101',
label: 'Claude Opus 4.5',
description: 'Previous flagship model superseded by Opus 4.6',
modelFamily: ModelFamily.ANTHROPIC,
inferenceProvider: InferenceProvider.ANTHROPIC,
inputCostPerMillionTokens: 5.0,
outputCostPerMillionTokens: 25.0,
cachedInputCostPerMillionTokens: 0.5,
cacheCreationCostPerMillionTokens: 6.25,
longContextCost: {
inputCostPerMillionTokens: 10.0,
outputCostPerMillionTokens: 37.5,
cachedInputCostPerMillionTokens: 1.0,
cacheCreationCostPerMillionTokens: 12.5,
thresholdTokens: 200_000,
},
contextWindowTokens: 200000,
maxOutputTokens: 64000,
supportedFileTypes: [
'image/png',
'image/jpeg',
'image/gif',
'image/webp',
'application/pdf',
'text/plain',
'text/html',
'text/csv',
],
doesSupportThinking: true,
nativeCapabilities: {
webSearch: true,
},
deprecated: true,
},
{
modelId: 'claude-sonnet-4-20250514',
label: 'Claude Sonnet 4',
description: 'Previous gen Sonnet superseded by Sonnet 4.6',
modelFamily: ModelFamily.ANTHROPIC,
inferenceProvider: InferenceProvider.ANTHROPIC,
inputCostPerMillionTokens: 3.0,
outputCostPerMillionTokens: 15.0,
cachedInputCostPerMillionTokens: 0.3,
cacheCreationCostPerMillionTokens: 3.75,
longContextCost: {
inputCostPerMillionTokens: 6.0,
outputCostPerMillionTokens: 22.5,
cachedInputCostPerMillionTokens: 0.6,
cacheCreationCostPerMillionTokens: 7.5,
thresholdTokens: 200_000,
},
contextWindowTokens: 200000,
maxOutputTokens: 8192,
supportedFileTypes: [
'image/png',
'image/jpeg',
'image/gif',
'image/webp',
'application/pdf',
'text/plain',
'text/html',
'text/csv',
],
doesSupportThinking: true,
nativeCapabilities: {
webSearch: true,
},
deprecated: true,
},
{
modelId: 'claude-opus-4-20250514',
label: 'Claude Opus 4',
description: 'Legacy Opus model with extended thinking',
modelFamily: ModelFamily.ANTHROPIC,
inferenceProvider: InferenceProvider.ANTHROPIC,
inputCostPerMillionTokens: 15.0,
outputCostPerMillionTokens: 75.0,
cachedInputCostPerMillionTokens: 1.5,
cacheCreationCostPerMillionTokens: 18.75,
contextWindowTokens: 200000,
maxOutputTokens: 8192,
supportedFileTypes: [
'image/png',
'image/jpeg',
'image/gif',
'image/webp',
'application/pdf',
'text/plain',
'text/html',
'text/csv',
],
doesSupportThinking: true,
nativeCapabilities: {
webSearch: true,
},
deprecated: true,
},
{
modelId: 'claude-3-5-haiku-20241022',
label: 'Claude Haiku 3.5',
description: 'Legacy fast model superseded by Haiku 4.5',
modelFamily: ModelFamily.ANTHROPIC,
inferenceProvider: InferenceProvider.ANTHROPIC,
inputCostPerMillionTokens: 0.8,
outputCostPerMillionTokens: 4.0,
cachedInputCostPerMillionTokens: 0.08,
cacheCreationCostPerMillionTokens: 1.0,
contextWindowTokens: 200000,
maxOutputTokens: 8192,
supportedFileTypes: [
'image/png',
'image/jpeg',
'image/gif',
'image/webp',
'application/pdf',
'text/plain',
'text/html',
'text/csv',
],
doesSupportThinking: false,
nativeCapabilities: {
webSearch: true,
},
deprecated: true,
},
];