Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ const providerTypeEnum = z.enum([
'lmstudio',
'bedrock',
'browseros',
'morpheus',
])

/**
Expand Down
9 changes: 9 additions & 0 deletions apps/agent/entrypoints/app/ai-settings/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export interface ModelsData {
lmstudio: ModelInfo[]
bedrock: ModelInfo[]
browseros: ModelInfo[]
morpheus: ModelInfo[]
}

/**
Expand Down Expand Up @@ -88,6 +89,14 @@ export const MODELS_DATA: ModelsData = {
],
bedrock: [],
browseros: [],
morpheus: [
{ modelId: 'glm-5', contextLength: 131072 },
{ modelId: 'kimi-k2.5', contextLength: 131072 },
{ modelId: 'hermes-3-llama-3.1-405b', contextLength: 131072 },
{ modelId: 'qwen3-235b', contextLength: 131072 },
{ modelId: 'deepseek-r1-0528', contextLength: 131072 },
{ modelId: 'llama-4-maverick', contextLength: 131072 },
],
}

/**
Expand Down
12 changes: 12 additions & 0 deletions apps/agent/lib/llm-providers/providerTemplates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,16 @@ export const providerTemplates: ProviderTemplate[] = [
setupGuideUrl:
'https://docs.aws.amazon.com/bedrock/latest/userguide/getting-started.html',
},
{
id: 'morpheus',
name: 'Morpheus',
defaultBaseUrl: 'https://api.mor.org/api/v1',
defaultModelId: 'glm-5',
supportsImages: false,
contextWindow: 131072,
apiKeyUrl: 'https://app.mor.org',
setupGuideUrl: 'https://apidocs.mor.org',
},
]

/**
Expand All @@ -129,6 +139,7 @@ export const providerTypeOptions: { value: ProviderType; label: string }[] = [
{ value: 'lmstudio', label: 'LM Studio' },
{ value: 'bedrock', label: 'AWS Bedrock' },
{ value: 'browseros', label: 'BrowserOS' },
{ value: 'morpheus', label: 'Morpheus' },
]

/**
Expand Down Expand Up @@ -156,6 +167,7 @@ export const DEFAULT_BASE_URLS: Record<ProviderType, string> = {
lmstudio: 'http://localhost:1234/v1',
bedrock: '',
browseros: '',
morpheus: 'https://api.mor.org/api/v1',
}

/**
Expand Down
1 change: 1 addition & 0 deletions apps/agent/lib/llm-providers/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export type ProviderType =
| 'lmstudio'
| 'bedrock'
| 'browseros'
| 'morpheus'

/**
* LLM Provider configuration
Expand Down
12 changes: 12 additions & 0 deletions apps/server/src/agent/tool-loop/provider-factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,17 @@ function createOpenAICompatibleFactory(
})
}

function createMorpheusFactory(
config: ResolvedAgentConfig,
): (modelId: string) => unknown {
if (!config.apiKey) throw new Error('Morpheus provider requires apiKey')
return createOpenAICompatible({
name: 'morpheus',
baseURL: config.baseUrl || 'https://api.mor.org/api/v1',
apiKey: config.apiKey,
})
}

const PROVIDER_FACTORIES: Record<string, ProviderFactory> = {
[LLM_PROVIDERS.ANTHROPIC]: createAnthropicFactory,
[LLM_PROVIDERS.OPENAI]: createOpenAIFactory,
Expand All @@ -147,6 +158,7 @@ const PROVIDER_FACTORIES: Record<string, ProviderFactory> = {
[LLM_PROVIDERS.BEDROCK]: createBedrockFactory,
[LLM_PROVIDERS.BROWSEROS]: createBrowserOSFactory,
[LLM_PROVIDERS.OPENAI_COMPATIBLE]: createOpenAICompatibleFactory,
[LLM_PROVIDERS.MORPHEUS]: createMorpheusFactory,
}

export function createLanguageModel(
Expand Down
10 changes: 10 additions & 0 deletions apps/server/src/lib/clients/llm/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,15 @@ function createOpenAICompatibleModel(config: ResolvedLLMConfig): LanguageModel {
})(config.model)
}

function createMorpheusModel(config: ResolvedLLMConfig): LanguageModel {
if (!config.apiKey) throw new Error('Morpheus provider requires apiKey')
return createOpenAICompatible({
name: 'morpheus',
baseURL: config.baseUrl || 'https://api.mor.org/api/v1',
apiKey: config.apiKey,
})(config.model)
}

const PROVIDER_FACTORIES: Record<string, ProviderFactory> = {
[LLM_PROVIDERS.ANTHROPIC]: createAnthropicModel,
[LLM_PROVIDERS.OPENAI]: createOpenAIModel,
Expand All @@ -135,6 +144,7 @@ const PROVIDER_FACTORIES: Record<string, ProviderFactory> = {
[LLM_PROVIDERS.BEDROCK]: createBedrockModel,
[LLM_PROVIDERS.BROWSEROS]: createBrowserOSModel,
[LLM_PROVIDERS.OPENAI_COMPATIBLE]: createOpenAICompatibleModel,
[LLM_PROVIDERS.MORPHEUS]: createMorpheusModel,
}

export function createLLMProvider(config: ResolvedLLMConfig): LanguageModel {
Expand Down
3 changes: 3 additions & 0 deletions packages/shared/src/schemas/llm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export const LLM_PROVIDERS = {
BEDROCK: 'bedrock',
BROWSEROS: 'browseros',
OPENAI_COMPATIBLE: 'openai-compatible',
MORPHEUS: 'morpheus',
} as const

/**
Expand All @@ -40,6 +41,7 @@ export const LLMProviderSchema: z.ZodEnum<
'bedrock',
'browseros',
'openai-compatible',
'morpheus',
]
> = z.enum([
LLM_PROVIDERS.ANTHROPIC,
Expand All @@ -52,6 +54,7 @@ export const LLMProviderSchema: z.ZodEnum<
LLM_PROVIDERS.BEDROCK,
LLM_PROVIDERS.BROWSEROS,
LLM_PROVIDERS.OPENAI_COMPATIBLE,
LLM_PROVIDERS.MORPHEUS,
])

export type LLMProvider = z.infer<typeof LLMProviderSchema>
Expand Down
Loading