经 AI Skill Hub 精选评估,OpenAI C# SDK 获评「推荐使用」。这款AI工具在功能完整性、社区活跃度和易用性方面表现出色,AI 评分 7.5 分,适合有一定技术背景的用户使用。
基于OpenAI OpenAPI规范的开源C# SDK,提供AI工具的安装和使用。
OpenAI C# SDK 是一款基于 C# 开发的开源工具,专注于 installable、ai、autosdk 等核心功能。作为 GitHub 开源项目,它拥有活跃的社区支持和持续的版本迭代,代码完全透明可审计,支持本地部署以保护数据隐私。无论是个人使用还是集成到企业工作流,都能提供稳定可靠的解决方案。
基于OpenAI OpenAPI规范的开源C# SDK,提供AI工具的安装和使用。
OpenAI C# SDK 是一款基于 C# 开发的开源工具,专注于 installable、ai、autosdk 等核心功能。作为 GitHub 开源项目,它拥有活跃的社区支持和持续的版本迭代,代码完全透明可审计,支持本地部署以保护数据隐私。无论是个人使用还是集成到企业工作流,都能提供稳定可靠的解决方案。
# 克隆仓库 git clone https://github.com/tryAGI/OpenAI cd OpenAI # 查看安装说明 cat README.md # 按 README 完成环境依赖安装后即可使用
# 查看帮助 openai --help # 基本运行 openai [options] <input> # 详细使用说明请查阅文档 # https://github.com/tryAGI/OpenAI
# openai 配置说明 # 查看配置选项 openai --config-example > config.yml # 常见配置项 # output_dir: ./output # log_level: info # workers: 4 # 环境变量(覆盖配置文件) export OPENAI_CONFIG="/path/to/config.yml"
IChatClient and IEmbeddingGenerator support for OpenAI and all CustomProvidersIChatClient builder with provider fallback and manual 429 cooldown trackingFreeLLM package for free-first chat routing across OpenAI-compatible providers and Gemini with OpenAI-compatible and MEAI surfacesusing var api = new OpenAiApi("API_KEY");
string response = await api.Chat.CreateChatCompletionAsync(
messages: ["Generate five random words."],
model: ModelIdsSharedEnum.Gpt4oMini);
Console.WriteLine(response); // "apple, banana, cherry, date, elderberry"
var enumerable = api.Chat.CreateChatCompletionAsStreamAsync(
messages: ["Generate five random words."],
model: ModelIdsSharedEnum.Gpt4oMini);
await foreach (string response in enumerable)
{
Console.WriteLine(response);
} It uses three implicit conversions: - from string to ChatCompletionRequestUserMessage. It will always be converted to the user message. - from ChatCompletionResponseMessage to string . It will always contain the first choice message content. - from CreateChatCompletionStreamResponse to string . It will always contain the first delta content.
You still can use the full response objects if you need more information, just replace string response to var response.
The client natively implements IChatClient and IEmbeddingGenerator<string, Embedding<float>> from Microsoft.Extensions.AI, providing a unified interface across 40+ providers:
using OpenAI;
using Microsoft.Extensions.AI;
// Works with OpenAI and all CustomProviders (Azure, DeepSeek, Groq, etc.)
using var client = new OpenAiClient("API_KEY");
// or: using var client = CustomProviders.Groq("API_KEY");
// IChatClient
IChatClient chatClient = client;
var response = await chatClient.GetResponseAsync(
"Say hello!",
new ChatOptions { ModelId = "gpt-4o-mini" });
Console.WriteLine(response.Messages[0].Text);
// Streaming
await foreach (var update in chatClient.GetStreamingResponseAsync(
"Count to 5.",
new ChatOptions { ModelId = "gpt-4o-mini" }))
{
Console.Write(string.Concat(update.Contents.OfType<TextContent>().Select(c => c.Text)));
}
// IEmbeddingGenerator
IEmbeddingGenerator<string, Embedding<float>> generator = client;
var embeddings = await generator.GenerateAsync(
["Hello, world!"],
new EmbeddingGenerationOptions { ModelId = "text-embedding-3-small" });
该项目提供了一个基于OpenAI OpenAPI规范的C# SDK,支持安装和使用OpenAI AI工具,具有较高的使用价值,但需要进一步优化和完善。
AI Skill Hub 为第三方内容聚合平台,本页面信息基于公开数据整理,不对工具功能和质量作任何法律背书。
建议在沙箱或测试环境中充分验证后,再部署至生产环境,并做好必要的安全评估。
✅ MIT 协议 — 最宽松的开源协议之一,可自由商用、修改、分发,仅需保留版权声明。
AI Skill Hub 点评:OpenAI C# SDK 的核心功能完整,质量良好。对于AI 技术爱好者来说,这是一个值得纳入个人工具库的选择。建议先在非生产环境试用,再逐步推广。
| 原始名称 | OpenAI |
| 原始描述 | 开源AI工具:C# SDK based on official OpenAI OpenAPI specification。⭐34 · C# |
| Topics | installableaiautosdkcsharpdotnet |
| GitHub | https://github.com/tryAGI/OpenAI |
| License | MIT |
| 语言 | C# |
收录时间:2026-05-22 · 更新时间:2026-05-22 · License:MIT · AI Skill Hub 不对第三方内容的准确性作法律背书。