﻿---
title: Self-managed custom LLMs
description: You can connect self-managed LLMs to maintain more control of your data, operate in an air-gapped environment, or use specific open-source models of your...
url: https://www.elastic.co/elastic/docs-builder/docs/4302/explore-analyze/ai-features/llm-guides/local-llms-overview
products:
  - Elastic Documentation
  - Elastic Observability
  - Elastic Security
applies_to:
  - Elastic Cloud Serverless: Generally available
  - Elastic Stack: Generally available
---

# Self-managed custom LLMs
You can connect self-managed LLMs to maintain more control of your data, operate in an air-gapped environment, or use specific open-source models of your choosing.
<note applies-to="Elastic Cloud Serverless: Deprecated, Elastic Stack: Deprecated since 9.5">
  The guides on this page use Generative AI connectors, which are deprecated. For new setups, [add an inference endpoint](/elastic/docs-builder/docs/4302/explore-analyze/ai-features/agent-builder/models#add-an-inference-endpoint) that uses the `openai` service and points at your local LLM.
</note>

For model performance on Elastic Security and Observability AI tasks, refer to the [LLM performance matrix for Observability](https://www.elastic.co/elastic/docs-builder/docs/4302/solutions/observability/ai/llm-performance-matrix) and the [LLM performance matrix for Elastic Security](https://www.elastic.co/elastic/docs-builder/docs/4302/solutions/security/ai/large-language-model-performance-matrix).
<warning>
  Self-managed LLMs work well for Elastic Security's [AI Assistant](https://www.elastic.co/elastic/docs-builder/docs/4302/solutions/security/ai/ai-assistant). For [Attack Discovery](https://www.elastic.co/elastic/docs-builder/docs/4302/solutions/security/ai/attack-discovery), we recommend using one of the models in the [LLM performance matrix for Elastic Security](https://www.elastic.co/elastic/docs-builder/docs/4302/solutions/security/ai/large-language-model-performance-matrix).
</warning>

The following guides describe how to set up self-managed LLMs for Elastic Security and Observability.
**Self-managed LLMs for Elastic Security:**
- For production environments or air-gapped environments, you can [connect to vLLM](https://www.elastic.co/elastic/docs-builder/docs/4302/explore-analyze/ai-features/llm-guides/connect-to-vLLM).
- For test environments, you can [connect to LM Studio](https://www.elastic.co/elastic/docs-builder/docs/4302/explore-analyze/ai-features/llm-guides/connect-to-lmstudio-security).

**Self-managed LLMs for Observability:**
- <applies-to>Elastic Stack: Generally available since 9.2</applies-to> For production, test, or air-gapped environments, you can [connect to LM Studio](https://www.elastic.co/elastic/docs-builder/docs/4302/explore-analyze/ai-features/llm-guides/connect-to-lmstudio-observability).