Skip to content

Commit b965f70

Browse files
committed
chore(litellm): validate /v1/models response with shared schema in initialize()
Match the API route handler — both code paths now run the same vllmUpstreamResponseSchema.parse() over the upstream /v1/models JSON instead of a raw type-cast, so malformed upstream payloads surface a descriptive ZodError instead of a downstream TypeError. Addresses Greptile review feedback on PR #4739.
1 parent 4185090 commit b965f70

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

apps/sim/providers/litellm/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ export const litellmProvider: ProviderConfig = {
6767
return
6868
}
6969

70-
const data = (await response.json()) as { data: Array<{ id: string }> }
70+
const { vllmUpstreamResponseSchema } = await import('@/lib/api/contracts/providers')
71+
const data = vllmUpstreamResponseSchema.parse(await response.json())
7172
const models = data.data.map((model) => `litellm/${model.id}`)
7273

7374
this.models = models

0 commit comments

Comments
 (0)