> 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.localaiendpointimagegen.md).

# LocalAIEndpointImageGen

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)
    * [LocalAIEndpointImageGen](/ai/components/api/smartendpoint/wisej.ai.endpoints.localaiendpointimagegen.md)

Represents an endpoint for connecting to LocalAI Image Generation services.

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

```csharp
public class LocalAIEndpointImageGen : SmartHttpEndpoint
```

{% endtab %}

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

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

{% endtab %}
{% endtabs %}

This class is used to interact with the LocalAI DallE API for generating images. It sets up the necessary authentication and model parameters required for the API requests.

## Constructors

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

Initializes a new instance of the [LocalAIEndpointImageGen](/ai/components/api/smartendpoint/wisej.ai.endpoints.localaiendpointimagegen.md) class.

Sets default values for authentication, model, and URL specific to the DallE API.

## Properties

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

[String](https://docs.microsoft.com/dotnet/api/system.string): Gets or sets the model used for the DallE API. (Default: `"dall-e-3"`)

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

[String](https://docs.microsoft.com/dotnet/api/system.string): Gets or sets the URL for the DallE API endpoint. (Default: `"https://api.LocalAI.com/v1/images/generations"`)

## Methods

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

Adds user messages to the payload for the API request.

| 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) | The list of messages to be processed.             |

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception)\
  Thrown when any of the parameters are null.

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

Reads the assistant's message from the API 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. |

Parses the response to extract image URLs or base64 encoded images and assigns them to the message.**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception)\
  Thrown when any of the parameters are null.

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

Reads the usage information from the API response.

| 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 the response data. |

This method does not process usage information as it is not returned by the API.


---

# 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.localaiendpointimagegen.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.
