Orchardcore ai providers

From CrestApps/CrestApps.AgentSkills · View interactive version

Orchardcore ai providers is an AI agent skill from the GitHub repository CrestApps/CrestApps.AgentSkills. Skill for the CrestApps.OrchardCore 3.0 AI provider modules. Covers OpenAI and OpenAI-compatible services, Azure OpenAI with contained AzureSpeech deployments, Azure AI Inference (GitHub Models), Ollama, the ElevenLabs and Cartesia speech providers, the Custom LLM (WebSocket) provider (CrestApps.Orc

How to use this skill

Skill file

Orchard Core AI Providers

A provider module teaches the CrestApps AI suite to talk to one AI platform: it creates chat clients,

embedding generators, image generators and speech clients, registers a connection source and a deployment

provider, and contributes its connection editor. Configure a connection (credentials), then

deployments (models with declared capabilities), then point profiles or site defaults at deployments.

Guidelines

CrestApps.OrchardCore.AI. Enable CrestApps.OrchardCore.AI.ConnectionManagement for the connection UI

and the AIProviderConnections recipe step.

Purpose and no IsDefault; defaults are site settings (see orchardcore-ai-model-capabilities).

Providers

| Provider | Feature ID | ClientName | Notes |

| --- | --- | --- | --- |

| OpenAI | CrestApps.OrchardCore.OpenAI | OpenAI | OpenAI and any OpenAI-compatible endpoint |

| Azure OpenAI | CrestApps.OrchardCore.OpenAI.Azure | Azure | Also registers the contained AzureSpeech deployment provider (Azure AI Services) |

| Azure AI Inference | CrestApps.OrchardCore.AzureAIInference | AzureAIInference | GitHub Models and Azure AI model inference endpoints |

| Ollama | CrestApps.OrchardCore.Ollama | Ollama | Local models; no API key |

| ElevenLabs | CrestApps.OrchardCore.ElevenLabs | ElevenLabs | Speech only: text-to-speech, Scribe speech-to-text (whole recordings), voice library and cloning. Contained connection |

| Cartesia | CrestApps.OrchardCore.Cartesia | Cartesia | Speech only: text-to-speech with emotion, speech-to-text (also realtime, as a cascade's hearing leg), voice library and cloning. Contained connection |

| Custom LLM (WebSocket) | CrestApps.OrchardCore.AI.CustomLlm | CustomLlm | Chat turns streamed from your own WebSocket server |

| Cascaded Realtime | built into CrestApps.OrchardCore.AI | CascadedRealtime | Chains speech-to-text, chat and text-to-speech deployments; see orchardcore-ai-realtime-voice |

Connection metadata per provider and the AIProviderConnections recipe are in orchardcore-ai-connections.

OpenAI

{
  "OrchardCore": {
    "CrestApps": {
      "AI": {
        "Connections": [
          { "Name": "openai-cloud", "ClientName": "OpenAI", "ApiKey": "<secret>" },
          { "Name": "deepseek", "ClientName": "OpenAI", "Endpoint": "https://api.deepseek.com/v1", "ApiKey": "<secret>" }
        ],
        "Deployments": [
          {
            "Name": "chat-default",
            "ClientName": "OpenAI",
            "ConnectionName": "openai-cloud",
            "ModelName": "gpt-4o",
            "Properties": { "AIDeploymentMetadata": { "Features": [ "textGeneration", "toolCalling", "streaming", "structuredOutputs" ] } }
          },
          {
            "Name": "embedding-default",
            "ClientName": "OpenAI",
            "ConnectionName": "openai-cloud",
            "ModelName": "text-embedding-3-large",
            "Properties": { "AIDeploymentMetadata": { "Features": [ "textEmbedding" ] } }
          },
          {
            "Name": "image-default",
            "ClientName": "OpenAI",
            "ConnectionName": "openai-cloud",
            "ModelName": "dall-e-3",
            "Properties": { "AIDeploymentMetadata": { "Features": [ "imageOutput" ] } }
          },
          {
            "Name": "deepseek-reasoner",
            "ClientName": "OpenAI",
            "ConnectionName": "deepseek",
            "ModelName": "deepseek-reasoner",
            "Properties": { "AIDeploymentMetadata": { "Features": [ "textGeneration", "reasoning", "streaming" ] } }
          }
        ]
      }
    }
  }
}

A Gemini connection typically uses https://generativelanguage.googleapis.com/v1 as Endpoint.

Azure OpenAI

{
  "steps": [
    {
      "name": "AIProviderConnections",
      "Connections": [
        {
          "Source": "Azure",
          "Name": "azure-openai",
          "DisplayText": "Azure OpenAI",
          "Properties": {
            "AzureConnectionMetadata": {
              "Endpoint": "https://my-resource.openai.azure.com/",
              "AuthenticationType": "ManagedIdentity"
            }
          }
        }
      ]
    },
    {
      "name": "AIDeployment",
      "Deployments": [
        {
          "Name": "chat-deployment",
          "ClientName": "Azure",
          "ConnectionName": "azure-openai",
          "ModelName": "gpt-4.1",
          "Properties": { "AIDeploymentMetadata": { "Features": [ "textGeneration", "toolCalling", "streaming" ] } }
        },
        {
          "Name": "embedding-deployment",
          "ClientName": "Azure",
          "ConnectionName": "azure-openai",
          "ModelName": "text-embedding-3-small",
          "Properties": { "AIDeploymentMetadata": { "Features": [ "textEmbedding" ] } }
        }
      ]
    }
  ]
}

AuthenticationType is Default, ManagedIdentity (optional IdentityId for a user-assigned identity)

or ApiKey (requires ApiKey).

Azure client options

{
  "OrchardCore": {
    "CrestApps": {
      "AI": {
        "AzureClient": {
          "MaxRetryAttempts": 3,
          "EnableLogging": false
        }
      }
    }
  }
}

Keys: EnableDefaultRetryPolicy (true), MaxRetryAttempts (5), RateLimitRetryDelay (00:00:01),

MaxRetryDelay (00:00:32), BackoffType (Exponential), UseJitter (true), EnableLogging,

EnableMessageLogging, EnableMessageContentLogging (all false).

Azure AI Speech deployments

AzureSpeech deployments carry their own connection (no ConnectionName). In the admin, choose

Azure AI Services under Add Deployment and tick Speech to text (transcription).

{
  "steps": [
    {
      "name": "AIDeployment",
      "Deployments": [
        {
          "Name": "speech-to-text",
          "ClientName": "AzureSpeech",
          "Endpoint": "https://eastus.api.cognitive.microsoft.com/",
          "AuthenticationType": "ApiKey",
          "ApiKey": "{{SpeechApiKey}}",
          "Properties": { "AIDeploymentMetadata": { "Features": [ "speechToText" ] } }
        }
      ]
    }
  ]
}

Then set Default Speech-to-Text Deployment (DefaultSpeechToTextDeploymentName). The Azure Speech SDK

needs GStreamer on every host to decode the compressed audio browsers send (OGG/Opus, WebM/Opus, MP3,

FLAC); without it requests fail with SPXERR_GSTREAMER_NOT_FOUND_ERROR (0x29). In Docker install

libgstreamer1.0-0 and the gstreamer1.0-plugins-base/good/bad/ugly packages before the app layer.

ElevenLabs and Cartesia

Both modules depend only on CrestApps.OrchardCore.AI and wrap CrestApps.Core's AddCoreAIElevenLabs() and

AddCoreAICartesia(). Their deployments carry their own connection: under **Artificial Intelligence >

Deployments > Add Deployment pick ElevenLabs or Cartesia**, enter the model name (for example

eleven_flash_v2_5 or sonic-2) and the API key, which is stored encrypted in the deployment's

Properties.ApiKey (leaving it blank later keeps it). The optional Endpoint (Properties.Endpoint) is only

for a regional endpoint such as ElevenLabs' https://api.eu.residency.elevenlabs.io; the defaults are

https://api.elevenlabs.io and https://api.cartesia.ai. A recipe sets the same keys:

{
  "steps": [
    {
      "name": "Feature",
      "enable": [ "CrestApps.OrchardCore.ElevenLabs" ],
      "disable": []
    },
    {
      "name": "AIDeployment",
      "Deployments": [
        {
          "Name": "elevenlabs-voice",
          "ClientName": "ElevenLabs",
          "ModelName": "eleven_flash_v2_5",
          "ApiKey": "{{ElevenLabsApiKey}}",
          "Properties": { "AIDeploymentMetadata": { "Features": [ "textToSpeech" ] } }
        }
      ]
    }
  ]
}

DefaultTextToSpeechVoiceId. Artificial Intelligence > Voice library (ManageAIDeployments) searches a

deployment's voices by name and language, plays samples, copies a voice id and clones voices.

deployment; they have no chat, embedding, image or speech-to-speech client. See orchardcore-ai-realtime-voice.

Custom LLM (WebSocket)

For a model or agent you host that does not speak an OpenAI-compatible API (if it does, use the OpenAI

provider). Enable CrestApps.OrchardCore.AI.CustomLlm, add a Custom LLM (WebSocket) connection whose

Endpoint is wss://... (an https:// address is used as wss://) and whose optional API key is sent

as Authorization: Bearer when the socket opens, add a deployment on it (the model name is sent with each

request), and choose it as a profile's chat deployment.

For each turn the site opens a socket, sends one JSON request frame and reads frames until done or error:

{"type":"request","model":"collections-agent","conversationId":"<ai session id>","messages":[{"role":"system","content":"You are..."},{"role":"user","content":"Can I pay next week?"}],"temperature":0.3,"maxOutputTokens":400}

The server answers with {"type":"delta","content":"..."} frames, then

{"type":"done","usage":{"inputTokens":812,"outputTokens":11}} (usage optional, metered when given), or

{"type":"error","message":"..."}. A turn with no frame for 30 seconds fails. Tools are not sent, and

embeddings, images and speech must come from other providers.

Azure AI Inference (GitHub Models)

{
  "OrchardCore": {
    "CrestApps": {
      "AI": {
        "Connections": [
          {
            "Name": "github-models",
            "ClientName": "AzureAIInference",
            "Endpoint": "https://models.inference.ai.azure.com",
            "AuthenticationType": "ApiKey",
            "ApiKey": "<github token>"
          }
        ],
        "Deployments": [
          {
            "Name": "phi-chat",
            "ClientName": "AzureAIInference",
            "ConnectionName": "github-models",
            "ModelName": "Phi-3-medium-4k-instruct",
            "Properties": { "AIDeploymentMetadata": { "Features": [ "textGeneration", "streaming" ] } }
          }
        ]
      }
    }
  }
}

Ollama

{
  "OrchardCore": {
    "CrestApps": {
      "AI": {
        "Connections": [
          { "Name": "local-ollama", "ClientName": "Ollama", "Endpoint": "http://localhost:11434" }
        ],
        "Deployments": [
          {
            "Name": "local-chat",
            "ClientName": "Ollama",
            "ConnectionName": "local-ollama",
            "ModelName": "deepseek-v2:16b",
            "Properties": { "AIDeploymentMetadata": { "Features": [ "textGeneration", "toolCalling", "streaming" ] } }
          }
        ]
      }
    }
  }
}

In a recipe, put the Ollama endpoint in Properties.Endpoint (see orchardcore-ai-connections). Declare

toolCalling only for models that support it. The repository's Aspire app host

(CrestApps.Aspire.AppHost) starts Ollama and adds its connection through environment variables.

Orchestrators are not providers

CrestApps.OrchardCore.AI.Chat.Claude and CrestApps.OrchardCore.AI.Chat.Copilot replace the chat

orchestrator instead of adding a connection. They are configured under **Settings > Artificial

Intelligence** or OrchardCore:CrestApps:AI:Claude / OrchardCore:CrestApps:AI:Copilot, choose their own

models, and hide the deployment fields on a profile. See orchardcore-ai-chat-claude and

orchardcore-ai-chat-copilot.

Write a custom provider

using CrestApps.Core.AI;
using CrestApps.Core.AI.Models;
using CrestApps.Core.AI.Services;
using CrestApps.Core.Infrastructure;
using Microsoft.Extensions.AI;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Localization;
using OrchardCore.Modules;

public readonly struct AcmeClientMarker : IAIClientMarker
{
    public static string ClientName => "Acme";
}

public sealed class AcmeClientProvider : AIClientProviderBase
{
    public AcmeClientProvider(IServiceProvider serviceProvider)
        : base(serviceProvider)
    {
    }

    protected override string GetProviderName() => AcmeClientMarker.ClientName;

    protected override IChatClient GetChatClient(AIProviderConnectionEntry connection, string deploymentName)
        => new AcmeChatClient(connection.GetEndpoint(), connection.GetApiKey(), deploymentName);

    protected override IEmbeddingGenerator<string, Embedding<float>> GetEmbeddingGenerator(AIProviderConnectionEntry connection, string deploymentName)
        => throw new NotSupportedException();

#pragma warning disable MEAI001
    protected override IImageGenerator GetImageGenerator(AIProviderConnectionEntry connection, string deploymentName)
        => throw new NotSupportedException();

    protected override ISpeechToTextClient GetSpeechToTextClient(AIProviderConnectionEntry connection, string deploymentName)
        => throw new NotSupportedException();
#pragma warning restore MEAI001
}

public sealed class Startup : StartupBase
{
    private readonly IStringLocalizer S;

    public Startup(IStringLocalizer<Startup> stringLocalizer)
    {
        S = stringLocalizer;
    }

    public override void ConfigureServices(IServiceCollection services)
    {
        services.AddScoped<IAIClientProvider, AcmeClientProvider>();

        services.AddCoreAICompletionClient<ProviderAICompletionClient<AcmeClientMarker>>(AcmeClientMarker.ClientName, o =>
        {
            o.DisplayName = S["Acme"];
            o.Description = S["Provides AI profiles using Acme."];
        });

        services.AddCoreAIDeploymentProvider(AcmeClientMarker.ClientName, o =>
        {
            o.DisplayName = S["Acme"];
            o.Description = S["Acme model deployments."];
        });

        services.AddCoreAIConnectionSource(AcmeClientMarker.ClientName, o =>
        {
            o.DisplayName = S["Acme"];
            o.Description = S["Connects to the Acme AI API."];
        });
    }
}

IAIProviderConnectionHandler.Initializing (use a handler to decrypt a stored API key with the

AIProviderConnection data protector). GetEndpoint() and GetApiKey() read the Endpoint and

ApiKey keys.

GetRealtimeVoicesAsync when the platform supports them.

endpoint, like AzureSpeech.

orchardcore-ai-model-capabilities).

[RequireFeatures("CrestApps.OrchardCore.AI.ConnectionManagement")], as the shipped providers do.

Upgrading from 2.x

still projected on read (Chat/Utility become textGeneration, toolCalling, streaming).

MaxRetryAttempts; there is no nested Retry object.

or derive from AIClientProviderBase; the CreateChatClientAsync(AIProviderConnection, string) shape

and AddAIProfile<TClient> registration are gone.

Related skills

crestapps-core-ollama for the framework provider packages.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.