Skip to content

Instantly share code, notes, and snippets.

@wullemsb
Last active May 8, 2026 20:25
Show Gist options
  • Select an option

  • Save wullemsb/fc50d26049c6d4da516fbc862f298062 to your computer and use it in GitHub Desktop.

Select an option

Save wullemsb/fc50d26049c6d4da516fbc862f298062 to your computer and use it in GitHub Desktop.
using GitHub.Copilot.SDK;
await using var client = new CopilotClient();
await client.StartAsync();
var session = await client.CreateSessionAsync(new SessionConfig
{
Model = "gpt-4.1"
OnPermissionRequest = PermissionHandler.ApproveAll,
});
Console.WriteLine("Chat with Copilot (type 'exit' to quit)\n");
while (true)
{
Console.Write("You: ");
var input = Console.ReadLine();
if (string.IsNullOrWhiteSpace(input) || input == "exit")
break;
var response = await session.SendAndWaitAsync(new MessageOptions
{
Prompt = input
});
Console.WriteLine($"Copilot: {response?.Data.Content}\n");
}
await client.StopAsync();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment