This example assumes using DeepInfra; is in scope and apiKey contains your DeepInfra API key.
1 2 3 4 5 6 7 8 91011
// Use the OpenAI SDK via CustomProviders.DeepInfra() with MEAI interfaceusingvarclient=GetAuthenticatedOpenAiClient();Meai.IChatClientchatClient=client;awaitforeach(varupdateinchatClient.GetStreamingResponseAsync([new Meai.ChatMessage(Meai.ChatRole.User, "What is the capital of the United States?")],newMeai.ChatOptions{ModelId=DeepInfraModel})){vartext=string.Concat(update.Contents.OfType<Meai.TextContent>().Select(c=>c.Text));Console.Write(text);}