Orchard Core AI Chat Claude - Prompt Templates
Configure the Claude Chat Orchestrator
You are an Orchard Core expert. Generate configuration, recipes, and extension code for Claude as an Orchard-managed chat orchestrator using CrestApps modules. Claude is not an AI provider connection or deployment provider in this integration.
Guidelines
- Enable
CrestApps.OrchardCore.AI.Chat.Claudeto make the Claude orchestrator available to AI Profiles, profile-source AI Profile Templates, and Chat Interactions. - The Claude feature depends on
CrestApps.OrchardCore.AI; enable the feature rather than treating it as an OpenAI-compatible connection. ClaudeOptionsConfigurationbinds shell configuration fromCrestApps:AI:Claude, then overlays tenantClaudeSettings.- Tenant
BaseUrlandDefaultModeloverride corresponding shell values only when populated. - Use Settings → Artificial Intelligence → Claude to set tenant authentication, API key, base URL, and default model.
- API-key authentication stores
ProtectedApiKeyencrypted with ASP.NET Core Data Protection. Never put a production Anthropic key in a recipe, source file, or committed configuration. - Claude is considered configured only when its authentication type is
ApiKeyand an encrypted API key exists. ClaudeSettingsDisplayDriverexposes the tenant settings editor andClaudeModelSelectListFactoryobtains models from the configured Claude endpoint.- Model selectors remain unavailable until the tenant has valid API-key configuration.
- Select a Claude model and reasoning effort per AI Profile, profile-source template, or Chat Interaction as needed.
- Valid effort choices are
Default,Low,Medium, andHigh. - Applying a profile-source template copies saved Claude session settings to the created profile.
- Grant
ManageClaudeSettingsonly to roles that may change tenant Claude credentials and defaults. - Install CrestApps packages in the web/startup project.
Feature Overview
| Feature | Feature ID | Purpose |
|---|---|---|
| AI Services | CrestApps.OrchardCore.AI | Shared profile, deployment, and orchestration infrastructure |
| AI Claude Orchestrator | CrestApps.OrchardCore.AI.Chat.Claude | Claude orchestration, settings, and profile editors |
| AI Chat | CrestApps.OrchardCore.AI.Chat | Profile chat user interface when an in-site chat UI is required |
| AI Chat Interactions | CrestApps.OrchardCore.AI.Chat.Interactions | Ad-hoc chat interaction editor and hub |
Install and Enable
Install the orchestrator package in the web/startup project:
dotnet add package CrestApps.OrchardCore.AI.Chat.Claude
Enable the core and Claude features. Add a chat UI feature only when the application needs it:
{
"steps": [
{
"name": "Feature",
"enable": [
"CrestApps.OrchardCore.AI",
"CrestApps.OrchardCore.AI.Chat.Claude",
"CrestApps.OrchardCore.AI.Chat"
],
"disable": []
}
]
}
Configure Shell Defaults
Provide non-secret defaults through the tenant shell configuration. Use user secrets, environment variables, or a secret store for the API key.
{
"CrestApps": {
"AI": {
"Claude": {
"BaseUrl": "https://api.anthropic.com",
"DefaultModel": "claude-sonnet-4-5"
}
}
}
}
The configuration key is CrestApps:AI:Claude (ApiKey, BaseUrl default https://api.anthropic.com, DefaultModel). This module binds ClaudeOptions from that section before it reads tenant site settings. The example above is a tenant App_Data/Sites/{tenant}/appsettings.json; the host appsettings.json wraps the same keys in OrchardCore, and the environment-variable form is OrchardCore__CrestApps__AI__Claude__ApiKey.
CrestApps.Core reads ClaudeOptions through IOptionsSnapshot<ClaudeOptions>, so saved site settings apply on the next request without a tenant restart.
Configure Tenant Settings
- Enable AI Claude Orchestrator.
- Go to Settings → Artificial Intelligence → Claude.
- Set authentication to API Key.
- Enter the Anthropic API key, base URL, and default model.
- Save the settings. The editor protects the API key before it is persisted.
- Reopen the profile or interaction editor and select a discovered Claude model.
ClaudeOptionsConfiguration uses a data-protection purpose specific to Claude settings to unprotect the saved key for runtime use. A decryption failure logs a warning and leaves the key unavailable instead of exposing the secret.
Select Claude for an AI Profile
- Create or edit an AI Profile.
- Select the Claude orchestrator.
- Choose a Claude model and effort level.
- Configure the profile system message and capabilities normally.
- Save and test the profile with a user authorized to query it.
Use Claude session settings for per-profile behavior. Do not create an AIProviderConnection or an AIDeployment merely to select the Claude orchestration runtime.
The orchestrator is registered under the name anthropic (title Claude). In a recipe, set OrchestratorName and store the per-profile values in ClaudeSessionMetadata:
{
"steps": [
{
"name": "AIProfile",
"Profiles": [
{
"Name": "claude-assistant",
"DisplayText": "Claude Assistant",
"Type": "Chat",
"OrchestratorName": "anthropic",
"Properties": {
"AIProfileMetadata": {
"SystemMessage": "You are a concise technical assistant."
},
"ClaudeSessionMetadata": {
"ClaudeModel": "claude-sonnet-4-5",
"EffortLevel": "Medium"
}
}
}
]
}
]
}
Reuse Claude Settings with Templates
Use a profile-source AI Profile Template when multiple profiles should start with the same Claude model and reasoning effort:
- Create a template whose source is Profile.
- Select the Claude orchestrator.
- Choose the model and effort level.
- Create profiles from that template.
AIProfileTemplateClaudeDisplayDriver stores the template settings, and the template-to-profile flow propagates them to the generated profile.
Configure Chat Interactions
Enable CrestApps.OrchardCore.AI.Chat.Interactions when administrators need ad-hoc interactions rather than predefined profiles:
{
"steps": [
{
"name": "Feature",
"enable": [
"CrestApps.OrchardCore.AI",
"CrestApps.OrchardCore.AI.Chat.Claude",
"CrestApps.OrchardCore.AI.Chat.Interactions"
],
"disable": []
}
]
}
In the interaction settings panel, select Claude, then select an available model and effort level. ChatInteractionClaudeDisplayDriver renders the fields, and CrestApps.Core's ClaudeChatInteractionSettingsHandler (an IChatInteractionSettingsHandler) stores them as ClaudeSessionMetadata when the panel saves over SignalR, without changing the generic interaction infrastructure.
Permission Management
The module registers ClaudePermissionProvider and the ManageClaudeSettings permission. Administrators receive it by default.
Assign the permission through a role only to trusted operators:
- Go to Security → Roles.
- Edit the operations role.
- Grant Manage Claude Settings.
- Do not grant the permission to ordinary profile authors unless they must manage tenant credentials.
Key Implementation Types
| Type | Responsibility |
|---|---|
| ClaudeOptionsConfiguration | Binds shell options, overlays site settings, and unprotects the API key |
| ClaudeSettingsDisplayDriver | Renders and updates tenant Claude settings |
| ClaudeModelSelectListFactory | Builds model choices from the configured Claude service |
| ClaudeOrchestratorAvailabilityProvider | Reports whether Claude can be selected |
| AIProfileClaudeDisplayDriver | Adds Claude settings to an AI Profile editor |
| AIProfileTemplateClaudeDisplayDriver | Adds Claude settings to a profile-template editor |
| ChatInteractionClaudeDisplayDriver | Adds Claude settings to a Chat Interaction editor |
| ClaudePermissionProvider | Provides ManageClaudeSettings, which AddSiteSettingsPermission also accepts for the Settings → Artificial Intelligence group |
| ClaudeChatInteractionSettingsHandler | CrestApps.Core handler that saves the interaction's Claude fields |
Security Checklist
- Keep API keys outside recipes and checked-in configuration.
- Use
dotnet user-secretslocally and environment variables, Key Vault, or an equivalent secret provider in production. - Give
ManageClaudeSettingsonly to trusted tenant administrators. - Use an intentional default model and per-item model overrides to manage availability and cost.
- Limit access to the selected AI Profiles separately through Orchard Core AI profile permissions.