@@ -85,7 +85,7 @@ export const isInternalProvider = (key: string): key is InternalProvider =>
8585 * Custom providers are completely configurable within Roo Code settings.
8686 */
8787
88- export const customProviders = [ "openai" ] as const
88+ export const customProviders = [ "openai" , "anthropic-custom" ] as const
8989
9090export type CustomProvider = ( typeof customProviders ) [ number ]
9191
@@ -262,6 +262,15 @@ const openAiSchema = baseProviderSettingsSchema.extend({
262262 openAiHeaders : z . record ( z . string ( ) , z . string ( ) ) . optional ( ) ,
263263} )
264264
265+ const anthropicCustomSchema = baseProviderSettingsSchema . extend ( {
266+ anthropicCustomBaseUrl : z . string ( ) . optional ( ) ,
267+ anthropicCustomApiKey : z . string ( ) . optional ( ) ,
268+ anthropicCustomModelId : z . string ( ) . optional ( ) ,
269+ anthropicCustomModelInfo : modelInfoSchema . nullish ( ) ,
270+ anthropicCustomStreamingEnabled : z . boolean ( ) . optional ( ) ,
271+ anthropicCustomHeaders : z . record ( z . string ( ) , z . string ( ) ) . optional ( ) ,
272+ } )
273+
265274const ollamaSchema = baseProviderSettingsSchema . extend ( {
266275 ollamaModelId : z . string ( ) . optional ( ) ,
267276 ollamaBaseUrl : z . string ( ) . optional ( ) ,
@@ -427,6 +436,7 @@ export const providerSettingsSchemaDiscriminated = z.discriminatedUnion("apiProv
427436 bedrockSchema . merge ( z . object ( { apiProvider : z . literal ( "bedrock" ) } ) ) ,
428437 vertexSchema . merge ( z . object ( { apiProvider : z . literal ( "vertex" ) } ) ) ,
429438 openAiSchema . merge ( z . object ( { apiProvider : z . literal ( "openai" ) } ) ) ,
439+ anthropicCustomSchema . merge ( z . object ( { apiProvider : z . literal ( "anthropic-custom" ) } ) ) ,
430440 ollamaSchema . merge ( z . object ( { apiProvider : z . literal ( "ollama" ) } ) ) ,
431441 vsCodeLmSchema . merge ( z . object ( { apiProvider : z . literal ( "vscode-lm" ) } ) ) ,
432442 lmStudioSchema . merge ( z . object ( { apiProvider : z . literal ( "lmstudio" ) } ) ) ,
@@ -463,6 +473,7 @@ export const providerSettingsSchema = z.object({
463473 ...bedrockSchema . shape ,
464474 ...vertexSchema . shape ,
465475 ...openAiSchema . shape ,
476+ ...anthropicCustomSchema . shape ,
466477 ...ollamaSchema . shape ,
467478 ...vsCodeLmSchema . shape ,
468479 ...lmStudioSchema . shape ,
@@ -512,6 +523,7 @@ export const modelIdKeys = [
512523 "apiModelId" ,
513524 "openRouterModelId" ,
514525 "openAiModelId" ,
526+ "anthropicCustomModelId" ,
515527 "ollamaModelId" ,
516528 "lmStudioModelId" ,
517529 "lmStudioDraftModelId" ,
@@ -575,7 +587,7 @@ export const modelIdKeysByProvider: Record<TypicalProvider, ModelIdKey> = {
575587 */
576588
577589// Providers that use Anthropic-style API protocol.
578- export const ANTHROPIC_STYLE_PROVIDERS : ProviderName [ ] = [ "anthropic" , "bedrock" , "minimax" ]
590+ export const ANTHROPIC_STYLE_PROVIDERS : ProviderName [ ] = [ "anthropic" , "anthropic-custom" , " bedrock", "minimax" ]
579591
580592export const getApiProtocol = ( provider : ProviderName | undefined , modelId ?: string ) : "anthropic" | "openai" => {
581593 if ( provider && ANTHROPIC_STYLE_PROVIDERS . includes ( provider ) ) {
@@ -615,7 +627,7 @@ export const getApiProtocol = (provider: ProviderName | undefined, modelId?: str
615627 */
616628
617629export const MODELS_BY_PROVIDER : Record <
618- Exclude < ProviderName , "fake-ai" | "gemini-cli" | "openai" > ,
630+ Exclude < ProviderName , "fake-ai" | "gemini-cli" | "openai" | "anthropic-custom" > ,
619631 { id : ProviderName ; label : string ; models : string [ ] }
620632> = {
621633 anthropic : {
0 commit comments