# LM Studio (Local)

LM Studio provides local model execution with an OpenAI-compatible API and a GUI model manager.

## Requirements

* LM Studio installed.
* A model downloaded and loaded.

## Setup

1. Install LM Studio from [lmstudio.ai](https://lmstudio.ai).
2. Load a model.
3. Start local server (`Developer -> Start Server`).
4. Configure in **AI Backend** settings tab.

## Configuration

| Setting                      | Default                 | Description                         |
| ---------------------------- | ----------------------- | ----------------------------------- |
| **Preferred Backend**        | `LM Studio`             | Select backend.                     |
| **LM Studio URL**            | `http://127.0.0.1:1234` | Server API base URL.                |
| **LM Studio Model**          | `lmstudio`              | Model identifier.                   |
| **LM Studio API Key**        | *(empty)*               | Optional bearer token.              |
| **LM Studio Headers**        | *(empty)*               | Extra headers (`Header: value`).    |
| **LM Studio Auto-Start**     | On                      | Start server command automatically. |
| **LM Studio Server Command** | `lms server start`      | Auto-start command.                 |
| **LM Studio Timeout**        | `120`                   | Request timeout in seconds.         |

## Notes

Use Auto-Start only if your LM Studio server command is stable in the same runtime environment as Burp.

## Output Token Limits

The extension sets `max_tokens` automatically per request type to ensure complete responses:

| Request Type                 | `max_tokens` |
| ---------------------------- | ------------ |
| **Chat**                     | 4096         |
| **Scanner (single request)** | 2048         |
| **Scanner (batch analysis)** | 4096         |
| **Payload generation**       | 1024         |

## Troubleshooting

{% hint style="info" %}

* Connection refused: verify server is running and URL/port match.
* Model not found: confirm model ID from LM Studio server logs.
* Timeouts: increase timeout or use smaller model.
* Slow responses: local hardware constraints are expected on CPU-only setups.
  {% endhint %}

## Retry Behavior

If a request fails due to a transient network error, the extension retries automatically up to 6 attempts using a bounded stepped backoff (500/1000/1500/2000/3000/4000 ms). A circuit breaker opens after 5 consecutive failures and resets after 30 s. Each retry is logged in the [AI Request Logger](/privacy-and-logging/ai-request-logger.md). See [Backends Overview → Retry Behavior](/backends/overview.md#retry-behavior).

## Related Pages

* [Backends Overview](/backends/overview.md)
* [Troubleshooting](/reference/troubleshooting.md)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://burp-ai-agent.six2dez.com/backends/lm-studio.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
