Skip to content

Commit 0dab40f

Browse files
author
Aditya Puranik
committed
feat(copilot): add LiteLLM model support
1 parent ae55966 commit 0dab40f

File tree

7 files changed

+12
-11
lines changed

7 files changed

+12
-11
lines changed

apps/sim/app/api/copilot/chat/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const ChatMessageSchema = z.object({
4141
userMessageId: z.string().optional(), // ID from frontend for the user message
4242
chatId: z.string().optional(),
4343
workflowId: z.string().min(1, 'Workflow ID is required'),
44-
model: z.enum(COPILOT_MODEL_IDS).optional().default('claude-4.5-opus'),
44+
model: z.enum(COPILOT_MODEL_IDS).optional().default('claude-4.5-opus'),
4545
mode: z.enum(COPILOT_REQUEST_MODES).optional().default('agent'),
4646
prefetch: z.boolean().optional(),
4747
createNewChat: z.boolean().optional().default(false),

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/user-input/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ export const MODEL_OPTIONS = [
241241
{ value: 'gpt-5.2-codex', label: 'GPT 5.2 Codex' },
242242
{ value: 'gpt-5.2-pro', label: 'GPT 5.2 Pro' },
243243
{ value: 'gemini-3-pro', label: 'Gemini 3 Pro' },
244+
{ value: 'litellm', label: 'LiteLLM' },
244245
] as const
245246

246247
/**

apps/sim/components/icons.tsx

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3683,14 +3683,9 @@ export function LiteLLMIcon(props: SVGProps<SVGSVGElement>) {
36833683
return (
36843684
<svg {...props} viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'>
36853685
<title>LiteLLM</title>
3686-
<path
3687-
d='M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5'
3688-
stroke='#10B981'
3689-
strokeWidth='2'
3690-
strokeLinecap='round'
3691-
strokeLinejoin='round'
3692-
fill='none'
3693-
/>
3686+
<text x='12' y='17' fontSize='16' textAnchor='middle' dominantBaseline='middle'>
3687+
🚅
3688+
</text>
36943689
</svg>
36953690
)
36963691
}

apps/sim/lib/copilot/api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export interface SendMessageRequest {
6666
userMessageId?: string // ID from frontend for the user message
6767
chatId?: string
6868
workflowId?: string
69-
mode?: CopilotMode | CopilotTransportMode
69+
mode?: CopilotMode | CopilotTransportMode
7070
model?: CopilotModelId
7171
prefetch?: boolean
7272
createNewChat?: boolean

apps/sim/lib/copilot/config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ const VALID_PROVIDER_IDS: readonly ProviderId[] = [
1919
'mistral',
2020
'groq',
2121
'ollama',
22+
'litellm',
2223
] as const
2324

2425
/**

apps/sim/lib/copilot/models.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export const COPILOT_MODEL_IDS = [
2121
'claude-4.5-opus',
2222
'claude-4.1-opus',
2323
'gemini-3-pro',
24+
'litellm',
2425
] as const
2526

2627
export type CopilotModelId = (typeof COPILOT_MODEL_IDS)[number]

apps/sim/providers/utils.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,10 @@ export function getProviderFromModel(model: string): ProviderId {
170170

171171
let providerId: ProviderId | null = null
172172

173-
if (normalizedModel in getAllModelProviders()) {
173+
// Check if the model is actually a provider ID (e.g., "litellm" from copilot selector)
174+
if (normalizedModel in providers) {
175+
providerId = normalizedModel as ProviderId
176+
} else if (normalizedModel in getAllModelProviders()) {
174177
providerId = getAllModelProviders()[normalizedModel]
175178
} else {
176179
for (const [id, config] of Object.entries(providers)) {

0 commit comments

Comments
 (0)