Relay docs

SDKs

Because Relay speaks the OpenAI API, the official OpenAI SDKs work directly — set the base URL to your Relay host and use a Relay API key. The repo also ships thin helper SDKs under sdks/ (.NET, Python, JavaScript).

#Python (OpenAI SDK)

from openai import OpenAI

client = OpenAI(base_url="http://localhost:5300/v1", api_key="app_live_…")

resp = client.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": "Hello from Relay"}],
)
print(resp.choices[0].message.content)

#JavaScript / TypeScript (OpenAI SDK)

import OpenAI from "openai";

const client = new OpenAI({ baseURL: "http://localhost:5300/v1", apiKey: process.env.RELAY_API_KEY });

const resp = await client.chat.completions.create({
  model: "gpt-4o",
  messages: [{ role: "user", content: "Hello from Relay" }],
});
console.log(resp.choices[0].message.content);

#.NET (HttpClient)

using var http = new HttpClient { BaseAddress = new Uri("http://localhost:5300/") };
http.DefaultRequestHeaders.Authorization = new("Bearer", relayApiKey);

var body = new { model = "gpt-4o", messages = new[] { new { role = "user", content = "Hello from Relay" } } };
var resp = await http.PostAsJsonAsync("v1/chat/completions", body);
var json = await resp.Content.ReadFromJsonAsync<JsonElement>();
Console.WriteLine(json.GetProperty("choices")[0].GetProperty("message").GetProperty("content").GetString());

#Relay-specific features

The helper SDKs (in sdks/) add convenience wrappers for the Relay-only endpoints — prompts fetch/compile, agents, knowledge, batches — but everything is plain HTTP, so you can call any endpoint in the API reference with the client you already use.

#Postman

A ready-made Postman collection lives at postman/Relay-AI-Gateway.postman_collection.json — import it, set the baseUrl and apiKey variables, and every endpoint is one click away.