Ingest API

POST /api/ingest accepts an AI request, pulls inference automatically, and records a full Tracebox run.

Auth

Bearer API key or a signed-in session cookie.

Minimal

POST /api/ingest
{
  "prompt": "Why did the agent refund the wrong order?",
  "model": "gpt-4.1-mini"
}

OpenAI-shaped request

{
  "agent": "support-agent",
  "model": "gpt-4.1-mini",
  "messages": [
    { "role": "user", "content": "Explain the refund" }
  ]
}

Wrap an existing response

If you already called the model, send request + response. Tokens and content are parsed; no second call.

Provider keys

Set OPENAI_API_KEY or ANTHROPIC_API_KEY on Vercel, or pass providerKey / x-provider-key once. Keys are never stored.