{"id":53240,"date":"2025-04-22T13:06:35","date_gmt":"2025-04-22T03:06:35","guid":{"rendered":"https:\/\/www.cloudproinc.com.au\/?p=53240"},"modified":"2025-04-22T13:06:37","modified_gmt":"2025-04-22T03:06:37","slug":"build-a-blazor-web-app-to-translate-text-with-openai-gpt-4o","status":"publish","type":"post","link":"https:\/\/cloudproinc.azurewebsites.net\/index.php\/2025\/04\/22\/build-a-blazor-web-app-to-translate-text-with-openai-gpt-4o\/","title":{"rendered":"Build a Blazor Web App to Translate Text with OpenAI GPT-4o"},"content":{"rendered":"\n<p>In this OpenAI .NET blog post, we will demonstrate how to create a web application running on Blazor that translates text using GPT-4o.<\/p>\n\n\n\n<!--more-->\n\n\n\n<p>With the official OpenAI .NET library, it is possible to leverage the entire OpenAI API, including the latest<a href=\"https:\/\/www.cloudproinc.com.au\/index.php\/2025\/04\/18\/getting-started-with-the-openai-responses-api-in-net\/\"> Responses API<\/a>. This post will guide you in creating a simple web application that translates text from English to two languages (additional languages can be added).<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Get Started<\/h2>\n\n\n\n<p>To create the web application, an OpenAI developer account with an API key is required to make API calls to the OpenAI API service.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Create Blazor Web Application<\/h2>\n\n\n\n<p>To create a Blazor web application, use Dotnet CLI (`dotnet new blazor`) or Visual Studio Code.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Install OpenAI .NET Library<\/h2>\n\n\n\n<p>The main component of the web application is the OpenAI .NET library. To utilize the latest features, install the latest version using the following dotnet command:<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background\"><code>dotnet add package OpenAI --prerelease<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Create OpenAI Service<\/h2>\n\n\n\n<p>To interact with the OpenAI API, a service needs to be created to send the text for translation to the GPT-4o LLM model. From the root folder of the Blazor application, create a folder named <strong>Services<\/strong>. Inside this folder, create a file named <strong>TranslateService.cs<\/strong>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"236\" height=\"233\" data-src=\"\/wp-content\/uploads\/2025\/04\/image-3.jpg\" alt=\"\" class=\"wp-image-53241 lazyload\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 236px; --smush-placeholder-aspect-ratio: 236\/233;\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Service Configuration<\/h2>\n\n\n\n<p>With the folder structure established, we can proceed to configure the service. The following code snippet creates a service and a function that receives text input along with the target language for translation.<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background has-link-color wp-elements-1bf3c09af00ee38cb7502227c89efb8f\"><code>using OpenAI.Chat;\n\nnamespace OpenAI_Translate.Services\n\n{\n\n\u00a0\u00a0\u00a0 public class TranslationService\n\n\u00a0\u00a0\u00a0 {\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 public async Task&lt;string> TranslateAsync(string inputText, string toLanguage)\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 {\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ChatClient client = new(model: \"gpt-4o\", apiKey: Environment.GetEnvironmentVariable(\"OPENAI_API_KEY\"));\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 try\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 {\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/\/ Use OpenAI API to translate text\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 var prompt = $\"Translate the following text to {toLanguage}: {inputText}\";\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ChatCompletion completion = await client.CompleteChatAsync(prompt);\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/\/ Extract the translated text\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 return completion.Content&#91;0].Text.Trim();\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 catch (Exception ex)\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 {\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/\/ Handle exceptions\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 return $\"Translation failed: {ex.Message}\";\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }\n\n\u00a0\u00a0\u00a0 }\n\n}<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Add Service to main<\/h2>\n\n\n\n<p>Add the following code in the Program.cs file to register the service.<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background has-link-color wp-elements-e6a3eb7a19079cc7d9b9a0b8e38feb2c\"><code>\u00a0\u00a0\u00a0 builder.Services.AddSingleton&lt;TranslationService>();\n\u00a0\u00a0\u00a0 builder.Services.AddScoped&lt;TranslationService>();<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">User Interface<\/h2>\n\n\n\n<p>Finally, create a user interface to send input to the service. Add the following code to the <strong>Home.razor<\/strong> page.<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background has-link-color wp-elements-d60d73a94f862cdc2167a488ddb34749\"><code>@page \"\/\"\n\n@using Services\n\n@rendermode InteractiveServer\n\n&lt;PageTitle>Home&lt;\/PageTitle>\n\n&lt;div class=\"d-flex justify-content-center align-items-center\" style=\"min-height: 80vh; background-color: #f8f9fa;\">\n\n\u00a0\u00a0\u00a0 &lt;div class=\"card shadow-lg p-5 bg-white rounded\" style=\"width: 50%; max-width: 800px;\">\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &lt;h2 class=\"text-center mb-4\" style=\"color: #343a40;\">Translate Text&lt;\/h2>\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &lt;EditForm Model=\"@inputText\" OnValidSubmit=\"TranslateText\">\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &lt;div class=\"mb-4\">\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &lt;label for=\"inputText\" class=\"form-label\" style=\"font-weight: 600;\">Enter text to translate&lt;\/label>\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &lt;textarea id=\"inputText\" class=\"form-control form-control-lg\" rows=\"5\" placeholder=\"Enter text to translate\" @bind=\"inputText\">&lt;\/textarea>\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &lt;\/div>\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &lt;div class=\"mb-4\">\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &lt;label for=\"selectedLanguage\" class=\"form-label\" style=\"font-weight: 600;\">Select language&lt;\/label>\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &lt;select id=\"selectedLanguage\" class=\"form-select form-select-lg\" @bind=\"selectedLanguage\">\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 @foreach (var language in languages)\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 {\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &lt;option value=\"@language\">@language&lt;\/option>\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &lt;\/select>\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &lt;\/div>\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &lt;div class=\"d-grid gap-2\">\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &lt;button type=\"submit\" class=\"btn btn-primary btn-lg\" style=\"background-color: #007bff; border-color: #007bff;\">Translate&lt;\/button>\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &lt;\/div>\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &lt;\/EditForm>\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 @if (!string.IsNullOrEmpty(translatedText))\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 {\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &lt;div class=\"mt-5 p-4 bg-light rounded\">\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &lt;h4 class=\"text-primary\">Translated Text:&lt;\/h4>\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &lt;p class=\"text-dark\">@translatedText&lt;\/p>\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &lt;\/div>\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }\n\n\u00a0\u00a0\u00a0 &lt;\/div>\n\n&lt;\/div>\n\n@code {\n\n\u00a0\u00a0\u00a0 protected override async Task OnInitializedAsync()\n\n{\n\n\u00a0\u00a0\u00a0 if (TranslationService == null)\n\n\u00a0\u00a0\u00a0 {\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 translatedText = \"Translation service is not initialized.\";\n\n\u00a0\u00a0\u00a0 }\n\n\u00a0\u00a0\u00a0 \/\/ Initialize other properties here if necessary\n\n}\n\n\u00a0\u00a0\u00a0\u00a0 private string inputText = string.Empty;\n\n\u00a0\u00a0\u00a0\u00a0 private string selectedLanguage = \"en\"; \/\/ Default to \"en\" or any preferred language.\n\n\u00a0\u00a0\u00a0 private string translatedText;\n\n\u00a0\u00a0\u00a0 private List&lt;string> languages = new List&lt;string> { \"en\", \"es\", \"fr\" };\n\n&#91;Inject]\n\nprivate TranslationService TranslationService { get; set; }\n\n\u00a0\u00a0\u00a0\u00a0 private async Task TranslateText()\n\n\u00a0\u00a0\u00a0 {\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 if (TranslationService == null)\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 {\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 translatedText = \"Translation service is not available.\";\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Console.WriteLine(\"TranslationService is null.\");\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 return;\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Console.WriteLine($\"Translating '{inputText}' to '{selectedLanguage}'\");\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 if (string.IsNullOrEmpty(inputText) || string.IsNullOrEmpty(selectedLanguage))\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 {\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 translatedText = \"Please provide both text and language.\";\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 return;\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 try\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 {\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 translatedText = await TranslationService.TranslateAsync(inputText, selectedLanguage);\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 catch (Exception ex)\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 {\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 translatedText = $\"Translation failed: {ex.Message}\";\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }\n\n\u00a0\u00a0\u00a0 }\n\n}<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Run and Test<\/h2>\n\n\n\n<p>To run the web application, execute the program using `dotnet run` and open a web browser. The interface will appear as shown. To see a demonstration of how it works, visit the following <a href=\"https:\/\/www.spellproesl.com\/translate\" target=\"_blank\" rel=\"noreferrer noopener\">demo page<\/a> which uses the same code.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"921\" height=\"487\" data-src=\"\/wp-content\/uploads\/2025\/04\/image-4.png\" alt=\"\" class=\"wp-image-53243 lazyload\" data-srcset=\"\/wp-content\/uploads\/2025\/04\/image-4.png 921w, \/wp-content\/uploads\/2025\/04\/image-4-300x159.png 300w, \/wp-content\/uploads\/2025\/04\/image-4-768x406.png 768w, \/wp-content\/uploads\/2025\/04\/image-4-480x254.png 480w\" data-sizes=\"(max-width: 921px) 100vw, 921px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 921px; --smush-placeholder-aspect-ratio: 921\/487;\" \/><\/figure>\n\n\n\n<div class=\"wp-block-jetpack-related-posts\">\n<h2 class=\"wp-block-heading\">Related<\/h2>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>In this OpenAI .NET blog post, we will demonstrate how to create a web application running on Blazor that translates text using GPT-4o.<\/p>\n","protected":false},"author":1,"featured_media":53244,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_yoast_wpseo_focuskw":"Build a Blazor Web App to Translate Text with OpenAI GPT-4o","_yoast_wpseo_title":"","_yoast_wpseo_metadesc":"Learn how to build a Blazor web application using .NET and OpenAI's GPT-4o model to translate text between languages. Step-by-step guide, code snippets, and UI implementation included.","_yoast_wpseo_opengraph-title":"","_yoast_wpseo_opengraph-description":"","_yoast_wpseo_twitter-title":"","_yoast_wpseo_twitter-description":"","_et_pb_use_builder":"off","_et_pb_old_content":"","_et_gb_content_width":"","_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[67,13,53],"tags":[],"class_list":["post-53240","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blazor","category-blog","category-openai"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.3 (Yoast SEO v27.3) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Build a Blazor Web App to Translate Text with OpenAI GPT-4o - CPI Consulting<\/title>\n<meta name=\"description\" content=\"Learn how to build a Blazor web application using .NET and OpenAI&#039;s GPT-4o model to translate text between languages. Step-by-step guide, code snippets, and UI implementation included.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/cloudproinc.azurewebsites.net\/index.php\/2025\/04\/22\/build-a-blazor-web-app-to-translate-text-with-openai-gpt-4o\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Build a Blazor Web App to Translate Text with OpenAI GPT-4o\" \/>\n<meta property=\"og:description\" content=\"Learn how to build a Blazor web application using .NET and OpenAI&#039;s GPT-4o model to translate text between languages. Step-by-step guide, code snippets, and UI implementation included.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/cloudproinc.azurewebsites.net\/index.php\/2025\/04\/22\/build-a-blazor-web-app-to-translate-text-with-openai-gpt-4o\/\" \/>\n<meta property=\"og:site_name\" content=\"CPI Consulting\" \/>\n<meta property=\"article:published_time\" content=\"2025-04-22T03:06:35+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-04-22T03:06:37+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cloudproinc.azurewebsites.net\/wp-content\/uploads\/2025\/04\/Translate-Text-With-OpenAI-and-Blazor-.NET-WebApp-1024x683.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1024\" \/>\n\t<meta property=\"og:image:height\" content=\"683\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"CPI Staff\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"CPI Staff\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/cloudproinc.azurewebsites.net\\\/index.php\\\/2025\\\/04\\\/22\\\/build-a-blazor-web-app-to-translate-text-with-openai-gpt-4o\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/cloudproinc.azurewebsites.net\\\/index.php\\\/2025\\\/04\\\/22\\\/build-a-blazor-web-app-to-translate-text-with-openai-gpt-4o\\\/\"},\"author\":{\"name\":\"CPI Staff\",\"@id\":\"https:\\\/\\\/www.cloudproinc.com.au\\\/#\\\/schema\\\/person\\\/192eeeb0ce91062126ce3822ae88fe6e\"},\"headline\":\"Build a Blazor Web App to Translate Text with OpenAI GPT-4o\",\"datePublished\":\"2025-04-22T03:06:35+00:00\",\"dateModified\":\"2025-04-22T03:06:37+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/cloudproinc.azurewebsites.net\\\/index.php\\\/2025\\\/04\\\/22\\\/build-a-blazor-web-app-to-translate-text-with-openai-gpt-4o\\\/\"},\"wordCount\":323,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.cloudproinc.com.au\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/cloudproinc.azurewebsites.net\\\/index.php\\\/2025\\\/04\\\/22\\\/build-a-blazor-web-app-to-translate-text-with-openai-gpt-4o\\\/#primaryimage\"},\"thumbnailUrl\":\"\\\/wp-content\\\/uploads\\\/2025\\\/04\\\/Translate-Text-With-OpenAI-and-Blazor-.NET-WebApp.png\",\"articleSection\":[\"Blazor\",\"Blog\",\"OpenAI\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/cloudproinc.azurewebsites.net\\\/index.php\\\/2025\\\/04\\\/22\\\/build-a-blazor-web-app-to-translate-text-with-openai-gpt-4o\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/cloudproinc.azurewebsites.net\\\/index.php\\\/2025\\\/04\\\/22\\\/build-a-blazor-web-app-to-translate-text-with-openai-gpt-4o\\\/\",\"url\":\"https:\\\/\\\/cloudproinc.azurewebsites.net\\\/index.php\\\/2025\\\/04\\\/22\\\/build-a-blazor-web-app-to-translate-text-with-openai-gpt-4o\\\/\",\"name\":\"Build a Blazor Web App to Translate Text with OpenAI GPT-4o - CPI Consulting\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.cloudproinc.com.au\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/cloudproinc.azurewebsites.net\\\/index.php\\\/2025\\\/04\\\/22\\\/build-a-blazor-web-app-to-translate-text-with-openai-gpt-4o\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/cloudproinc.azurewebsites.net\\\/index.php\\\/2025\\\/04\\\/22\\\/build-a-blazor-web-app-to-translate-text-with-openai-gpt-4o\\\/#primaryimage\"},\"thumbnailUrl\":\"\\\/wp-content\\\/uploads\\\/2025\\\/04\\\/Translate-Text-With-OpenAI-and-Blazor-.NET-WebApp.png\",\"datePublished\":\"2025-04-22T03:06:35+00:00\",\"dateModified\":\"2025-04-22T03:06:37+00:00\",\"description\":\"Learn how to build a Blazor web application using .NET and OpenAI's GPT-4o model to translate text between languages. Step-by-step guide, code snippets, and UI implementation included.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/cloudproinc.azurewebsites.net\\\/index.php\\\/2025\\\/04\\\/22\\\/build-a-blazor-web-app-to-translate-text-with-openai-gpt-4o\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/cloudproinc.azurewebsites.net\\\/index.php\\\/2025\\\/04\\\/22\\\/build-a-blazor-web-app-to-translate-text-with-openai-gpt-4o\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/cloudproinc.azurewebsites.net\\\/index.php\\\/2025\\\/04\\\/22\\\/build-a-blazor-web-app-to-translate-text-with-openai-gpt-4o\\\/#primaryimage\",\"url\":\"\\\/wp-content\\\/uploads\\\/2025\\\/04\\\/Translate-Text-With-OpenAI-and-Blazor-.NET-WebApp.png\",\"contentUrl\":\"\\\/wp-content\\\/uploads\\\/2025\\\/04\\\/Translate-Text-With-OpenAI-and-Blazor-.NET-WebApp.png\",\"width\":1536,\"height\":1024},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/cloudproinc.azurewebsites.net\\\/index.php\\\/2025\\\/04\\\/22\\\/build-a-blazor-web-app-to-translate-text-with-openai-gpt-4o\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.cloudproinc.com.au\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Build a Blazor Web App to Translate Text with OpenAI GPT-4o\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.cloudproinc.com.au\\\/#website\",\"url\":\"https:\\\/\\\/www.cloudproinc.com.au\\\/\",\"name\":\"Cloud Pro Inc - CPI Consulting Pty Ltd\",\"description\":\"Cloud, AI &amp; Cybersecurity Consulting | Melbourne\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.cloudproinc.com.au\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.cloudproinc.com.au\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.cloudproinc.com.au\\\/#organization\",\"name\":\"Cloud Pro Inc - Cloud Pro Inc - CPI Consulting Pty Ltd\",\"url\":\"https:\\\/\\\/www.cloudproinc.com.au\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.cloudproinc.com.au\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"\\\/wp-content\\\/uploads\\\/2022\\\/01\\\/favfinalfile.png\",\"contentUrl\":\"\\\/wp-content\\\/uploads\\\/2022\\\/01\\\/favfinalfile.png\",\"width\":500,\"height\":500,\"caption\":\"Cloud Pro Inc - Cloud Pro Inc - CPI Consulting Pty Ltd\"},\"image\":{\"@id\":\"https:\\\/\\\/www.cloudproinc.com.au\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.cloudproinc.com.au\\\/#\\\/schema\\\/person\\\/192eeeb0ce91062126ce3822ae88fe6e\",\"name\":\"CPI Staff\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/2d96eeb53b791d92c8c50dd667e3beec92c93253bb6ff21c02cfa8ca73665c70?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/2d96eeb53b791d92c8c50dd667e3beec92c93253bb6ff21c02cfa8ca73665c70?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/2d96eeb53b791d92c8c50dd667e3beec92c93253bb6ff21c02cfa8ca73665c70?s=96&d=mm&r=g\",\"caption\":\"CPI Staff\"},\"sameAs\":[\"http:\\\/\\\/www.cloudproinc.com.au\"],\"url\":\"https:\\\/\\\/cloudproinc.azurewebsites.net\\\/index.php\\\/author\\\/cpiadmin\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Build a Blazor Web App to Translate Text with OpenAI GPT-4o - CPI Consulting","description":"Learn how to build a Blazor web application using .NET and OpenAI's GPT-4o model to translate text between languages. Step-by-step guide, code snippets, and UI implementation included.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/cloudproinc.azurewebsites.net\/index.php\/2025\/04\/22\/build-a-blazor-web-app-to-translate-text-with-openai-gpt-4o\/","og_locale":"en_US","og_type":"article","og_title":"Build a Blazor Web App to Translate Text with OpenAI GPT-4o","og_description":"Learn how to build a Blazor web application using .NET and OpenAI's GPT-4o model to translate text between languages. Step-by-step guide, code snippets, and UI implementation included.","og_url":"https:\/\/cloudproinc.azurewebsites.net\/index.php\/2025\/04\/22\/build-a-blazor-web-app-to-translate-text-with-openai-gpt-4o\/","og_site_name":"CPI Consulting","article_published_time":"2025-04-22T03:06:35+00:00","article_modified_time":"2025-04-22T03:06:37+00:00","og_image":[{"width":1024,"height":683,"url":"https:\/\/cloudproinc.azurewebsites.net\/wp-content\/uploads\/2025\/04\/Translate-Text-With-OpenAI-and-Blazor-.NET-WebApp-1024x683.png","type":"image\/png"}],"author":"CPI Staff","twitter_card":"summary_large_image","twitter_misc":{"Written by":"CPI Staff","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/cloudproinc.azurewebsites.net\/index.php\/2025\/04\/22\/build-a-blazor-web-app-to-translate-text-with-openai-gpt-4o\/#article","isPartOf":{"@id":"https:\/\/cloudproinc.azurewebsites.net\/index.php\/2025\/04\/22\/build-a-blazor-web-app-to-translate-text-with-openai-gpt-4o\/"},"author":{"name":"CPI Staff","@id":"https:\/\/www.cloudproinc.com.au\/#\/schema\/person\/192eeeb0ce91062126ce3822ae88fe6e"},"headline":"Build a Blazor Web App to Translate Text with OpenAI GPT-4o","datePublished":"2025-04-22T03:06:35+00:00","dateModified":"2025-04-22T03:06:37+00:00","mainEntityOfPage":{"@id":"https:\/\/cloudproinc.azurewebsites.net\/index.php\/2025\/04\/22\/build-a-blazor-web-app-to-translate-text-with-openai-gpt-4o\/"},"wordCount":323,"commentCount":0,"publisher":{"@id":"https:\/\/www.cloudproinc.com.au\/#organization"},"image":{"@id":"https:\/\/cloudproinc.azurewebsites.net\/index.php\/2025\/04\/22\/build-a-blazor-web-app-to-translate-text-with-openai-gpt-4o\/#primaryimage"},"thumbnailUrl":"\/wp-content\/uploads\/2025\/04\/Translate-Text-With-OpenAI-and-Blazor-.NET-WebApp.png","articleSection":["Blazor","Blog","OpenAI"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/cloudproinc.azurewebsites.net\/index.php\/2025\/04\/22\/build-a-blazor-web-app-to-translate-text-with-openai-gpt-4o\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/cloudproinc.azurewebsites.net\/index.php\/2025\/04\/22\/build-a-blazor-web-app-to-translate-text-with-openai-gpt-4o\/","url":"https:\/\/cloudproinc.azurewebsites.net\/index.php\/2025\/04\/22\/build-a-blazor-web-app-to-translate-text-with-openai-gpt-4o\/","name":"Build a Blazor Web App to Translate Text with OpenAI GPT-4o - CPI Consulting","isPartOf":{"@id":"https:\/\/www.cloudproinc.com.au\/#website"},"primaryImageOfPage":{"@id":"https:\/\/cloudproinc.azurewebsites.net\/index.php\/2025\/04\/22\/build-a-blazor-web-app-to-translate-text-with-openai-gpt-4o\/#primaryimage"},"image":{"@id":"https:\/\/cloudproinc.azurewebsites.net\/index.php\/2025\/04\/22\/build-a-blazor-web-app-to-translate-text-with-openai-gpt-4o\/#primaryimage"},"thumbnailUrl":"\/wp-content\/uploads\/2025\/04\/Translate-Text-With-OpenAI-and-Blazor-.NET-WebApp.png","datePublished":"2025-04-22T03:06:35+00:00","dateModified":"2025-04-22T03:06:37+00:00","description":"Learn how to build a Blazor web application using .NET and OpenAI's GPT-4o model to translate text between languages. Step-by-step guide, code snippets, and UI implementation included.","breadcrumb":{"@id":"https:\/\/cloudproinc.azurewebsites.net\/index.php\/2025\/04\/22\/build-a-blazor-web-app-to-translate-text-with-openai-gpt-4o\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/cloudproinc.azurewebsites.net\/index.php\/2025\/04\/22\/build-a-blazor-web-app-to-translate-text-with-openai-gpt-4o\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/cloudproinc.azurewebsites.net\/index.php\/2025\/04\/22\/build-a-blazor-web-app-to-translate-text-with-openai-gpt-4o\/#primaryimage","url":"\/wp-content\/uploads\/2025\/04\/Translate-Text-With-OpenAI-and-Blazor-.NET-WebApp.png","contentUrl":"\/wp-content\/uploads\/2025\/04\/Translate-Text-With-OpenAI-and-Blazor-.NET-WebApp.png","width":1536,"height":1024},{"@type":"BreadcrumbList","@id":"https:\/\/cloudproinc.azurewebsites.net\/index.php\/2025\/04\/22\/build-a-blazor-web-app-to-translate-text-with-openai-gpt-4o\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.cloudproinc.com.au\/"},{"@type":"ListItem","position":2,"name":"Build a Blazor Web App to Translate Text with OpenAI GPT-4o"}]},{"@type":"WebSite","@id":"https:\/\/www.cloudproinc.com.au\/#website","url":"https:\/\/www.cloudproinc.com.au\/","name":"Cloud Pro Inc - CPI Consulting Pty Ltd","description":"Cloud, AI &amp; Cybersecurity Consulting | Melbourne","publisher":{"@id":"https:\/\/www.cloudproinc.com.au\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.cloudproinc.com.au\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.cloudproinc.com.au\/#organization","name":"Cloud Pro Inc - Cloud Pro Inc - CPI Consulting Pty Ltd","url":"https:\/\/www.cloudproinc.com.au\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.cloudproinc.com.au\/#\/schema\/logo\/image\/","url":"\/wp-content\/uploads\/2022\/01\/favfinalfile.png","contentUrl":"\/wp-content\/uploads\/2022\/01\/favfinalfile.png","width":500,"height":500,"caption":"Cloud Pro Inc - Cloud Pro Inc - CPI Consulting Pty Ltd"},"image":{"@id":"https:\/\/www.cloudproinc.com.au\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.cloudproinc.com.au\/#\/schema\/person\/192eeeb0ce91062126ce3822ae88fe6e","name":"CPI Staff","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/2d96eeb53b791d92c8c50dd667e3beec92c93253bb6ff21c02cfa8ca73665c70?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/2d96eeb53b791d92c8c50dd667e3beec92c93253bb6ff21c02cfa8ca73665c70?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/2d96eeb53b791d92c8c50dd667e3beec92c93253bb6ff21c02cfa8ca73665c70?s=96&d=mm&r=g","caption":"CPI Staff"},"sameAs":["http:\/\/www.cloudproinc.com.au"],"url":"https:\/\/cloudproinc.azurewebsites.net\/index.php\/author\/cpiadmin\/"}]}},"jetpack_featured_media_url":"\/wp-content\/uploads\/2025\/04\/Translate-Text-With-OpenAI-and-Blazor-.NET-WebApp.png","jetpack-related-posts":[{"id":53341,"url":"https:\/\/cloudproinc.azurewebsites.net\/index.php\/2025\/05\/01\/building-a-blazor-net-app-that-recognizes-images-with-openai\/","url_meta":{"origin":53240,"position":0},"title":"Building a Blazor .NET App that Recognizes Images with OpenAI","author":"CPI Staff","date":"May 1, 2025","format":false,"excerpt":"In this blog post, we\u2019ll show you how to Build a Blazor .NET App that Recognizes Images with OpenAI. You\u2019ll see how we securely upload image files, send them to OpenAI\u2019s API, and return a natural-language response\u2014seamlessly integrated into a modern web interface. This example highlights how CPI Consulting applies\u2026","rel":"","context":"In &quot;.NET&quot;","block_context":{"text":".NET","link":"https:\/\/cloudproinc.azurewebsites.net\/index.php\/category\/net\/"},"img":{"alt_text":"","src":"\/wp-content\/uploads\/2025\/05\/Building-a-Blazor-NET-App-that-Recognizes-Images-with-OpenAI-e1746073555343.png","width":350,"height":200,"srcset":"\/wp-content\/uploads\/2025\/05\/Building-a-Blazor-NET-App-that-Recognizes-Images-with-OpenAI-e1746073555343.png 1x, \/wp-content\/uploads\/2025\/05\/Building-a-Blazor-NET-App-that-Recognizes-Images-with-OpenAI-e1746073555343.png 1.5x, \/wp-content\/uploads\/2025\/05\/Building-a-Blazor-NET-App-that-Recognizes-Images-with-OpenAI-e1746073555343.png 2x"},"classes":[]},{"id":53293,"url":"https:\/\/cloudproinc.azurewebsites.net\/index.php\/2025\/04\/25\/openai-gpt-image-1-blazor-net-image-generator-web-app\/","url_meta":{"origin":53240,"position":1},"title":"OpenAI GPT-Image-1 Blazor .NET Image Generator Web App","author":"CPI Staff","date":"April 25, 2025","format":false,"excerpt":"In this blog post, we will present the OpenAI GPT-Image-1 Blazor .NET Image Generator Web App, a tool designed to demonstrate the capabilities of OpenAI's latest image generation API. \u00a0What Does the Web App Do? This Blazor-based web application leverages OpenAI's GPT-Image-1 model to generate stunning, high-quality images based on\u2026","rel":"","context":"In &quot;.NET&quot;","block_context":{"text":".NET","link":"https:\/\/cloudproinc.azurewebsites.net\/index.php\/category\/net\/"},"img":{"alt_text":"","src":"\/wp-content\/uploads\/2025\/04\/OpenAI-GPT-image-1-image-API.png","width":350,"height":200,"srcset":"\/wp-content\/uploads\/2025\/04\/OpenAI-GPT-image-1-image-API.png 1x, \/wp-content\/uploads\/2025\/04\/OpenAI-GPT-image-1-image-API.png 1.5x, \/wp-content\/uploads\/2025\/04\/OpenAI-GPT-image-1-image-API.png 2x"},"classes":[]},{"id":53614,"url":"https:\/\/cloudproinc.azurewebsites.net\/index.php\/2025\/08\/14\/turn-wordpress-posts-into-voice-blogs-with-python-openai-tts\/","url_meta":{"origin":53240,"position":2},"title":"Turn WordPress Posts into \u201cVoice Blogs\u201d with Python + OpenAI TTS","author":"CPI Staff","date":"August 14, 2025","format":false,"excerpt":"This blog post, \"Turn WordPress Posts into \u201cVoice Blogs\u201d with Python + OpenAI TTS\" will show you how to pull posts from a WordPress site via the REST API, converts the article content to speech using OpenAI\u2019s Text-to-Speech (TTS), saves an MP3, and (optionally) uploads the file back to your\u2026","rel":"","context":"In &quot;AI&quot;","block_context":{"text":"AI","link":"https:\/\/cloudproinc.azurewebsites.net\/index.php\/category\/ai\/"},"img":{"alt_text":"","src":"\/wp-content\/uploads\/2025\/08\/turn-wordpress-posts-into-voice-blogs-with-python-openai-tts-1.png","width":350,"height":200,"srcset":"\/wp-content\/uploads\/2025\/08\/turn-wordpress-posts-into-voice-blogs-with-python-openai-tts-1.png 1x, \/wp-content\/uploads\/2025\/08\/turn-wordpress-posts-into-voice-blogs-with-python-openai-tts-1.png 1.5x, \/wp-content\/uploads\/2025\/08\/turn-wordpress-posts-into-voice-blogs-with-python-openai-tts-1.png 2x, \/wp-content\/uploads\/2025\/08\/turn-wordpress-posts-into-voice-blogs-with-python-openai-tts-1.png 3x, \/wp-content\/uploads\/2025\/08\/turn-wordpress-posts-into-voice-blogs-with-python-openai-tts-1.png 4x"},"classes":[]},{"id":739,"url":"https:\/\/cloudproinc.azurewebsites.net\/index.php\/2024\/10\/07\/creating-a-text-to-speech-power-app-using-openai-whisper\/","url_meta":{"origin":53240,"position":3},"title":"Creating a Text-to-Speech Power App Using OpenAI Whisper","author":"CPI Staff","date":"October 7, 2024","format":false,"excerpt":"In this post on OpenAI and Microsoft Power Apps, we will create a Text-to-Speech Power App using OpenAI Whisper. Table of contentsCreating a Text-to-Speech Power App Using OpenAI WhisperGet an API Key from OpenAICreating a Text-to-Speech Power AppCreate Power Automate FlowRelated Articles OpenAI whisper is OpenAI's Text-to-Speech service, offering human-like\u2026","rel":"","context":"In &quot;AI&quot;","block_context":{"text":"AI","link":"https:\/\/cloudproinc.azurewebsites.net\/index.php\/category\/ai\/"},"img":{"alt_text":"","src":"\/wp-content\/uploads\/2024\/10\/Creating-a-Text-to-Speech-Power-App-Using-OpenAI-Whisper.webp","width":350,"height":200,"srcset":"\/wp-content\/uploads\/2024\/10\/Creating-a-Text-to-Speech-Power-App-Using-OpenAI-Whisper.webp 1x, \/wp-content\/uploads\/2024\/10\/Creating-a-Text-to-Speech-Power-App-Using-OpenAI-Whisper.webp 1.5x, \/wp-content\/uploads\/2024\/10\/Creating-a-Text-to-Speech-Power-App-Using-OpenAI-Whisper.webp 2x"},"classes":[]},{"id":751,"url":"https:\/\/cloudproinc.azurewebsites.net\/index.php\/2024\/10\/07\/generate-dall-e-images-with-net-c-console-application\/","url_meta":{"origin":53240,"position":4},"title":"Generate DALL-E Images with .NET C# Console Application","author":"CPI Staff","date":"October 7, 2024","format":false,"excerpt":"This Azure OpenAI article will show you how to generate DALL-E images with .NET C# Console application using the Azure SDK for .NET. Table of contentsAzure SDK for .NETGenerate DALL-E Images with .NET C# Console ApplicationInstall-PackageProgram.csRelated Articles Azure SDK for .NET allows us to build Gen-AI applications using .NET, the\u2026","rel":"","context":"In &quot;.NET&quot;","block_context":{"text":".NET","link":"https:\/\/cloudproinc.azurewebsites.net\/index.php\/category\/net\/"},"img":{"alt_text":"","src":"\/wp-content\/uploads\/2024\/07\/Reading-Handwriting-with-Azure-AI-Vision-and-.NET-C.webp","width":350,"height":200,"srcset":"\/wp-content\/uploads\/2024\/07\/Reading-Handwriting-with-Azure-AI-Vision-and-.NET-C.webp 1x, \/wp-content\/uploads\/2024\/07\/Reading-Handwriting-with-Azure-AI-Vision-and-.NET-C.webp 1.5x, \/wp-content\/uploads\/2024\/07\/Reading-Handwriting-with-Azure-AI-Vision-and-.NET-C.webp 2x"},"classes":[]},{"id":53555,"url":"https:\/\/cloudproinc.azurewebsites.net\/index.php\/2025\/07\/29\/counting-tokens-using-the-openai-python-sdk\/","url_meta":{"origin":53240,"position":5},"title":"Counting Tokens Using the OpenAI Python SDK","author":"CPI Staff","date":"July 29, 2025","format":false,"excerpt":"This post provides a comprehensive guide on counting tokens using the OpenAI Python SDK, covering Python virtual environments, managing your OpenAI API key securely, and the role of the requirements.txt file. In the world of Large Language Models (LLMs) and Artificial Intelligence (AI), the term \"token\" frequently arises. Tokens are\u2026","rel":"","context":"In &quot;AI&quot;","block_context":{"text":"AI","link":"https:\/\/cloudproinc.azurewebsites.net\/index.php\/category\/ai\/"},"img":{"alt_text":"","src":"\/wp-content\/uploads\/2025\/07\/image-23.png","width":350,"height":200,"srcset":"\/wp-content\/uploads\/2025\/07\/image-23.png 1x, \/wp-content\/uploads\/2025\/07\/image-23.png 1.5x, \/wp-content\/uploads\/2025\/07\/image-23.png 2x"},"classes":[]}],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/cloudproinc.azurewebsites.net\/index.php\/wp-json\/wp\/v2\/posts\/53240","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cloudproinc.azurewebsites.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cloudproinc.azurewebsites.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cloudproinc.azurewebsites.net\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cloudproinc.azurewebsites.net\/index.php\/wp-json\/wp\/v2\/comments?post=53240"}],"version-history":[{"count":1,"href":"https:\/\/cloudproinc.azurewebsites.net\/index.php\/wp-json\/wp\/v2\/posts\/53240\/revisions"}],"predecessor-version":[{"id":53245,"href":"https:\/\/cloudproinc.azurewebsites.net\/index.php\/wp-json\/wp\/v2\/posts\/53240\/revisions\/53245"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/cloudproinc.azurewebsites.net\/index.php\/wp-json\/wp\/v2\/media\/53244"}],"wp:attachment":[{"href":"https:\/\/cloudproinc.azurewebsites.net\/index.php\/wp-json\/wp\/v2\/media?parent=53240"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cloudproinc.azurewebsites.net\/index.php\/wp-json\/wp\/v2\/categories?post=53240"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cloudproinc.azurewebsites.net\/index.php\/wp-json\/wp\/v2\/tags?post=53240"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}