Skip to content

API Key Info

Retrieve information about the current API key.

This example assumes using Xai; is in scope and apiKey contains your Xai API key.

1
2
3
4
5
6
7
var client = new XaiClient(apiKey);

// Check the current API key's metadata — useful for diagnostics and validation.
var info = await client.Auth.GetApiKeyInfoAsync();

Console.WriteLine($"Key: {info.RedactedApiKey}");
Console.WriteLine($"User: {info.UserId}");