Dashboard|

Gateway calls

Attach a user, a conversation and tags to calls that go through the Cencori gateway.

Every call through the Cencori gateway is in Observability → Request logs already, with its prompt, reply, model, tokens, cost and latency. Three optional headers add who it was for and which conversation it belongs to, so you can follow one user, or read one conversation from start to end.

If you also use cencori/observe, you don't need these: your gateway calls are traced along with everything else in the run.

Headers

Send any of these with a gateway call. All are optional, and a value that's malformed or too long is ignored, never refused.

HeaderWhat it does
X-Cencori-User-IdYour end user's id (up to 256 characters). The body's OpenAI-style user field does the same and wins when both are sent.
X-Cencori-Trace-IdGroups calls into one trace: a chat, a task, a job. Letters, digits and . _ : / @ -, up to 128 characters.
X-Cencori-Trace-NameA readable name for the trace, such as the chat's title.
X-Cencori-TagsComma-separated tags, e.g. checkout,beta (up to 10, lowercased).
X-Cencori-MetadataA JSON object of string, number or boolean values, e.g. {"plan":"pro","region":"ng"} (up to 20 keys).
import OpenAI from 'openai';
 
const client = new OpenAI({
  apiKey: process.env.CENCORI_API_KEY,
  baseURL: 'https://api.cencori.com/v1',
});
 
await client.chat.completions.create(
  { model: 'gpt-4o-mini', messages, user: currentUser.id },
  {
    headers: {
      'X-Cencori-Trace-Id': `chat:${chat.id}`,
      'X-Cencori-Trace-Name': chat.title,
      'X-Cencori-Tags': 'support',
    },
  },
);

Choose a trace id that stays the same for the whole conversation, such as your chat or task id. Every call that sends it joins the same trace.

What you see

  • Traces lists each trace next to your other traces, under the Gateway source. Open one to read it as a conversation: each call's latest user message and the reply, with its model, latency, tokens and cost.
  • Request logs shows each request's end user. Filter by End user, Trace ID or Tag in the sidebar. A request's details show its tags, its metadata, and a link to its trace.

These are labels you choose. Cencori doesn't use them for identity or permissions, so don't put secrets in them.