# AllInAI.Sharp.API.Sample **Repository Path**: wxoo/AllInAI.Sharp.API.Sample ## Basic Information - **Project Name**: AllInAI.Sharp.API.Sample - **Description**: No description available - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-12-02 - **Last Updated**: 2025-12-02 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README 

AllInAI.Sharp.API.Sample

![](https://img.shields.io/github/stars/raokun/AllInAI.Sharp.API.Sample) ![](https://img.shields.io/github/forks/raokun/AllInAI.Sharp.API.Sample) [![AllInAI.Sharp.API](https://img.shields.io/nuget/v/AllInAI.Sharp.API?style=for-the-badge)](https://www.nuget.org/packages/AllInAI.Sharp.API/) 中文简介 | [English](README.md) AllInAI.Sharp.API的使用示例文档。AllInAI.Sharp.API一款调用各大平台语言模型的SDK,能帮助使用者快速对接各大模型。已整合OpenAI,chatGLM,文心千帆,同义千问,stable-diffusion 等 支持设置反向代理,支持流式接口 AllInAI SDK 在聊天和图片接口中整合统一的入参和出参。方便调用。 ## Version ``` * V1.1.5 添加openai 语音文字转换Translations接口,语音转英文 * V1.1.4 添加openai 语音文字转换接口whisper * V1.1.3 修复文心千帆模型调用模型问题 * V1.1.2 修复文心千帆模型调用返回为空的问题 ``` ## 已完成模型有 * OpenAI * chatGLM * 文心千帆 * 同义千问 * stable-diffusion ## 使用范例 ### 发起聊天 1.设置基础配置: key -- 模型的秘钥key BaseUrl -- 代理地址 AIType -- 模型类型,对应枚举Enums.AITypeEnum 2.调用接口 1.chat ```c# AuthOption authOption = new AuthOption() { Key = "sk-***", BaseUrl = "https://api.openai.com", AIType = Enums.AITypeEnum.OpenAi }; ChatService chatService = new ChatService(authOption); CompletionReq completionReq = new CompletionReq(); List messages = new List(); messages.Add(new MessageDto() { Role = "user", Content = "Hello!" }); completionReq.Model = "gpt-3.5-turbo"; completionReq.Messages = messages; CompletionRes completionRes = await chatService.Completion(completionReq); ``` 2.image ```c# AuthOption authOption = new AuthOption() {BaseUrl = "http://43.134.164.127:77", AIType = Enums.AITypeEnum.SD }; ImgService imgService = new ImgService(authOption); Txt2ImgReq imgReq = new Txt2ImgReq(); imgReq.Steps = 20; imgReq.Size = "1024x1024"; imgReq.N = 1; imgReq.Prompt = "kitty"; imgReq.ResponseFormat = "b64_json"; ImgRes imgRes = await imgService.Txt2Img(imgReq); ``` ## 如何贡献 Fork & Clone Create Feature/name(your github id)/issuexxx branch Commit with commit message, like solve issue xxx,add xxx Create Pull Request 如果你希望参与贡献,欢迎 Pull Requests,或给我们 Issues ## 捐赠 如果你觉得这个项目对你有帮助,可以请 raokun 喝杯咖啡表示支持,raokun 开源的动力离不开各位的支持和鼓励。

微信

支付宝