> For the complete documentation index, see [llms.txt](https://docs.wisej.com/ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.wisej.com/ai/components/api/smartendpoint/wisej.ai.endpoints.localaiendpointtts.md).

# LocalAIEndpointTTS

Namespace: **Wisej.AI.Endpoints**

Assembly: **Wisej.AI** (3.5.0.0)

* [SmartEndpoint](/ai/components/api/smartendpoint.md)
  * [SmartHttpEndpoint](/ai/components/api/smartendpoint/wisej.ai.endpoints.smarthttpendpoint.md)
    * [LocalAIEndpointTTS](/ai/components/api/smartendpoint/wisej.ai.endpoints.localaiendpointtts.md)

Represents an endpoint for connecting to LocalAI's speech services.

{% tabs %}
{% tab title="C#" %}

```csharp
public class LocalAIEndpointTTS : SmartHttpEndpoint
```

{% endtab %}

{% tab title="VB.NET" %}

```visual-basic
Public Class LocalAIEndpointTTS
    Inherits SmartHttpEndpoint
```

{% endtab %}
{% endtabs %}

This class is designed to interact with LocalAI's text-to-speech (TTS) API, allowing for the conversion of text into speech audio files.

## Constructors

### ![](/files/ptrKjmmRoQB76pvrIqh0) LocalAIEndpointTTS()

Initializes a new instance of the [LocalAIEndpointTTS](/ai/components/api/smartendpoint/wisej.ai.endpoints.localaiendpointtts.md) class with default settings.

The default model is set to "tts-1", and the voice option is "alloy". The response format is set to "mp3".

## Properties

### ![](/files/ptrKjmmRoQB76pvrIqh0) Model

[String](https://docs.microsoft.com/dotnet/api/system.string): Gets or sets the model used for the TTS operation. (Default: `"tts-1"`)

### ![](/files/ptrKjmmRoQB76pvrIqh0) URL

[String](https://docs.microsoft.com/dotnet/api/system.string): Gets or sets the URL for the LocalAI TTS API endpoint. (Default: `"http://localhost:8080/v1/audio/speech"`)

## Methods

### ![](/files/KL0Ik37djZRr8a07Wopd) AddMessages(payload, session, messages)

Adds user messages to the payload for processing.

| Parameter    | Type                                                                                        | Description                                       |
| ------------ | ------------------------------------------------------------------------------------------- | ------------------------------------------------- |
| **payload**  | [Object](https://docs.microsoft.com/dotnet/api/system.object)                               | The dynamic payload object to be sent to the API. |
| **session**  | [SmartSession](/ai/components/api/smartsession.md)                                          | The current session containing user context.      |
| **messages** | [IList\<Message>](https://docs.microsoft.com/dotnet/api/system.collections.generic.ilist-1) | A list of messages to be processed.               |

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception)\
  Thrown when *session* , *payload* , or *messages* is null.

### ![](/files/KL0Ik37djZRr8a07Wopd) ReadAssistantMessage(response, message)

Reads the assistant's message from the response.

| Parameter    | Type                                                                            | Description                                            |
| ------------ | ------------------------------------------------------------------------------- | ------------------------------------------------------ |
| **response** | [Response](/ai/components/api/smartendpoint/wisej.ai.smartendpoint.response.md) | The response received from the API.                    |
| **message**  | [Message](/ai/components/api/smartsession/wisej.ai.smartsession.message.md)     | The message object to populate with the response data. |

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception)\
  Thrown when *response* or *message* is null.

### ![](/files/KL0Ik37djZRr8a07Wopd) ReadUsage(message, reply)

Reads the usage information from the reply.

| Parameter   | Type                                                                        | Description                                            |
| ----------- | --------------------------------------------------------------------------- | ------------------------------------------------------ |
| **message** | [Message](/ai/components/api/smartsession/wisej.ai.smartsession.message.md) | The message object to populate with usage data.        |
| **reply**   | [Object](https://docs.microsoft.com/dotnet/api/system.object)               | The dynamic reply object containing usage information. |

This method does not return usage information as it is not applicable for TTS operations.


---

# 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://docs.wisej.com/ai/components/api/smartendpoint/wisej.ai.endpoints.localaiendpointtts.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.
