Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

feat: add new app connection

adilson5ae0399f6c66
diff --git a/backend/src/lib/api-docs/constants.ts b/backend/src/lib/api-docs/constants.ts
index dfb0556800..bf32a2de3f 100644
--- a/backend/src/lib/api-docs/constants.ts
+++ b/backend/src/lib/api-docs/constants.ts
@@ -2938,6 +2938,10 @@ export const AppConnections = {
ANTHROPIC: {
apiKey: "The Anthropic API key used to authenticate with the Anthropic API."
},
+ LITELLM: {
+ apiKey: "The LiteLLM API key used to authenticate with the LiteLLM instance.",
+ instanceUrl: "The base URL of your LiteLLM instance (e.g. https://litellm.example.com)."
+ },
CLOUD66: {
accessToken: "The Personal Access Token used to authenticate with the Cloud 66 API."
},
diff --git a/backend/src/server/routes/v1/app-connection-routers/app-connection-router.ts b/backend/src/server/routes/v1/app-connection-routers/app-connection-router.ts
index 9a93b574d8..df0e55024a 100644
--- a/backend/src/server/routes/v1/app-connection-routers/app-connection-router.ts
+++ b/backend/src/server/routes/v1/app-connection-routers/app-connection-router.ts
@@ -142,6 +142,10 @@ import {
SanitizedLaravelForgeConnectionSchema
} from "@app/services/app-connection/laravel-forge";
import { LdapConnectionListItemSchema, SanitizedLdapConnectionSchema } from "@app/services/app-connection/ldap";
+import {
+ LiteLLMConnectionListItemSchema,
+ SanitizedLiteLLMConnectionSchema
+} from "@app/services/app-connection/litellm";
import {
MongoDBConnectionListItemSchema,
SanitizedMongoDBConnectionSchema
@@ -308,7 +312,8 @@ const SanitizedAppConnectionSchema = z.union([
...SanitizedF5BigIpConnectionSchema.options,
...SanitizedConvexConnectionSchema.options,
...SanitizedRundeckConnectionSchema.options,
- ...SanitizedQoveryConnectionSchema.options
+ ...SanitizedQoveryConnectionSchema.options,
+ ...SanitizedLiteLLMConnectionSchema.options
]);
const AppConnectionOptionsSchema = z.discriminatedUnion("app", [
@@ -386,7 +391,8 @@ const AppConnectionOptionsSchema = z.discriminatedUnion("app", [
F5BigIpConnectionListItemSchema,
ConvexConnectionListItemSchema,
RundeckConnectionListItemSchema,
- QoveryConnectionListItemSchema
+ QoveryConnectionListItemSchema,
+ LiteLLMConnectionListItemSchema
]);
export const registerAppConnectionRouter = async (server: FastifyZodProvider) => {
diff --git a/backend/src/server/routes/v1/app-connection-routers/index.ts b/backend/src/server/routes/v1/app-connection-routers/index.ts
index 09a16e81b8..1e4e1f55d7 100644
--- a/backend/src/server/routes/v1/app-connection-routers/index.ts
+++ b/backend/src/server/routes/v1/app-connection-routers/index.ts
@@ -44,6 +44,7 @@ import { registerHerokuConnectionRouter } from "./heroku-connection-router";
import { registerHumanitecConnectionRouter } from "./humanitec-connection-router";
import { registerLaravelForgeConnectionRouter } from "./laravel-forge-connection-router";
import { registerLdapConnectionRouter } from "./ldap-connection-router";
+import { registerLiteLLMConnectionRouter } from "./litellm-connection-router";
import { registerMongoDBConnectionRouter } from "./mongodb-connection-router";
import { registerMsSqlConnectionRouter } from "./mssql-connection-router";
import { registerMySqlConnectionRouter } from "./mysql-connection-router";
@@ -154,5 +155,6 @@ export const APP_CONNECTION_REGISTER_ROUTER_MAP: Record<AppConnection, (server:
[AppConnection.Convex]: registerConvexConnectionRouter,
[AppConnection.Rundeck]: registerRundeckConnectionRouter,
[AppConnection.HasuraCloud]: registerHasuraCloudConnectionRouter,
- [AppConnection.Qovery]: registerQoveryConnectionRouter
+ [AppConnection.Qovery]: registerQoveryConnectionRouter,
+ [AppConnection.LiteLLM]: registerLiteLLMConnectionRouter
};
diff --git a/backend/src/server/routes/v1/app-connection-routers/litellm-connection-router.ts b/backend/src/server/routes/v1/app-connection-routers/litellm-connection-router.ts
new file mode 100644
index 0000000000..27eecfdba5
--- /dev/null
+++ b/backend/src/server/routes/v1/app-connection-routers/litellm-connection-router.ts
@@ -0,0 +1,18 @@
+import { AppConnection } from "@app/services/app-connection/app-connection-enums";
+import {
+ CreateLiteLLMConnectionSchema,
+ SanitizedLiteLLMConnectionSchema,
+ UpdateLiteLLMConnectionSchema
+} from "@app/services/app-connection/litellm";
+
+import { registerAppConnectionEndpoints } from "./app-connection-endpoints";
+
+export const registerLiteLLMConnectionRouter = async (server: FastifyZodProvider) => {
+ registerAppConnectionEndpoints({
+ app: AppConnection.LiteLLM,
+ server,
+ sanitizedResponseSchema: SanitizedLiteLLMConnectionSchema,
+ createSchema: CreateLiteLLMConnectionSchema,
+ updateSchema: UpdateLiteLLMConnectionSchema
+ });
+};
diff --git a/backend/src/services/app-connection/app-connection-enums.ts b/backend/src/services/app-connection/app-connection-enums.ts
index 08448fb66b..8870e32496 100644
--- a/backend/src/services/app-connection/app-connection-enums.ts
+++ b/backend/src/services/app-connection/app-connection-enums.ts
@@ -73,7 +73,8 @@ export enum AppConnection {
Rundeck = "rundeck",
HasuraCloud = "hasura-cloud",
Qovery = "qovery",
- Cloud66 = "cloud-66"
+ Cloud66 = "cloud-66",
+ LiteLLM = "litellm"
}
export enum AWSRegion {
diff --git a/backend/src/services/app-connection/app-connection-fns.ts b/backend/src/services/app-connection/app-connection-fns.ts
index a0329b4c77..43edd1bac8 100644
--- a/backend/src/services/app-connection/app-connection-fns.ts
+++ b/backend/src/services/app-connection/app-connection-fns.ts
@@ -188,6 +188,7 @@ import {
validateLaravelForgeConnectionCredentials
} from "./laravel-forge";
import { getLdapConnectionListItem, LdapConnectionMethod, validateLdapConnectionCredentials } from "./ldap";
+import { getLiteLLMConnectionListItem, LiteLLMConnectionMethod, validateLiteLLMConnectionCredentials } from "./litellm";
import { getMongoDBConnectionListItem, MongoDBConnectionMethod, validateMongoDBConnectionCredentials } from "./mongodb";
import { getMsSqlConnectionListItem, MsSqlConnectionMethod } from "./mssql";
import { MySqlConnectionMethod } from "./mysql/mysql-connection-enums";
@@ -382,7 +383,8 @@ export const listAppConnectionOptions = (projectType?: ProjectType) => {
getF5BigIpConnectionListItem(),
getConvexConnectionListItem(),
getRundeckConnectionListItem(),
- getQoveryConnectionListItem()
+ getQoveryConnectionListItem(),
+ getLiteLLMConnectionListItem()
]
.filter((option) => {
switch (projectType) {
@@ -628,7 +630,8 @@ export const validateAppConnectionCredentials = async (
[AppConnection.F5BigIp]: validateF5BigIpConnectionCredentials as TAppConnectionCredentialsValidator,
[AppConnection.Convex]: validateConvexConnectionCredentials as TAppConnectionCredentialsValidator,
[AppConnection.Rundeck]: validateRundeckConnectionCredentials as TAppConnectionCredentialsValidator,
- [AppConnection.Qovery]: validateQoveryConnectionCredentials as TAppConnectionCredentialsValidator
+ [AppConnection.Qovery]: validateQoveryConnectionCredentials as TAppConnectionCredentialsValidator,
+ [AppConnection.LiteLLM]: validateLiteLLMConnectionCredentials as TAppConnectionCredentialsValidator
};
return VALIDATE_APP_CONNECTION_CREDENTIALS_MAP[appConnection.app](appConnection, gatewayService, gatewayV2Service);
@@ -724,6 +727,7 @@ export const getAppConnectionMethodName = (method: TAppConnection["method"]) =>
case OctopusDeployConnectionMethod.ApiKey:
case OpenRouterConnectionMethod.ApiKey:
case AnthropicConnectionMethod.ApiKey:
+ case LiteLLMConnectionMethod.ApiKey:
case DevinConnectionMethod.ApiKey:
case DigiCertConnectionMethod.ApiKey:
case DatadogConnectionMethod.ApiKey:
@@ -881,7 +885,8 @@ export const TRANSITION_CONNECTION_CREDENTIALS_TO_PLATFORM: Record<
[AppConnection.GoDaddy]: platformManagedCredentialsNotSupported,
[AppConnection.Convex]: platformManagedCredentialsNotSupported,
[AppConnection.Rundeck]: platformManagedCredentialsNotSupported,
- [AppConnection.Qovery]: platformManagedCredentialsNotSupported
+ [AppConnection.Qovery]: platformManagedCredentialsNotSupported,
+ [AppConnection.LiteLLM]: platformManagedCredentialsNotSupported
};
export const enterpriseAppCheck = async (
diff --git a/backend/src/services/app-connection/app-connection-maps.ts b/backend/src/services/app-connection/app-connection-maps.ts
index 9d9708399d..a4957ca6d3 100644
--- a/backend/src/services/app-connection/app-connection-maps.ts
+++ b/backend/src/services/app-connection/app-connection-maps.ts
@@ -75,7 +75,8 @@ export const APP_CONNECTION_NAME_MAP: Record<AppConnection, string> = {
[AppConnection.Rundeck]: "Rundeck",
[AppConnection.HasuraCloud]: "Hasura Cloud",
[AppConnection.Qovery]: "Qovery",
- [AppConnection.Cloud66]: "Cloud 66"
+ [AppConnection.Cloud66]: "Cloud 66",
+ [AppConnection.LiteLLM]: "LiteLLM"
};
export const APP_CONNECTION_PLAN_MAP: Record<AppConnection, AppConnectionPlanType> = {
@@ -153,5 +154,6 @@ export const APP_CONNECTION_PLAN_MAP: Record<AppConnection, AppConnectionPlanTyp
[AppConnection.Rundeck]: AppConnectionPlanType.Regular,
[AppConnection.HasuraCloud]: AppConnectionPlanType.Regular,
[AppConnection.Qovery]: AppConnectionPlanType.Regular,
- [AppConnection.Cloud66]: AppConnectionPlanType.Regular
+ [AppConnection.Cloud66]: AppConnectionPlanType.Regular,
+ [AppConnection.LiteLLM]: AppConnectionPlanType.Regular
};
diff --git a/backend/src/services/app-connection/app-connection-service.ts b/backend/src/services/app-connection/app-connection-service.ts
index 3bc411fc06..1c8ec52dc1 100644
--- a/backend/src/services/app-connection/app-connection-service.ts
+++ b/backend/src/services/app-connection/app-connection-service.ts
@@ -132,6 +132,7 @@ import { humanitecConnectionService } from "./humanitec/humanitec-connection-ser
import { ValidateLaravelForgeConnectionCredentialsSchema } from "./laravel-forge";
import { laravelForgeConnectionService } from "./laravel-forge/laravel-forge-connection-service";
import { ValidateLdapConnectionCredentialsSchema } from "./ldap";
+import { ValidateLiteLLMConnectionCredentialsSchema } from "./litellm";
import { ValidateMongoDBConnectionCredentialsSchema } from "./mongodb";
import { ValidateMsSqlConnectionCredentialsSchema } from "./mssql";
import { ValidateMySqlConnectionCredentialsSchema } from "./mysql";
@@ -281,7 +282,8 @@ const VALIDATE_APP_CONNECTION_CREDENTIALS_MAP: Record<AppConnection, TValidateAp
[AppConnection.F5BigIp]: ValidateF5BigIpConnectionCredentialsSchema,
[AppConnection.Convex]: ValidateConvexConnectionCredentialsSchema,
[AppConnection.Rundeck]: ValidateRundeckConnectionCredentialsSchema,
- [AppConnection.Qovery]: ValidateQoveryConnectionCredentialsSchema
+ [AppConnection.Qovery]: ValidateQoveryConnectionCredentialsSchema,
+ [AppConnection.LiteLLM]: ValidateLiteLLMConnectionCredentialsSchema
};
export const appConnectionServiceFactory = ({
diff --git a/backend/src/services/app-connection/app-connection-types.ts b/backend/src/services/app-connection/app-connection-types.ts
index 0ac8082322..5974c05064 100644
--- a/backend/src/services/app-connection/app-connection-types.ts
+++ b/backend/src/services/app-connection/app-connection-types.ts
@@ -268,6 +268,12 @@ import {
TLdapConnectionInput,
TValidateLdapConnectionCredentialsSchema
} from "./ldap";
+import {
+ TLiteLLMConnection,
+ TLiteLLMConnectionConfig,
+ TLiteLLMConnectionInput,
+ TValidateLiteLLMConnectionCredentialsSchema
+} from "./litellm";
import {
TMongoDBConnection,
TMongoDBConnectionConfig,
@@ -522,6 +528,7 @@ export type TAppConnection = { id: string; configuration?: TAppConnectionConfigu
| TRundeckConnection
| THasuraCloudConnection
| TQoveryConnection
+ | TLiteLLMConnection
);
export type TAppConnectionRaw = NonNullable<Awaited<ReturnType<TAppConnectionDALFactory["findById"]>>>;
@@ -608,6 +615,7 @@ export type TAppConnectionInput = { id: string } & (
| TRundeckConnectionInput
| THasuraCloudConnectionInput
| TQoveryConnectionInput
+ | TLiteLLMConnectionInput
);
export type TSqlConnectionInput =
@@ -725,7 +733,8 @@ export type TAppConnectionConfig =
| TConvexConnectionConfig
| TRundeckConnectionConfig
| THasuraCloudConnectionConfig
- | TQoveryConnectionConfig;
+ | TQoveryConnectionConfig
+ | TLiteLLMConnectionConfig;
export type TValidateAppConnectionCredentialsSchema =
| TValidateAwsConnectionCredentialsSchema
@@ -802,7 +811,8 @@ export type TValidateAppConnectionCredentialsSchema =
| TValidateConvexConnectionCredentialsSchema
| TValidateRundeckConnectionCredentialsSchema
| TValidateHasuraCloudConnectionCredentialsSchema
- | TValidateQoveryConnectionCredentialsSchema;
+ | TValidateQoveryConnectionCredentialsSchema
+ | TValidateLiteLLMConnectionCredentialsSchema;
export type TListAwsConnectionKmsKeys = {
connectionId: string;
diff --git a/backend/src/services/app-connection/litellm/index.ts b/backend/src/services/app-connection/litellm/index.ts
new file mode 100644
index 0000000000..3751921d56
--- /dev/null
+++ b/backend/src/services/app-connection/litellm/index.ts
@@ -0,0 +1,4 @@
+export * from "./litellm-connection-enums";
+export * from "./litellm-connection-fns";
+export * from "./litellm-connection-schemas";
+export * from "./litellm-connection-types";
diff --git a/backend/src/services/app-connection/litellm/litellm-connection-enums.ts b/backend/src/services/app-connection/litellm/litellm-connection-enums.ts
new file mode 100644
index 0000000000..dc91e7b396
--- /dev/null
+++ b/backend/src/services/app-connection/litellm/litellm-connection-enums.ts
@@ -0,0 +1,3 @@
+export enum LiteLLMConnectionMethod {
+ ApiKey = "api-key"
+}
diff --git a/backend/src/services/app-connection/litellm/litellm-connection-fns.ts b/backend/src/services/app-connection/litellm/litellm-connection-fns.ts
new file mode 100644
index 0000000000..7ec807f8f9
--- /dev/null
+++ b/backend/src/services/app-connection/litellm/litellm-connection-fns.ts
@@ -0,0 +1,45 @@
+import { request } from "@app/lib/config/request";
+import { BadRequestError, UnauthorizedError } from "@app/lib/errors";
+import { removeTrailingSlash } from "@app/lib/fn/string";
+import { logger } from "@app/lib/logger";
+import { blockLocalAndPrivateIpAddresses } from "@app/lib/validator";
+import { AppConnection } from "@app/services/app-connection/app-connection-enums";
+
+import { LiteLLMConnectionMethod } from "./litellm-connection-enums";
+import { TLiteLLMConnectionConfig } from "./litellm-connection-types";
+
+export const getLiteLLMConnectionListItem = () => {
+ return {
+ name: "LiteLLM" as const,
+ app: AppConnection.LiteLLM as const,
+ methods: Object.values(LiteLLMConnectionMethod) as [LiteLLMConnectionMethod.ApiKey]
+ };
+};
+
+export const validateLiteLLMConnectionCredentials = async (config: TLiteLLMConnectionConfig) => {
+ const { apiKey, instanceUrl } = config.credentials;
+ const baseUrl = removeTrailingSlash(instanceUrl);
+
+ // Guard the user-supplied host against SSRF (blocks localhost/private IPs outside of dev mode)
+ await blockLocalAndPrivateIpAddresses(baseUrl);
+
+ try {
+ await request.get(`${baseUrl}/key/info`, {
+ headers: {
+ Authorization: `Bearer ${apiKey}`
+ },
+ validateStatus: (status) => status === 200
+ });
+ } catch (error: unknown) {
+ logger.error(error);
+ if (error instanceof BadRequestError) {
+ throw error;
+ }
+
+ throw new UnauthorizedError({
+ message: "Unable to validate connection: invalid API key or instance URL"
+ });
+ }
+
+ return config.credentials;
+};
diff --git a/backend/src/services/app-connection/litellm/litellm-connection-schemas.ts b/backend/src/services/app-connection/litellm/litellm-connection-schemas.ts
new file mode 100644
index 0000000000..5a4b2a5095
--- /dev/null
+++ b/backend/src/services/app-connection/litellm/litellm-connection-schemas.ts
@@ -0,0 +1,65 @@
+import z from "zod";
+
+import { AppConnections } from "@app/lib/api-docs";
+import { AppConnection } from "@app/services/app-connection/app-connection-enums";
+import {
+ BaseAppConnectionSchema,
+ GenericCreateAppConnectionFieldsSchema,
+ GenericUpdateAppConnectionFieldsSchema
+} from "@app/services/app-connection/app-connection-schemas";
+
+import { APP_CONNECTION_NAME_MAP } from "../app-connection-maps";
+import { LiteLLMConnectionMethod } from "./litellm-connection-enums";
+
+export const LiteLLMConnectionApiKeyCredentialsSchema = z.object({
+ apiKey: z.string().trim().min(1, "API Key required").describe(AppConnections.CREDENTIALS.LITELLM.apiKey),
+ instanceUrl: z
+ .string()
+ .trim()
+ .min(1, "Instance URL required")
+ .url("Invalid Instance URL")
+ .describe(AppConnections.CREDENTIALS.LITELLM.instanceUrl)
+});
+
+const BaseLiteLLMConnectionSchema = BaseAppConnectionSchema.extend({ app: z.literal(AppConnection.LiteLLM) });
+
+export const LiteLLMConnectionSchema = BaseLiteLLMConnectionSchema.extend({
+ method: z.literal(LiteLLMConnectionMethod.ApiKey),
+ credentials: LiteLLMConnectionApiKeyCredentialsSchema
+});
+
+export const SanitizedLiteLLMConnectionSchema = z.discriminatedUnion("method", [
+ BaseLiteLLMConnectionSchema.extend({
+ method: z.literal(LiteLLMConnectionMethod.ApiKey),
+ credentials: LiteLLMConnectionApiKeyCredentialsSchema.pick({ instanceUrl: true })
+ }).describe(JSON.stringify({ title: `${APP_CONNECTION_NAME_MAP[AppConnection.LiteLLM]} (API Key)` }))
+]);
+
+export const ValidateLiteLLMConnectionCredentialsSchema = z.discriminatedUnion("method", [
+ z.object({
+ method: z.literal(LiteLLMConnectionMethod.ApiKey).describe(AppConnections.CREATE(AppConnection.LiteLLM).method),
+ credentials: LiteLLMConnectionApiKeyCredentialsSchema.describe(
+ AppConnections.CREATE(AppConnection.LiteLLM).credentials
+ )
+ })
+]);
+
+export const CreateLiteLLMConnectionSchema = ValidateLiteLLMConnectionCredentialsSchema.and(
+ GenericCreateAppConnectionFieldsSchema(AppConnection.LiteLLM)
+);
+
+export const UpdateLiteLLMConnectionSchema = z
+ .object({
+ credentials: LiteLLMConnectionApiKeyCredentialsSchema.optional().describe(
+ AppConnections.UPDATE(AppConnection.LiteLLM).credentials
+ )
+ })
+ .and(GenericUpdateAppConnectionFieldsSchema(AppConnection.LiteLLM));
+
+export const LiteLLMConnectionListItemSchema = z
+ .object({
+ name: z.literal("LiteLLM"),
+ app: z.literal(AppConnection.LiteLLM),
+ methods: z.nativeEnum(LiteLLMConnectionMethod).array()
+ })
+ .describe(JSON.stringify({ title: APP_CONNECTION_NAME_MAP[AppConnection.LiteLLM] }));
diff --git a/backend/src/services/app-connection/litellm/litellm-connection-types.ts b/backend/src/services/app-connection/litellm/litellm-connection-types.ts
new file mode 100644
index 0000000000..ee2a208d5f
--- /dev/null
+++ b/backend/src/services/app-connection/litellm/litellm-connection-types.ts
@@ -0,0 +1,22 @@
+import z from "zod";
+
+import { DiscriminativePick } from "@app/lib/types";
+
+import { AppConnection } from "../app-connection-enums";
+import {
+ CreateLiteLLMConnectionSchema,
+ LiteLLMConnectionSchema,
+ ValidateLiteLLMConnectionCredentialsSchema
+} from "./litellm-connection-schemas";
+
+export type TLiteLLMConnection = z.infer<typeof LiteLLMConnectionSchema>;
+
+export type TLiteLLMConnectionInput = z.infer<typeof CreateLiteLLMConnectionSchema> & {
+ app: AppConnection.LiteLLM;
+};
+
+export type TValidateLiteLLMConnectionCredentialsSchema = typeof ValidateLiteLLMConnectionCredentialsSchema;
+
+export type TLiteLLMConnectionConfig = DiscriminativePick<TLiteLLMConnectionInput, "method" | "app" | "credentials"> & {
+ orgId: string;
+};
diff --git a/frontend/src/helpers/appConnections.ts b/frontend/src/helpers/appConnections.ts
index ac8df2b1fe..1ef71dfb1f 100644
--- a/frontend/src/helpers/appConnections.ts
+++ b/frontend/src/helpers/appConnections.ts
@@ -71,6 +71,7 @@ import { GoDaddyConnectionMethod } from "@app/hooks/api/appConnections/types/god
import { HasuraCloudConnectionMethod } from "@app/hooks/api/appConnections/types/hasura-cloud-connection";
import { HerokuConnectionMethod } from "@app/hooks/api/appConnections/types/heroku-connection";
import { LaravelForgeConnectionMethod } from "@app/hooks/api/appConnections/types/laravel-forge-connection";
+import { LiteLLMConnectionMethod } from "@app/hooks/api/appConnections/types/litellm-connection";
import { NetlifyConnectionMethod } from "@app/hooks/api/appConnections/types/netlify-connection";
import { NetScalerConnectionMethod } from "@app/hooks/api/appConnections/types/netscaler-connection";
import { NorthflankConnectionMethod } from "@app/hooks/api/appConnections/types/northflank-connection";
@@ -475,6 +476,12 @@ export const APP_CONNECTION_MAP: Record<
category: "AI",
description: "Manage Anthropic API access."
},
+ [AppConnection.LiteLLM]: {
+ name: "LiteLLM",
+ image: "LiteLLM.png",
+ category: "AI",
+ description: "Manage LiteLLM API access."
+ },
[AppConnection.HasuraCloud]: {
name: "Hasura Cloud",
image: "Hasura.svg",
@@ -667,6 +674,7 @@ export const getAppConnectionMethodDetails = (method: TAppConnection["method"])
case ChecklyConnectionMethod.ApiKey:
case OpenRouterConnectionMethod.ApiKey:
case AnthropicConnectionMethod.ApiKey:
+ case LiteLLMConnectionMethod.ApiKey:
case DevinConnectionMethod.ApiKey:
case DigiCertConnectionMethod.ApiKey:
case GoDaddyConnectionMethod.ApiKey:
diff --git a/frontend/src/hooks/api/appConnections/enums.ts b/frontend/src/hooks/api/appConnections/enums.ts
index 7dc3e658f1..fb4420327b 100644
--- a/frontend/src/hooks/api/appConnections/enums.ts
+++ b/frontend/src/hooks/api/appConnections/enums.ts
@@ -73,5 +73,6 @@ export enum AppConnection {
Rundeck = "rundeck",
HasuraCloud = "hasura-cloud",
Qovery = "qovery",
- Cloud66 = "cloud-66"
+ Cloud66 = "cloud-66",
+ LiteLLM = "litellm"
}
diff --git a/frontend/src/hooks/api/appConnections/types/app-options.ts b/frontend/src/hooks/api/appConnections/types/app-options.ts
index b140e8802d..dcd10c21c8 100644
--- a/frontend/src/hooks/api/appConnections/types/app-options.ts
+++ b/frontend/src/hooks/api/appConnections/types/app-options.ts
@@ -259,6 +259,10 @@ export type TAnthropicConnectionOption = TAppConnectionOptionBase & {
app: AppConnection.Anthropic;
};
+export type TLiteLLMConnectionOption = TAppConnectionOptionBase & {
+ app: AppConnection.LiteLLM;
+};
+
export type TOvhConnectionOption = TAppConnectionOptionBase & {
app: AppConnection.OVH;
};
@@ -389,7 +393,8 @@ export type TAppConnectionOption =
| TTriggerDevConnectionOption
| TRundeckConnectionOption
| THasuraCloudConnectionOption
- | TQoveryConnectionOption;
+ | TQoveryConnectionOption
+ | TLiteLLMConnectionOption;
export type TAppConnectionOptionMap = {
[AppConnection.AWS]: TAwsConnectionOption;
@@ -467,4 +472,5 @@ export type TAppConnectionOptionMap = {
[AppConnection.Rundeck]: TRundeckConnectionOption;
[AppConnection.HasuraCloud]: THasuraCloudConnectionOption;
[AppConnection.Qovery]: TQoveryConnectionOption;
+ [AppConnection.LiteLLM]: TLiteLLMConnectionOption;
};
diff --git a/frontend/src/hooks/api/appConnections/types/index.ts b/frontend/src/hooks/api/appConnections/types/index.ts
index 8c2d7b8900..41849c532a 100644
--- a/frontend/src/hooks/api/appConnections/types/index.ts
+++ b/frontend/src/hooks/api/appConnections/types/index.ts
@@ -42,6 +42,7 @@ import { THerokuConnection } from "./heroku-connection";
import { THumanitecConnection } from "./humanitec-connection";
import { TLaravelForgeConnection } from "./laravel-forge-connection";
import { TLdapConnection } from "./ldap-connection";
+import { TLiteLLMConnection } from "./litellm-connection";
import { TMongoDBConnection } from "./mongodb-connection";
import { TMsSqlConnection } from "./mssql-connection";
import { TMySqlConnection } from "./mysql-connection";
@@ -115,6 +116,7 @@ export * from "./heroku-connection";
export * from "./humanitec-connection";
export * from "./laravel-forge-connection";
export * from "./ldap-connection";
+export * from "./litellm-connection";
export * from "./mongodb-connection";
export * from "./mssql-connection";
export * from "./mysql-connection";
@@ -224,7 +226,8 @@ export type TAppConnection =
| TTriggerDevConnection
| TRundeckConnection
| THasuraCloudConnection
- | TQoveryConnection;
+ | TQoveryConnection
+ | TLiteLLMConnection;
export type TAvailableAppConnection = Pick<TAppConnection, "name" | "id" | "projectId">;
diff --git a/frontend/src/hooks/api/appConnections/types/litellm-connection.ts b/frontend/src/hooks/api/appConnections/types/litellm-connection.ts
new file mode 100644
index 0000000000..e87a63352f
--- /dev/null
+++ b/frontend/src/hooks/api/appConnections/types/litellm-connection.ts
@@ -0,0 +1,14 @@
+import { AppConnection } from "@app/hooks/api/appConnections/enums";
+import { TRootAppConnection } from "@app/hooks/api/appConnections/types/root-connection";
+
+export enum LiteLLMConnectionMethod {
+ ApiKey = "api-key"
+}
+
+export type TLiteLLMConnection = TRootAppConnection & { app: AppConnection.LiteLLM } & {
+ method: LiteLLMConnectionMethod.ApiKey;
+ credentials: {
+ apiKey: string;
+ instanceUrl: string;
+ };
+};
diff --git a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AppConnectionForm.tsx b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AppConnectionForm.tsx
index 1e1d84b091..790ffc77a3 100644
--- a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AppConnectionForm.tsx
+++ b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AppConnectionForm.tsx
@@ -57,6 +57,7 @@ import { HerokuConnectionForm } from "./HerokuAppConnectionForm";
import { HumanitecConnectionForm } from "./HumanitecConnectionForm";
import { LaravelForgeConnectionForm } from "./LaravelForgeConnectionForm";
import { LdapConnectionForm } from "./LdapConnectionForm";
+import { LiteLLMConnectionForm } from "./LiteLLMConnectionForm";
import { MongoDBConnectionForm } from "./MongoDBConnectionForm";
import { MsSqlConnectionForm } from "./MsSqlConnectionForm";
import { MySqlConnectionForm } from "./MySqlConnectionForm";
@@ -299,6 +300,8 @@ const CreateForm = ({ app, onComplete, projectId }: CreateFormProps) => {
return <OpenRouterConnectionForm onSubmit={onSubmit} />;
case AppConnection.Anthropic:
return <AnthropicConnectionForm onSubmit={onSubmit} />;
+ case AppConnection.LiteLLM:
+ return <LiteLLMConnectionForm onSubmit={onSubmit} />;
case AppConnection.Devin:
return <DevinConnectionForm onSubmit={onSubmit} />;
case AppConnection.CircleCI:
@@ -558,6 +561,8 @@ const UpdateForm = ({ appConnection, onComplete }: UpdateFormProps) => {
return <OpenRouterConnectionForm onSubmit={onSubmit} appConnection={appConnection} />;
case AppConnection.Anthropic:
return <AnthropicConnectionForm onSubmit={onSubmit} appConnection={appConnection} />;
+ case AppConnection.LiteLLM:
+ return <LiteLLMConnectionForm onSubmit={onSubmit} appConnection={appConnection} />;
case AppConnection.Devin:
return <DevinConnectionForm onSubmit={onSubmit} appConnection={appConnection} />;
case AppConnection.CircleCI:
diff --git a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/LiteLLMConnectionForm.tsx b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/LiteLLMConnectionForm.tsx
new file mode 100644
index 0000000000..1f10053fbc
--- /dev/null
+++ b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/LiteLLMConnectionForm.tsx
@@ -0,0 +1,126 @@
+import { Controller, FormProvider, useForm } from "react-hook-form";
+import { zodResolver } from "@hookform/resolvers/zod";
+import { Info } from "lucide-react";
+import { z } from "zod";
+
+import {
+ Field,
+ FieldError,
+ FieldLabel,
+ Input,
+ SecretInput,
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger
+} from "@app/components/v3";
+import { AppConnection } from "@app/hooks/api/appConnections/enums";
+import {
+ LiteLLMConnectionMethod,
+ TLiteLLMConnection
+} from "@app/hooks/api/appConnections/types/litellm-connection";
+
+import { AppConnectionFormFooter } from "./AppConnectionFormFooter";
+import {
+ genericAppConnectionFieldsSchema,
+ GenericAppConnectionsFields
+} from "./GenericAppConnectionFields";
+
+type Props = {
+ appConnection?: TLiteLLMConnection;
+ onSubmit: (formData: FormData) => void;
+};
+
+const rootSchema = genericAppConnectionFieldsSchema.extend({
+ app: z.literal(AppConnection.LiteLLM)
+});
+
+const formSchema = z.discriminatedUnion("method", [
+ rootSchema.extend({
+ method: z.literal(LiteLLMConnectionMethod.ApiKey),
+ credentials: z.object({
+ instanceUrl: z
+ .string()
+ .trim()
+ .url("Invalid Instance URL")
+ .min(1, "Instance URL required")
+ .max(255),
+ apiKey: z.string().trim().min(1, "API Key required")
+ })
+ })
+]);
+
+type FormData = z.infer<typeof formSchema>;
+
+export const LiteLLMConnectionForm = ({ appConnection, onSubmit }: Props) => {
+ const isUpdate = Boolean(appConnection);
+
+ const form = useForm<FormData>({
+ resolver: zodResolver(formSchema),
+ defaultValues: appConnection ?? {
+ app: AppConnection.LiteLLM,
+ method: LiteLLMConnectionMethod.ApiKey
+ }
+ });
+
+ const { handleSubmit, control } = form;
+
+ return (
+ <FormProvider {...form}>
+ <form onSubmit={handleSubmit(onSubmit)}>
+ {!isUpdate && <GenericAppConnectionsFields />}
+ <Controller
+ name="credentials.instanceUrl"
+ control={control}
+ shouldUnregister
+ render={({ field, fieldState: { error } }) => (
+ <Field className="mb-4">
+ <FieldLabel htmlFor="instance-url">
+ Instance URL
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Info />
+ </TooltipTrigger>
+ <TooltipContent className="max-w-sm">
+ The base URL of your LiteLLM instance (e.g., https://litellm.example.com).
+ </TooltipContent>
+ </Tooltip>
+ </FieldLabel>
+ <Input
+ id="instance-url"
+ {...field}
+ placeholder="https://litellm.example.com"
+ isError={Boolean(error?.message)}
+ />
+ <FieldError errors={[error]} />
+ </Field>
+ )}
+ />
+ <Controller
+ name="credentials.apiKey"
+ control={control}
+ shouldUnregister
+ render={({ field: { value, onChange }, fieldState: { error } }) => (
+ <Field className="mb-4">
+ <FieldLabel htmlFor="api-key">
+ API Key
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Info />
+ </TooltipTrigger>
+ <TooltipContent className="max-w-sm">
+ The LiteLLM API key used to authenticate with your LiteLLM instance.
+ </TooltipContent>
+ </Tooltip>
+ </FieldLabel>
+ <SecretInput value={value} onChange={(e) => onChange(e.target.value)} />
+ <FieldError errors={[error]} />
+ </Field>
+ )}
+ />
+ <AppConnectionFormFooter
+ submitLabel={isUpdate ? "Update Credentials" : "Connect to LiteLLM"}
+ />
+ </form>
+ </FormProvider>
+ );
+};