Prompty.OpenAI
2.0.0-alpha.10
This is a prerelease version of Prompty.OpenAI.
dotnet add package Prompty.OpenAI --version 2.0.0-alpha.10
NuGet\Install-Package Prompty.OpenAI -Version 2.0.0-alpha.10
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Prompty.OpenAI" Version="2.0.0-alpha.10" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Prompty.OpenAI" Version="2.0.0-alpha.10" />
<PackageReference Include="Prompty.OpenAI" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Prompty.OpenAI --version 2.0.0-alpha.10
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Prompty.OpenAI, 2.0.0-alpha.10"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Prompty.OpenAI@2.0.0-alpha.10
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Prompty.OpenAI&version=2.0.0-alpha.10&prerelease
#tool nuget:?package=Prompty.OpenAI&version=2.0.0-alpha.10&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Prompty.OpenAI
OpenAI provider for Prompty — executor and processor for OpenAI chat completions, embeddings, image generation, and the Responses API.
Installation
dotnet add package Prompty.Core
dotnet add package Prompty.OpenAI
Quick Start
using Prompty.Core;
using Prompty.OpenAI;
// One-time setup — registers renderers, parser, and OpenAI provider
new PromptyBuilder()
.AddOpenAI();
// Run a .prompty file (provider: openai in frontmatter)
var result = await Pipeline.InvokeAsync("chat.prompty", new Dictionary<string, object>
{
["question"] = "Explain quantum computing in simple terms"
});
Console.WriteLine(result);
.prompty Configuration
---
name: openai-chat
model:
id: gpt-4o-mini
provider: openai
apiType: chat # chat (default) | embedding | image | responses
connection:
kind: key
endpoint: https://api.openai.com/v1
apiKey: ${env:OPENAI_API_KEY}
options:
temperature: 0.7
maxOutputTokens: 1000
---
system:
You are a helpful assistant.
user:
{{question}}
Supported API Types
apiType |
SDK Method | Use Case |
|---|---|---|
chat (default) |
ChatClient.CompleteChatAsync |
Chat completions |
embedding |
EmbeddingClient.GenerateEmbeddingsAsync |
Text embeddings |
image |
ImageClient.GenerateImagesAsync |
DALL-E image generation |
responses |
OpenAIResponseClient.CreateResponseAsync |
Responses API |
Authentication
API Key
model:
connection:
kind: key
endpoint: https://api.openai.com/v1
apiKey: ${env:OPENAI_API_KEY}
Connection Registry (pre-registered client)
// Register an OpenAI client at startup
var client = new OpenAIClient("sk-...");
ConnectionRegistry.Register("my-openai", client);
# Reference it in .prompty
model:
connection:
kind: reference
name: my-openai
Structured Output
Define outputSchema in your .prompty frontmatter and the executor
automatically converts it to OpenAI's response_format parameter:
outputSchema:
properties:
- name: answer
kind: string
- name: confidence
kind: float
Agent Mode (Tool Calling)
var tools = new Dictionary<string, Func<string, Task<string>>>
{
["get_weather"] = async (args) => "72°F and sunny in Seattle"
};
var result = await Pipeline.TurnAsync(
agent, inputs, tools, maxIterations: 10);
Documentation
Visit prompty.ai for full documentation.
License
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net9.0
- OpenAI (>= 2.10.0)
- Prompty.Core (>= 2.0.0-alpha.10)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Prompty.OpenAI:
| Package | Downloads |
|---|---|
|
Prompty.Foundry
Microsoft Foundry (Azure OpenAI) provider for Prompty — executor and processor for Azure-hosted models. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2.0.0-alpha.10 | 47 | 4/14/2026 |
| 2.0.0-alpha.9 | 51 | 4/13/2026 |
| 2.0.0-alpha.8 | 46 | 4/10/2026 |
| 2.0.0-alpha.7 | 49 | 4/9/2026 |
| 2.0.0-alpha.6 | 51 | 4/8/2026 |
| 2.0.0-alpha.2 | 46 | 4/8/2026 |
| 2.0.0-alpha.1 | 51 | 4/8/2026 |