Integration guide
How to use AWS Lambda with an OpenAI-compatible endpoint (C#)
AWS Lambda integration guide for C#. Connect to an OpenAI-compatible endpoint with a base URL swap and keep the same request schema.
Updated 2026-01-06
AWS Lambda works with OpenAI-compatible APIs by switching the base URL and API key.
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: AWS Lambda 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 AWS Lambda
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: AWS Lambda 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.