MCPcopy Create free account
hub / github.com/oboard/claude-code-rev / getModelOptions

Function getModelOptions

src/utils/model/modelOptions.ts:502–577  ·  view source on GitHub ↗
(fastMode = false)

Source from the content-addressed store, hash-verified

500}
501
502export function getModelOptions(fastMode = false): ModelOption[] {
503 const options = getModelOptionsBase(fastMode)
504 const hasConfiguredCustomModels = getConfiguredCustomModelOptions().length > 0
505
506 // Add the custom model from the ANTHROPIC_CUSTOM_MODEL_OPTION env var
507 const envCustomModel = process.env.ANTHROPIC_CUSTOM_MODEL_OPTION
508 if (
509 envCustomModel &&
510 !options.some(existing => existing.value === envCustomModel)
511 ) {
512 options.push({
513 value: envCustomModel,
514 label: process.env.ANTHROPIC_CUSTOM_MODEL_OPTION_NAME ?? envCustomModel,
515 description:
516 process.env.ANTHROPIC_CUSTOM_MODEL_OPTION_DESCRIPTION ??
517 `Custom model (${envCustomModel})`,
518 })
519 }
520
521 // Append additional model options fetched during bootstrap
522 for (const opt of getGlobalConfig().additionalModelOptionsCache ?? []) {
523 if (!options.some(existing => existing.value === opt.value)) {
524 options.push(opt)
525 }
526 }
527
528 // Add custom model from either the current model value or the initial one
529 // if it is not already in the options.
530 let customModel: ModelSetting = null
531 const currentMainLoopModel = getUserSpecifiedModelSetting()
532 const initialMainLoopModel = getInitialMainLoopModel()
533 if (currentMainLoopModel !== undefined && currentMainLoopModel !== null) {
534 customModel = currentMainLoopModel
535 } else if (initialMainLoopModel !== null) {
536 customModel = initialMainLoopModel
537 }
538 if (hasConfiguredCustomModels) {
539 if (customModel !== null && !options.some(opt => opt.value === customModel)) {
540 options.push({
541 value: customModel,
542 label: customModel,
543 description: 'Current model',
544 })
545 }
546 return filterModelOptionsByAllowlist(options)
547 }
548 if (customModel === null || options.some(opt => opt.value === customModel)) {
549 return filterModelOptionsByAllowlist(options)
550 } else if (customModel === 'opusplan') {
551 return filterModelOptionsByAllowlist([...options, getOpusPlanOption()])
552 } else if (customModel === 'opus' && getAPIProvider() === 'firstParty') {
553 return filterModelOptionsByAllowlist([
554 ...options,
555 getMaxOpusOption(fastMode),
556 ])
557 } else if (customModel === 'opus[1m]' && getAPIProvider() === 'firstParty') {
558 return filterModelOptionsByAllowlist([
559 ...options,

Callers 4

generateModelSectionFunction · 0.85
ModelPickerFunction · 0.85
runHeadlessStreamingFunction · 0.85

Calls 11

getModelOptionsBaseFunction · 0.85
getGlobalConfigFunction · 0.85
getInitialMainLoopModelFunction · 0.85
getOpusPlanOptionFunction · 0.85
getAPIProviderFunction · 0.85
getMaxOpusOptionFunction · 0.85
getMergedOpus1MOptionFunction · 0.85
getKnownModelOptionFunction · 0.85

Tested by

no test coverage detected