Skip to main content

Setup

using AiStatsSdk;

var client = new Client("<API_KEY>");

Chat completions

var chat = await client.GenerateText(new Dictionary<string, object>
{
  ["model"] = "openai/gpt-5-nano",
  ["messages"] = new[]
  {
    new Dictionary<string, object>
    {
      ["role"] = "user",
      ["content"] = "Hello"
    }
  }
});

Responses

var resp = await client.GenerateResponse(new Dictionary<string, object>
{
  ["model"] = "openai/gpt-5-nano",
  ["input"] = "Reply with: csharp sdk works"
});

Images

var image = await client.GenerateImage(new Dictionary<string, object>
{
  ["model"] = "openai/gpt-image-1",
  ["prompt"] = "A lighthouse at golden hour"
});

Moderations

var moderation = await client.GenerateModeration(new Dictionary<string, object>
{
  ["model"] = "openai/omni-moderation-latest",
  ["input"] = "Some text to check"
});

Models and health

var models = await client.ListModels(new Dictionary<string, string> { ["limit"] = "10" });
var health = await client.Health();
Last modified on February 17, 2026