Configure a source
A source names an upstream provider and capture policy. Because upstream_key is a secret, source creation and secret updates are human-only operations.
curl -X POST "https://<your-lizzy-host>/v1/distill/sources" \
+ -H "Authorization: Bearer $LIZZY_API_TOKEN" \
+ -H "Content-Type: application/json" \
+ -H "Idempotency-Key: source-001" \
+ -d '{"loop":"<loop_id>","name":"production-teacher","base_url":"https://api.openai.com/v1","upstream_key":"<upstream-api-key>","default_capture":true,"capture_sample_rate":0.25}'import os, requests
source = requests.post(
"https://<your-lizzy-host>/v1/distill/sources",
headers={"Authorization": f"Bearer {os.environ['LIZZY_API_TOKEN']}", "Idempotency-Key": "source-001"},
json={
"loop": "<loop_id>", "name": "production-teacher",
"base_url": "https://api.openai.com/v1",
"upstream_key": "<upstream-api-key>",
"default_capture": True, "capture_sample_rate": 0.25,
},
).json()const response = await fetch("https://<your-lizzy-host>/v1/distill/sources", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.LIZZY_API_TOKEN}`,
"Content-Type": "application/json", "Idempotency-Key": "source-001",
},
body: JSON.stringify({
loop: "<loop_id>", name: "production-teacher",
base_url: "https://api.openai.com/v1",
upstream_key: "<upstream-api-key>",
default_capture: true, capture_sample_rate: 0.25,
}),
});
if (!response.ok) throw await response.json();
const source = await response.json();Send OpenAI-compatible traffic
Point your OpenAI client at /v1/proxy and use a Lizzy API token. Set X-Lizzy-Source to the source name; optional tags and external IDs make later filtering easier.
curl "https://<your-lizzy-host>/v1/proxy/chat/completions" \
+ -H "Authorization: Bearer $LIZZY_API_TOKEN" \
+ -H "Content-Type: application/json" \
+ -H "X-Lizzy-Source: production-teacher" \
+ -H "X-Lizzy-Tags: support,refund" \
+ -d '{"model":"<teacher-model>","messages":[{"role":"user","content":"<request>"}]}'from openai import OpenAI
client = OpenAI(
base_url="https://<your-lizzy-host>/v1/proxy",
api_key=os.environ["LIZZY_API_TOKEN"],
)
response = client.chat.completions.create(
model="<teacher-model>",
messages=[{"role": "user", "content": "<request>"}],
extra_headers={"X-Lizzy-Source": "production-teacher"},
)import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://<your-lizzy-host>/v1/proxy",
apiKey: process.env.LIZZY_API_TOKEN,
defaultHeaders: { "X-Lizzy-Source": "production-teacher" },
});
const response = await client.chat.completions.create({
model: "<teacher-model>", messages: [{ role: "user", content: "<request>" }],
});Redaction and retention
Configure header and JSON-path redaction before enabling capture. The list APIs expose safe metadata; retrieving a captured request body is a human-only action. Deleting a call purges its body and is never delegated to the copilot.
Attach feedback
Feedback makes outcomes filterable and can power a feedback reward. Reference either the Lizzy call ID or your stable external ID.
/v1/distill/feedbackBody: {"external_id":"<ticket_id>","score":1,"tags":["resolved"]}. Use an idempotency key.