Integration guide

Semantic Kernel OpenAI-compatible API guide (C#)

Semantic Kernel C# guide for OpenAI-compatible APIs: set the base URL to https://api.abliteration.ai/v1, call /v1/chat/completions, and keep the same request schema.

Updated 2026-08-04

Semantic Kernel works with OpenAI-compatible APIs by switching the base URL, API key, and model id.

This guide shows a C# example plus a test vector you can run to validate responses.

using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Text.Json;

var payload = new {
  model = "abliterated-model",
  messages = new[] { new { role = "user", content = "Respond with: Semantic Kernel C# ready." } },
  temperature = 0.2
};

var json = JsonSerializer.Serialize(payload);
var request = new HttpRequestMessage(HttpMethod.Post, "https://api.abliteration.ai/v1/chat/completions");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("ABLIT_KEY"));
request.Content = new StringContent(json, Encoding.UTF8, "application/json");

var client = new HttpClient();
var response = await client.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());

Configure Semantic Kernel

Follow this checklist to point your integration at the OpenAI-compatible endpoint.

OpenAI-compatible payload

Use this request body as a known-good payload before customizing parameters.

{
  "model": "abliterated-model",
  "messages": [
    { "role": "user", "content": "Respond with: Semantic Kernel C# ready." }
  ],
  "temperature": 0.2
}

Streaming and tool calling readiness

If you stream responses or send tool definitions, keep the OpenAI-compatible schema and validate against the OpenAPI spec.

FAQ

Frequently asked questions.

How do I fix a 401 Unauthorized error from abliteration.ai?

Check that your API key is set and sent as a Bearer token.

How do I fix a 404 Not Found error from abliteration.ai?

Make sure the base URL ends with /v1 and you call /chat/completions.

How do I fix a 400 Bad Request error from abliteration.ai?

Verify the model id and that messages are an array of { role, content } objects.

How do I fix a 429 Rate limit error from abliteration.ai?

Back off and retry. Use the Retry-After header for pacing.