LM Studio tutorial
Build and debug a workflow with LM Studio
Connect LM Studio to Bandura, extract a synthetic order as JSON, and debug malformed output and failed checks.
Updated 2026-10-01
Use LM Studio for local inference and Bandura for the steps around the model: inputs, parsing, assertions, and inspection. This example extracts an order ID and destination city from a synthetic message.
1. Load a model and start the server
Install LM Studio, download a model that fits your machine, and load it. Open its developer/server controls and start the local API server. Keep it running while Bandura executes the workflow. Use the displayed address and port; this guide assumes the default local port 1234. LM Studio server documentation.
Read the server’s available model identifiers rather than guessing one from the downloaded file name:
curl http://localhost:1234/v1/models
Find the model’s id in the returned list. If you enabled authentication on your server, supply its configured token through your tools’ secure settings instead of pasting it into a shared workflow.
2. Configure Bandura
Install Bandura, open Settings → AI, and choose:
| Setting | Value |
|---|---|
| Provider | OpenAI-compatible |
| Base URL | http://localhost:1234/v1 |
| Model | The identifier returned by /v1/models |
| API key | Blank for an unauthenticated local server; otherwise your configured token |
Use Test connection. Match the server’s actual port if you changed it. LM Studio’s OpenAI-compatible endpoints.
3. Extract and validate a record
Download the JSON extraction template, extract the ZIP, and open its folder in Bandura. Open workflow.aether and press Run.
The synthetic input is “Order DEMO-1042 should go to Kyiv.” The expected parsed object is:
{ "orderId": "DEMO-1042", "city": "Kyiv" }
Inspect these steps in order:
- Extract order fields returns a string from your model.
- Parse JSON parses that string. Markdown fences and malformed JSON cause this step to fail.
- Validate required fields checks the object shape, ID pattern, and nonempty city.
- Check this synthetic example checks the two expected values. A well-formed but incorrect object fails here.
The prompt asks for JSON; the script and assertions check what actually arrived. This example does not configure a provider-specific constrained-output mode, and a successful connection does not guarantee valid JSON.
4. See where a check fails
Change the expected city in the last assertion to a different city. Run again and select that failed step to inspect the values. Restore the expected city afterwards.
When adapting this workflow, change both the sample input and its expected values. For real use, design an output schema for your task, evaluate representative samples, and review outputs before passing them to another system.
Troubleshooting
- No response from port 1234: start the server and confirm the actual port in LM Studio. Loading a model and starting a server are separate actions.
- Model identifier rejected: refresh
/v1/modelsand use the identifier it returns. - Authentication error: check whether server authentication is enabled and use its configured token in Bandura’s provider settings.
- JSON parser error: inspect
rawRecord. The response may contain a code fence, extra prose, or invalid JSON. - Validation fails after parsing: inspect
record. A parseable object can still have missing, extra, or incorrect fields.
Privacy and validation limits
Keep the API server restricted to the interface you need. Local inference can keep model requests on your machine; requests you add to remote APIs still leave it. See Bandura’s data-flow details.
The template’s format and pass/fail behavior are checked with deterministic model responses. Provider setup follows the official documentation. No real LM Studio model benchmark was run for this guide; confirm the behavior with your own model and sample inputs.