MCPcopy Index your code
hub / github.com/simstudioai/sim / getMaxOutputTokensForModel

Function getMaxOutputTokensForModel

apps/sim/providers/models.ts:3746–3764  ·  view source on GitHub ↗
(modelId: string)

Source from the content-addressed store, hash-verified

3744 * @param modelId - The model ID
3745 */
3746export function getMaxOutputTokensForModel(modelId: string): number {
3747 const normalizedModelId = modelId.toLowerCase()
3748 const STANDARD_MAX_OUTPUT_TOKENS = 4096
3749 const allModels = Object.values(PROVIDER_DEFINITIONS).flatMap((provider) => provider.models)
3750
3751 const exactMatch = allModels.find((model) => model.id.toLowerCase() === normalizedModelId)
3752 if (exactMatch) {
3753 return exactMatch.capabilities.maxOutputTokens || STANDARD_MAX_OUTPUT_TOKENS
3754 }
3755
3756 for (const model of allModels) {
3757 const baseModelId = model.id.toLowerCase()
3758 if (normalizedModelId.startsWith(`${baseModelId}-`)) {
3759 return model.capabilities.maxOutputTokens || STANDARD_MAX_OUTPUT_TOKENS
3760 }
3761 }
3762
3763 return STANDARD_MAX_OUTPUT_TOKENS
3764}

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected