-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
37 lines (32 loc) · 858 Bytes
/
Program.cs
File metadata and controls
37 lines (32 loc) · 858 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
using Anthropic.SDK;
using Microsoft.Extensions.AI;
var apiKey = Environment.GetEnvironmentVariable("ANTHROPIC_API_KEY");
if (string.IsNullOrWhiteSpace(apiKey))
{
Console.Error.WriteLine("ANTHROPIC_API_KEY not set.");
return 1;
}
string[] modelsToVerify =
[
"claude-opus-4-7",
"claude-sonnet-4-6",
"claude-haiku-4-5-20251001",
];
IChatClient chat = new AnthropicClient(apiKey).Messages;
var any = false;
foreach (var model in modelsToVerify)
{
try
{
var response = await chat.GetResponseAsync(
"Reply with exactly: OK",
new ChatOptions { ModelId = model });
Console.WriteLine($"PASS {model}: {response.Text?.Trim()}");
}
catch (Exception ex)
{
any = true;
Console.WriteLine($"FAIL {model}: {ex.GetType().Name}: {ex.Message}");
}
}
return any ? 2 : 0;