{"id":22862648,"url":"https://github.com/ndamulelonemakh/openai-net-starter","last_synced_at":"2025-06-27T05:33:39.984Z","repository":{"id":266182275,"uuid":"870396134","full_name":"ndamulelonemakh/openai-net-starter","owner":"ndamulelonemakh","description":"A console application that showcasing the OpenAI SDK for .NET","archived":false,"fork":false,"pushed_at":"2024-10-10T01:02:03.000Z","size":8,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-23T04:47:26.326Z","etag":null,"topics":["chatbot","chatgpt","dotnet","gpt-4","openai"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ndamulelonemakh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-10T00:56:01.000Z","updated_at":"2024-10-10T01:03:40.000Z","dependencies_parsed_at":"2024-12-03T03:17:04.134Z","dependency_job_id":null,"html_url":"https://github.com/ndamulelonemakh/openai-net-starter","commit_stats":null,"previous_names":["ndamulelonemakh/openai-net-starter"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ndamulelonemakh/openai-net-starter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ndamulelonemakh%2Fopenai-net-starter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ndamulelonemakh%2Fopenai-net-starter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ndamulelonemakh%2Fopenai-net-starter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ndamulelonemakh%2Fopenai-net-starter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ndamulelonemakh","download_url":"https://codeload.github.com/ndamulelonemakh/openai-net-starter/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ndamulelonemakh%2Fopenai-net-starter/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262198615,"owners_count":23273879,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chatbot","chatgpt","dotnet","gpt-4","openai"],"created_at":"2024-12-13T10:14:13.403Z","updated_at":"2025-06-27T05:33:39.963Z","avatar_url":"https://github.com/ndamulelonemakh.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OpenAI SDK for .NET: Getting Started Tutorial\n\n## Introduction\n\nThis repository provides a simple introduction to using the [OpenAI SDK for .NET](https://github.com/openai/openai-dotnet) through a console application. You will learn how to set up the OpenAI ChatClient, use the completitions API and implement chat history to recall context from previous turns.\n\n## Prerequisites\n\nBefore you begin, make sure you have the following:\n\n- [.NET 8.0 SDK or later](https://dotnet.microsoft.com/download)\n- An API key from OpenAI. You can obtain this by creating an account at [OpenAI's platform](https://platform.openai.com/api-keys).\n\n## Installation\n\n1. Clone this repository:\n   ```bash\n   git clone https://github.com/ndamulelonemakh/openai-net-starter.git\n   ```\n\n2. Install the OpenAI SDK for .NET using NuGet:\n   ```bash\n   cd openai-net-starter\n   dotnet add package OpenAI\n   ```\n\n## Environment Setup\n\nTo interact with OpenAI, you need an API key. Set it up in your environment as follows:\n\n**Windows**\n```bash\nsetx OPENAI_API_KEY \"YOUR_API_KEY_HERE\"\n```\n\n**Linux/macOS**\n```bash\nexport OPENAI_API_KEY=\"YOUR_API_KEY_HERE\"\n```\n\n## Usage\n\n2. **How to Run**\n\n   - Open your terminal, navigate to the directory containing the project, and run:\n   \n     ```bash\n     dotnet run\n     ```\n\n   - You will be prompted to enter a message. Enter any message you want, and the assistant will respond.\n   \n   - Type `exit` to end the session. \n\n## How It Works\n\n- The application uses a `ChatClient` to interact with the OpenAI model (e.g., GPT-4).\n- User input is taken from the console and added to a conversation history (`chatHistory`) to maintain context over multiple turns.\n- Each input is passed to the [OpenAI REST API](https://platform.openai.com/docs/api-reference), and the response is displayed back to the user.\n- The conversation continues until the user types \"exit\".\n\n## Notes\n\n- Remember to use a valid API key and handle your credentials securely.\n- This project is intended as an introductory example, suitable for expanding into more sophisticated .NET applications.\n\n## Contributing\n\nFeel free to open issues or pull requests for suggestions and improvements. Contributions are always welcome!\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n\n## Contact\n\nIf you have any questions, reach out via the [Issues tab](https://github.com/ndamulelonemakh/openai-net-starter/issues)\n\n\n---\n\n# References\n\n* [Dotnet Scripted Install for Linux](https://learn.microsoft.com/en-us/dotnet/core/install/linux-scripted-manual#scripted-install)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fndamulelonemakh%2Fopenai-net-starter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fndamulelonemakh%2Fopenai-net-starter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fndamulelonemakh%2Fopenai-net-starter/lists"}