Configures OpenAI and OpenAI-compatible endpoints in CrestApps.Core 2.0, covering registration, connections, deployments with Features/Parameters, deployment slots, text-to-speech, and migration from 1.x.
Ships in crestapps-core. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
The CrestApps.Core.AI.OpenAI package connects CrestApps.Core to api.openai.com and to any server that speaks the OpenAI API. The connection holds credentials and the endpoint; each deployment names a model and declares what that model can do.
ChatApi on the connection. Put the model name and its capabilities on the deployment.Features). A deployment entry with no features and no legacy Purpose/Type is skipped at startup with the warning "declares no model capabilities".AIDeploymentSlotNames) and IAIDeploymentManager.ResolveSlotAsync(...). Never hard-code a provider client in business code.crestapps-core-ai-runtime for the provider-agnostic runtime, crestapps-core-chat for completion loops, and crestapps-core-realtime-voice for voice sessions.using CrestApps.Core.AI.OpenAI;
builder.Services.AddCrestAppsCore(crestApps => crestApps
.AddAISuite(ai => ai
.AddOpenAI()
)
);
AddAISuite(...) already calls AddCoreServices(), AddCoreAIServices() and AddCoreAIOrchestration(). Without the builder, register them yourself:
builder.Services
.AddCoreAIServices()
.AddCoreAIOrchestration()
.AddCoreAIOpenAI();
AddCoreAIOpenAI() registers:
| Service | Implementation |
|---|---|
IAIClientProvider | OpenAIClientProvider (chat, embeddings, images, speech-to-text, text-to-speech, realtime) |
IAICompletionClient for "OpenAI" | ProviderAICompletionClient<OpenAIClientMarker> |
IAIProviderConnectionHandler | OpenAIConnectionHandler (unprotects a stored OpenAIConnectionMetadata.ApiKey) |
| Connection source and deployment provider | Client name OpenAIConstants.ClientName ("OpenAI") |
Connections are read from CrestApps:AI:Connections (or CrestApps:AI:Providers:OpenAI:Connections) and deployments from CrestApps:AI:Deployments. A configured deployment is read-only in the admin UI.
{
"CrestApps": {
"AI": {
"Connections": [
{
"Name": "openai",
"ClientName": "OpenAI",
"ApiKey": "sk-..."
}
],
"Deployments": [
{
"ClientName": "OpenAI",
"ConnectionName": "openai",
"Name": "gpt-4.1",
"ModelName": "gpt-4.1",
"Features": [ "textGeneration", "toolCalling", "streaming", "imageInput" ]
},
{
"ClientName": "OpenAI",
"ConnectionName": "openai",
"Name": "gpt-5-reasoning",
"ModelName": "gpt-5",
"Features": [ "textGeneration", "toolCalling", "streaming", "reasoning" ],
"Parameters": {
"reasoningEffort": {
"AllowedValues": [ "None", "Low", "Medium", "High" ],
"DefaultValue": "Low"
}
}
},
{
"ClientName": "OpenAI",
"ConnectionName": "openai",
"Name": "text-embedding-3-small",
"Features": [ "textEmbedding" ]
},
{
"ClientName": "OpenAI",
"ConnectionName": "openai",
"Name": "gpt-4o-transcribe",
"Features": [ "speechToText" ]
},
{
"ClientName": "OpenAI",
"ConnectionName": "openai",
"Name": "gpt-4o-mini-tts",
"Features": [ "textToSpeech" ]
},
{
"ClientName": "OpenAI",
"ConnectionName": "openai",
"Name": "gpt-realtime",
"Features": [ "realtime" ]
}
]
}
}
}
Name is the lookup name; ModelName is the model sent to OpenAI and falls back to Name.Features and Parameters on the entry are shorthand for Properties:AIDeploymentMetadata:Features and Properties:AIDeploymentMetadata:Parameters. Both forms merge, and the shorthand keeps environment variable names short enough for Azure App Service (CrestApps__AI__Deployments__0__Features__0=textGeneration).textGeneration is opt-out only for a deployment with no metadata at all. Once Features is declared, list textGeneration for every text model. A speech-to-speech-only model declares realtime and omits textGeneration.toolCalling and streaming on chat models. Without toolCalling every tool is stripped from the request; without streaming a streaming call is completed as one response.AIDeploymentFeatureNames constants: textGeneration, toolCalling, structuredOutputs, streaming, reasoning, imageInput, imageOutput, audioInput, audioOutput, videoInput, videoOutput, realtime, textEmbedding, speechToText, textToSpeech.A connection can name its models directly instead. Each name becomes a read-only deployment with fixed capabilities:
| Connection key | Capabilities declared |
|---|---|
ChatDeploymentName (or DeploymentName) | textGeneration, toolCalling, streaming |
UtilityDeploymentName | textGeneration, streaming |
EmbeddingDeploymentName | textEmbedding |
ImagesDeploymentName | imageOutput |
SpeechToTextDeploymentName | speechToText |
TextToSpeechDeploymentName | textToSpeech |
Use the explicit Deployments list when a model needs reasoning, imageInput, realtime, or parameters.
A slot is what the installation uses a deployment for. The built-in slots are chat, utility, embedding, image, vision, speechToText, textToSpeech and realtime. Fill a slot default through DefaultAIDeploymentSettings, then resolve it:
using CrestApps.Core.AI.Models;
builder.Services.Configure<DefaultAIDeploymentSettings>(settings =>
{
settings.DefaultChatDeploymentName = "gpt-4.1";
settings.DefaultUtilityDeploymentName = "gpt-4.1";
settings.DefaultEmbeddingDeploymentName = "text-embedding-3-small";
settings.DefaultSpeechToTextDeploymentName = "gpt-4o-transcribe";
settings.DefaultTextToSpeechDeploymentName = "gpt-4o-mini-tts";
settings.DefaultRealtimeDeploymentName = "gpt-realtime";
});
using CrestApps.Core.AI.Clients;
using CrestApps.Core.AI.Deployments;
using CrestApps.Core.AI.Models;
using Microsoft.Extensions.AI;
namespace MyApp.Services;
public sealed class EmbeddingService
{
private readonly IAIDeploymentManager _deploymentManager;
private readonly IAIClientFactory _clientFactory;
public EmbeddingService(IAIDeploymentManager deploymentManager, IAIClientFactory clientFactory)
{
_deploymentManager = deploymentManager;
_clientFactory = clientFactory;
}
public async Task<ReadOnlyMemory<float>> EmbedAsync(string text, CancellationToken cancellationToken = default)
{
var deployment = await _deploymentManager.ResolveSlotAsync(
AIDeploymentSlotNames.Embedding,
cancellationToken: cancellationToken)
?? throw new InvalidOperationException("No deployment declares the textEmbedding capability.");
var generator = await _clientFactory.CreateEmbeddingGeneratorAsync(deployment);
var embeddings = await generator.GenerateAsync([text], cancellationToken: cancellationToken);
return embeddings[0].Vector;
}
}
Resolution order is the explicit name, the slot's site default, the fallback slot (only utility falls back to chat), and finally the first deployment that declares the slot's capability. GetAllBySlotAsync(slotName) lists every candidate, which is what settings pickers use. ResolveSlotOrThrowAsync(...) throws instead of returning null.
Reasoning models such as gpt-6-luna reject function tools combined with a reasoning effort on /v1/chat/completions. The connection's ChatApi setting (OpenAIChatApis) decides where such a request goes:
ChatApi | Behavior |
|---|---|
Auto (default) | On OpenAI's own endpoint (no Endpoint, api.openai.com, or a regional host such as eu.api.openai.com), a request with function tools and a reasoning effort other than None goes to the Responses API. Any other endpoint uses Chat Completions only. |
ChatCompletions | Every request uses Chat Completions. |
Responses | Tools plus reasoning go to /v1/responses on any endpoint. Use it for compatible servers such as OpenRouter or xAI. |
Values are case-insensitive; an unknown value logs a warning and acts as Auto. Responses requests are sent with store: false. A reasoning effort reaches the provider only when the deployment declares reasoning and the reasoningEffort parameter; without the parameter no effort is sent and Chat Completions rejects the tools. A host configured only from environment variables can set Parameters:reasoningEffort:DefaultValue=None for models that refuse tools unless the effort is none.
{
"CrestApps": {
"AI": {
"Connections": [
{
"Name": "openrouter",
"ClientName": "OpenAI",
"Endpoint": "https://openrouter.ai/api/v1",
"ApiKey": "...",
"ChatApi": "Responses"
}
]
}
}
}
IAIClientFactory.CreateTextToSpeechClientAsync) streams for gpt-4o-mini-tts; tts-1 and tts-1-hd answer in one piece. ISpeechVoiceResolver returns OpenAITextToSpeechVoices.For(model): thirteen voices for gpt-4o-mini-tts, nine for tts-1/tts-1-hd.pcm or Pcm<rate>; Pcm24000 passes through and any other rate (Pcm8000, Pcm16000) is requested at 24 kHz and resampled while streaming, so OpenAI can be the speaking leg of a cascaded realtime deployment at any output rate.TextToSpeechOptions.Speed is clamped to 0.25 to 4. A speaking style passed as the TextToSpeechOptionsProperties.Instructions additional property is sent as instructions, except to tts-1 and tts-1-hd.SpeechMarkupTextToSpeechClient, so neutral speech markup (<break time="500ms"/>, <spell>AB12</spell>) is rendered as plain punctuation and spaced letters instead of being read aloud. See crestapps-core-speech-voices.OpenAIRealtimeClient from Microsoft.Extensions.AI.OpenAI. Declare the realtime feature so the deployment fills the realtime slot. Voices come from IRealtimeVoiceResolver and are OpenAIRealtimeVoices.All (alloy, ash, ballad, cedar, coral, echo, marin, sage, shimmer, verse). With no voice chosen the provider's own default voice is used.gpt-4o-transcribe); add one or the user's turns are not transcribed. See crestapps-core-realtime-voice.Requests go through the named HttpClient OpenAIConstants.HttpClientName ("CrestApps.OpenAI"), registered without a timeout, redirects or cookies. Configure a client of that name after registering the provider (for example AddHttpClient(name).ConfigurePrimaryHttpMessageHandler(...) with a ConnectCallback that checks each connection's address, AllowAutoRedirect = false, UseCookies = false and a PooledConnectionLifetime) to choose the transport; see crestapps-core-ai-runtime. SDK clients are cached per container in AIProviderClientCache; call Clear() on it instead of the removed static OpenAIClientProvider.ClearCache(). The realtime client opens its own WebSocket and does not use the named client.
Set Endpoint to the server's base URL (for example Groq, Mistral, Together AI, Fireworks, DeepSeek, OpenRouter, vLLM, LocalAI). Declare only the features the hosted model really has; many servers lack tool calling, structured outputs, or /v1/responses. For Anthropic's native API prefer crestapps-core-claude-orchestrator.
Deployment missing from pickers or ResolveSlotAsync returns null: the entry has no Features, its ClientName is missing or unknown, or it declares a capability other than the slot requires.
The model describes a tool call but never calls it: the deployment does not declare toolCalling; capability enforcement removed the tools (a warning is logged).
HTTP 400 about tools and reasoning effort: declare reasoning and reasoningEffort, or leave ChatApi at Auto/Responses so the request uses the Responses API.
Two connections whose names differ only by case: the first definition wins and the second is logged as a warning. Rename one.
A redirect from a compatible server fails: the provider client no longer follows redirects; set Endpoint to the final address.
"Purpose": "Chat" or "Type": "Chat" with "Features": [ "textGeneration", "toolCalling", "streaming" ]. Legacy Purpose, Capability and Type values still load, but the projection is narrow: Chat or Utility becomes textGeneration only (not when realtime is declared), and Embedding, Image, Vision, SpeechToText and TextToSpeech become textEmbedding, imageOutput, imageInput, speechToText and textToSpeech. A 1.x chat entry therefore loses tool calling and streaming until toolCalling and streaming are declared.ResolveOrDefaultAsync(AIDeploymentPurpose.X, ...) with ResolveSlotAsync(AIDeploymentSlotNames.X, ...), and GetByPurposeAsync/GetAllByPurposeAsync with GetAllBySlotAsync. AIDeploymentPurpose, AIDeploymentType, SupportsPurpose and CanServeTextCompletion() are removed.realtime feature. ChatMode.Realtime and AIProfile.RealtimeDeploymentName are gone.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
/crestapps-core:crestapps-core-openaifrom crestapps-core
npx claudepluginhub crestapps/crestapps.agentskills --plugin crestapps-core51 skills in this plugin
/crestapps-core-a2aSkill for Agent-to-Agent (A2A) protocol support in CrestApps.Core on the A2A 1.0 SDK. Covers AddA2AClient and AddCoreAIA2AClient with Entity Framework Core or YesSql connection stores, A2AConnection and A2AConnectionMetadata authentication, AIProfileA2AMetadata, the agent card cache and A2AToolRegistryProvider, the listAvailableAgents, findAgentForTask and findToolsForTask tools, building an A2A host with IAgentHandler, A2AServer, ITaskStore and MapA2A, A2A 1.0 agent cards with supportedInterfaces published at /.well-known/agent-card.json, A2AHostOptions authentication and ExposeAgentsAsSkill, system agents exposed through the host, and upgrading from the 0.3 SDK./crestapps-core-ag-uiSkill for running the CrestApps.Core 2.0 AI chat as an AG-UI agent. Covers the CrestApps.Core.AI.AGUI package (AGUIRunEventWriter, AGUIRunRequest, AGUIJson), AIChatHubCore.RunAgent over SignalR and MapAGUIChat with Server-Sent Events, the RunAgentInput members and streamed events, tool approvals with RequireApproval or an approval tool kind, ApprovalRequiredAIFunction, interrupts and resume, approvals inside agents, page context with crestAppsAGUI.registerContextProvider, shared state with registerStateProvider and update_shared_state, frontend tools, stored tool calls (ChatTurnToolActivity), runs that continue on the next page, AGUIChatOptions.DisconnectedRunTimeout, the protocol and sendPageContext chat options, and the AICompletionContextKeys and ChatResponseHandlerContext members. Use it when showing tool calls in the chat, asking a person before a tool runs, sharing page state with the agent, connecting CopilotKit or another AG-UI client, or troubleshooting approvals and continued runs.Other plugins' skills for the same job