{
  "manifest_version": "1.0.0",
  "template": {
    "id": "c4dca4fb-0b18-45c3-a629-cb4dae87e30b",
    "slug": "litellm-self-hosted-ai-gateway",
    "name": "LiteLLM (Self-Hosted AI Gateway)",
    "description": "Self-hosted LLM proxy for any model, with keys, budgets, and usage logs.",
    "url": "https://railway.com/deploy/litellm-self-hosted-ai-gateway",
    "upstream": {
      "image": "ghcr.io/berriai/litellm:v1.97.0"
    }
  },
  "services": [
    {
      "name": "postgres",
      "source": {
        "image": "postgres:16"
      },
      "needs_volume": true,
      "volume_mount_path": "/var/lib/postgresql/data",
      "http": false
    },
    {
      "name": "litellm",
      "source": {
        "image": "ghcr.io/berriai/litellm:v1.97.0"
      },
      "needs_volume": false,
      "http": true
    }
  ],
  "required_inputs": [
    {
      "key": "PGDATA",
      "service": "postgres",
      "description": "Postgres data directory; a subdirectory avoids volume-root init errors.",
      "secret": false,
      "strategy": "default",
      "default": "/var/lib/postgresql/data/pgdata"
    },
    {
      "key": "POSTGRES_DB",
      "service": "postgres",
      "description": "Name of the database created for LiteLLM on first boot.",
      "secret": false,
      "strategy": "default",
      "default": "litellm"
    },
    {
      "key": "POSTGRES_USER",
      "service": "postgres",
      "description": "Postgres username created on first boot.",
      "secret": false,
      "strategy": "default",
      "default": "litellm"
    },
    {
      "key": "POSTGRES_PASSWORD",
      "service": "postgres",
      "description": "Postgres password, auto-generated (alphanumeric for safe connection strings).",
      "secret": true,
      "strategy": "generate",
      "generate": "strong_password"
    },
    {
      "key": "PORT",
      "service": "litellm",
      "description": "Internal port the LiteLLM proxy listens on.",
      "secret": false,
      "strategy": "default",
      "default": "4000"
    },
    {
      "key": "LITELLM_LOG",
      "service": "litellm",
      "description": "Log level for the proxy.",
      "secret": false,
      "strategy": "default",
      "default": "ERROR"
    },
    {
      "key": "UI_PASSWORD",
      "service": "litellm",
      "description": "Password for the LiteLLM Admin UI, auto-generated.",
      "secret": true,
      "strategy": "generate",
      "generate": "strong_password"
    },
    {
      "key": "UI_USERNAME",
      "service": "litellm",
      "description": "Username for the LiteLLM Admin UI.",
      "secret": false,
      "strategy": "default",
      "default": "admin"
    },
    {
      "key": "DATABASE_URL",
      "service": "litellm",
      "description": "Postgres connection string used by LiteLLM (Prisma) for keys, teams, and logs.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "LITELLM_MODE",
      "service": "litellm",
      "description": "Run in production mode (disables dotenv loading).",
      "secret": false,
      "strategy": "default",
      "default": "PRODUCTION"
    },
    {
      "key": "LITELLM_SALT_KEY",
      "service": "litellm",
      "description": "Encryption key for provider API keys stored in the database. Never change after adding models.",
      "secret": true,
      "strategy": "generate",
      "generate": "random_base64_32"
    },
    {
      "key": "STORE_MODEL_IN_DB",
      "service": "litellm",
      "description": "Persist models, keys, and teams in Postgres so you can manage them from the Admin UI.",
      "secret": false,
      "strategy": "default",
      "default": "True"
    },
    {
      "key": "LITELLM_MASTER_KEY",
      "service": "litellm",
      "description": "Admin API key and Admin UI password; must start with sk-. Keep it secret.",
      "secret": true,
      "strategy": "generate",
      "generate": "random_base64_32"
    }
  ],
  "deploy": {
    "mcp": {
      "server": "railway",
      "tool": "deploy_template",
      "args": {
        "template_code": "litellm-self-hosted-ai-gateway"
      }
    },
    "cli": "railway deploy --template litellm-self-hosted-ai-gateway",
    "api": {
      "method": "POST",
      "path": "/graphql/v2",
      "body": {
        "query": "mutation templateDeploy($input: TemplateDeployV2Input!) { templateDeployV2(input: $input) { projectId workflowId } }",
        "variables": {
          "input": {
            "templateId": "c4dca4fb-0b18-45c3-a629-cb4dae87e30b",
            "serializedConfig": {
              "buckets": {},
              "services": {
                "ada53ec8-1b46-4b34-9d28-841614f2a5b7": {
                  "icon": null,
                  "name": "postgres",
                  "deploy": {
                    "startCommand": null,
                    "healthcheckPath": null,
                    "restartPolicyType": "ON_FAILURE",
                    "restartPolicyMaxRetries": 10
                  },
                  "source": {
                    "image": "postgres:16"
                  },
                  "variables": {
                    "PGDATA": {
                      "isOptional": false,
                      "description": "Postgres data directory; a subdirectory avoids volume-root init errors.",
                      "defaultValue": "/var/lib/postgresql/data/pgdata"
                    },
                    "POSTGRES_DB": {
                      "isOptional": false,
                      "description": "Name of the database created for LiteLLM on first boot.",
                      "defaultValue": "litellm"
                    },
                    "POSTGRES_USER": {
                      "isOptional": false,
                      "description": "Postgres username created on first boot.",
                      "defaultValue": "litellm"
                    },
                    "POSTGRES_PASSWORD": {
                      "isOptional": false,
                      "description": "Postgres password, auto-generated (alphanumeric for safe connection strings).",
                      "defaultValue": "{{POSTGRES_PASSWORD}}"
                    }
                  },
                  "volumeMounts": {
                    "ada53ec8-1b46-4b34-9d28-841614f2a5b7": {
                      "mountPath": "/var/lib/postgresql/data"
                    }
                  }
                },
                "d99fbe49-5830-4e4c-8f38-0e17e2601ff5": {
                  "icon": null,
                  "name": "litellm",
                  "deploy": {
                    "startCommand": null,
                    "healthcheckPath": null,
                    "restartPolicyType": "ON_FAILURE",
                    "restartPolicyMaxRetries": 10
                  },
                  "source": {
                    "image": "ghcr.io/berriai/litellm:v1.97.0"
                  },
                  "variables": {
                    "PORT": {
                      "isOptional": false,
                      "description": "Internal port the LiteLLM proxy listens on.",
                      "defaultValue": "4000"
                    },
                    "LITELLM_LOG": {
                      "isOptional": false,
                      "description": "Log level for the proxy.",
                      "defaultValue": "ERROR"
                    },
                    "UI_PASSWORD": {
                      "isOptional": false,
                      "description": "Password for the LiteLLM Admin UI, auto-generated.",
                      "defaultValue": "{{UI_PASSWORD}}"
                    },
                    "UI_USERNAME": {
                      "isOptional": false,
                      "description": "Username for the LiteLLM Admin UI.",
                      "defaultValue": "admin"
                    },
                    "DATABASE_URL": {
                      "isOptional": false,
                      "description": "Postgres connection string used by LiteLLM (Prisma) for keys, teams, and logs.",
                      "defaultValue": "postgresql://${{postgres.POSTGRES_USER}}:${{postgres.POSTGRES_PASSWORD}}@${{postgres.RAILWAY_PRIVATE_DOMAIN}}:5432/${{postgres.POSTGRES_DB}}"
                    },
                    "LITELLM_MODE": {
                      "isOptional": false,
                      "description": "Run in production mode (disables dotenv loading).",
                      "defaultValue": "PRODUCTION"
                    },
                    "LITELLM_SALT_KEY": {
                      "isOptional": false,
                      "description": "Encryption key for provider API keys stored in the database. Never change after adding models.",
                      "defaultValue": "{{LITELLM_SALT_KEY}}"
                    },
                    "STORE_MODEL_IN_DB": {
                      "isOptional": false,
                      "description": "Persist models, keys, and teams in Postgres so you can manage them from the Admin UI.",
                      "defaultValue": "True"
                    },
                    "LITELLM_MASTER_KEY": {
                      "isOptional": false,
                      "description": "Admin API key and Admin UI password; must start with sk-. Keep it secret.",
                      "defaultValue": "{{LITELLM_MASTER_KEY}}"
                    }
                  },
                  "networking": {
                    "serviceDomains": {
                      "<hasDomain>": {}
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "post_deploy": {},
  "resources": {
    "expected_services": 2,
    "needs_volume": true
  },
  "generated_at": "2026-09-20T16:14:49.616Z",
  "generator_version": "0.1.0",
  "status": "validated",
  "validated_at": "2026-09-19T16:23:26.595Z",
  "success_rate_30d": 1,
  "validation": {
    "last_run_id": "run_c634cb48d04347399752",
    "checks": [
      {
        "name": "workflow_completed",
        "passed": true
      },
      {
        "name": "all_services_deployed",
        "passed": true
      },
      {
        "name": "stays_up",
        "passed": true
      }
    ],
    "typical_ready_seconds": 103,
    "typical_build_seconds": 0,
    "typical_start_seconds": 10,
    "slowest_service": "litellm"
  }
}
