You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: MyApp/_pages/ai-server/usage/chat.md
+28-7Lines changed: 28 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -20,10 +20,10 @@ var response = client.Post(new CreateOpenAiChat {
20
20
},
21
21
MaxTokens=50
22
22
},
23
-
RefId="<unique-id>",
24
-
Provider="openai",
25
-
ReplyTo="https://myapp.com/reply",
26
-
Sync=true
23
+
RefId="<unique-id>",// Optional
24
+
Provider="openai",// Optional
25
+
ReplyTo="https://myapp.com/reply",// Optional
26
+
Sync=true// Optional
27
27
});
28
28
```
29
29
@@ -33,7 +33,7 @@ Additional optional features on the request to enhance the usage of AI Server in
33
33
-**Provider**: Force the request to use a specific provider, overriding the selection logic.
34
34
-**ReplyTo**: A HTTP URL to send the response to on completion of the request.
35
35
-**Tag**: A tag to help categorize the request for easier tracking.
36
-
-**Sync**: A boolean value to determine if the request should be processed synchronously (default is asynchronous returning job info).
36
+
-**Sync**: A boolean value to determine if the request should be processed synchronously (default is `false`).
37
37
38
38
These additional request properties are consistent across all AI Server endpoints, providing a common interface for all AI services.
39
39
@@ -42,7 +42,28 @@ These additional request properties are consistent across all AI Server endpoint
42
42
One advantage of using AI Server is that it provides a common set of request DTOs in 11 different languages that are compatible with OpenAI's API. This allows you to switch between OpenAI and AI Server without changing your client code.
43
43
This means you can switch to using typed APIs in your preferred language with your existing service providers OpenAI compatible APIs, and optionally switch to AI Server when you're ready to self-host your AI services for better value.
This shows usage of the `OpenAiChat` request DTO directly with OpenAI's API using the ServiceStack `JsonApiClient`, so you get the benefits of using typed APIs in your preferred language with your existing service providers OpenAI compatible APIs.
65
+
66
+
67
+
46
68
47
-
This shows usage of the `OpenAiChat` request DTO directly with OpenAI's API. The same request DTO can be used with AI Server's `/api/CreateOpenAiChat` endpoint, populated the same way.
description: "Generating images from images with AI Server"
4
+
---
5
+
6
+
# Image to Image
7
+
8
+
AI Server has built-in ComfyUI workflows for doing image-to-image generation tasks like inpainting. This takes an image as input and generates a new image based on the input image and any additional prompts you provide.
9
+
10
+
## Other Image to Image Tasks
11
+
12
+
In addition to just Image to Image, AI Server also supports:
13
+
14
+
-**ImageWithMask**: This task takes an image and a mask as input and uses the provided prompts only for the matching masked area.
15
+
-**ImageUpscale**: This task takes an image and upscales it to a higher resolution using the provided prompts (2x only currently).
16
+
-**ImageToText**: This task takes an image and generates text based on the image content.
17
+
18
+
## Using Image to Image
19
+
20
+
To generate an image from an image, you can use the `ImageToImage` request:
21
+
22
+
```csharp
23
+
varrequest=newImageToImage()
24
+
{
25
+
PositivePrompt="A beautiful sunset over the ocean",
Upscaling is currently limited to 2x the original resolution, and it requires ComfyUI has downloaded the necessary model "RealESRGAN_x2.pth" to perform the upscale.
description: "Generating images from text with AI Server"
4
+
---
5
+
6
+
# Text to Image
7
+
8
+
As well as interacting with LLMs to generate text, AI Server can also generate images from text from a few different providers.
9
+
10
+
-**DALL-E**
11
+
-**Replicate API**
12
+
-**Comfy UI**
13
+
14
+
## DALL-E
15
+
16
+
When you configure AI Server with an OpenAI API key, you can use the DALL-E model to generate images from text.
17
+
18
+
You can control these providers via the Admin Dashboard in AI Server if you want to enable or disable them on a per model basis.
19
+
20
+
## Replicate API
21
+
22
+
Replicate is another provider that can generate images from text. You can configure Replicate in the Admin Dashboard in AI Server or include the `REPLICATE_API_KEY` in your `.env` file during the first run of AI Server.
23
+
24
+
Replicate provides access to the Flux family of models, which can generate images from text using:
25
+
26
+
-**Flux Schnell**
27
+
-**Flux Dev**
28
+
-**Flux Pro**
29
+
30
+
## Comfy UI
31
+
32
+
Comfy UI is a self-hosted agent that can process image requests and other modalities. You can configure Comfy UI in the Admin Dashboard in AI Server after you have set a ComfyUI instance using [the related ComfyUI Extension](https://github.com/ServiceStack/agent-comfy).
33
+
34
+
When configuring the Comfy AI Provider, you can provide the URL of your ComfyUI instance, and any API key required to authenticate with it, and you will get a list of the models available in your ComfyUI instance to enable for the provider.
35
+
36
+
## Using Text to Image
37
+
38
+
Once you have configured your AI Server with the providers you want to use, you can make requests to the AI Server API to generate images from text.
This request will generate an image of a happy llama using the Flux Schnell model. The `PositivePrompt` and `NegativePrompt` properties are used to guide the model on what to generate, and what to avoid. The `Sync` property is used to determine if the request should be processed synchronously or asynchronously. By default, requests are processed asynchronously.
56
+
57
+
Flux Schnell is also available in the Comfy UI agent, so you can use the same model with multiple providers, or switch between providers without changing your client code.
0 commit comments