> For the complete documentation index, see [llms.txt](https://interworky.gitbook.io/interworky-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://interworky.gitbook.io/interworky-docs/getting-started/lm-studio-self-hosted-llm.md).

# LM Studio (Self Hosted LLM)

With Interworky, you can seamlessly integrate your self-hosted LM Studio LLM into any website and bring your AI Agent to life.&#x20;

This tutorial will guide you through the setup process, integration steps, and testing of your Agent.

### **Step 1: Create an Interworky Account**

1\. Visit [interworky.com/setup-account](https://interworky.com/setup-account).

2\. Follow the on-screen instructions to create your account.

{% hint style="info" %}
&#x20;If you don’t have a website yet, you can use `example.com` as a placeholder during the setup process.
{% endhint %}

### **Step 2: Add Your LM Studio Configuration**

1\. Log in to your Interworky account and navigate to the Dashboard.

2\. Go to the Account Settings section

<figure><img src="/files/HpGXajv1dD59a79yYBru" alt="" width="165"><figcaption><p> Account Settings in the Sidebar</p></figcaption></figure>

3\. Add the following details:

* LM Studio Hosted URL: This is your LM Studio server’s endpoint.&#x20;
  * For example:
    * If your server is hosted on a domain: <http://yourdomain.com/**v1/chat/completions>\*\*.

{% hint style="info" %}
If running locally, see the “[Running Locally](#running-locally-note-for-locally-hosted-servers)” note below.
{% endhint %}

* Model Name: Specify the model name of your LM Studio instance (e.g., llama-3.2-3b-instruct).
* System Message: Enter the default system message for your Agent.

<figure><img src="/files/5xgAe67lD6AwjEknSJlG" alt=""><figcaption><p>LM Studio Model Name</p></figcaption></figure>

4. Click Save to store your configuration.

* Example Data:
  * LM Studio Hosted URL : `https://myllmwebsite.com/v1/chat/completions`
  * Model Name: `llama-3.2-3b-instruct`
  * System Message: `Respond in a funny quirky way and use metadata attached to understand the user`&#x20;

### **Step 3: Integrate Your Agent on a Website**

1. Navigate to the Integration Tab in your Interworky Dashboard.
2. Copy the script embed provided for your agent.
3. Add the script to the \<head> or \<body> section of the website where you want your agent to appear.
4. For platform-specific integration tutorials (e.g., WordPress, Squarespace), refer to the [Integration Tutorials](/interworky-docs/integration/integration-to-wordpress-websites.md)

### **Step 4: Test Your AI** agent **(Optional)**

1. Go to the AI agent Customization tab in your Interworky Dashboard.
2. Use the Test agent button to test your configuration before integrating it into your website

{% hint style="success" %}
This ensures that your LM Studio URL, model, and system message are working as expected.
{% endhint %}

### **Running Locally** (Note for Locally Hosted Servers)

**Running Locally with Ngrok**

If your LM Studio server is running locally, you can expose it to the internet using Ngrok, allowing your production server or other external users to access it.<br>

**Steps to Set Up Ngrok**

1\. Install Ngrok:

* Download and install Ngrok from the [official website](https://ngrok.com/download).
* After installation, authenticate your Ngrok account and expose your local server

`ngrok http 1237 #if your server is running on port is 1237`&#x20;

2. Capture your ngrok ip address

<figure><img src="/files/0kEpWz7e5WcA4Buhp6GY" alt=""><figcaption><p>Ngrok Forwarding IP Address</p></figcaption></figure>

3. Ensure CORS  and Serve on Local Network are enabled in you LM Settings

<figure><img src="/files/GuOkAA7viAJCLWyo6hJg" alt="" width="375"><figcaption><p>Ensure CORS  and Serve on Local Network are enabled in you LM Settings</p></figcaption></figure>

4. Update your LM Studio End Point in Interworky Account Settings

<figure><img src="/files/q8okvAy2RaWwwxx93wwN" alt="" width="375"><figcaption><p>ADD LM Studio Url to Account Settings</p></figcaption></figure>

And Voila :tada:  You can chat with your self hosted LM Studio model on any website

<figure><img src="/files/INLm1AyUmHV0DLMCqEfa" alt="" width="375"><figcaption><p>Example of Interworky working with LM Studio self hosted Model</p></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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://interworky.gitbook.io/interworky-docs/getting-started/lm-studio-self-hosted-llm.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.
