Metadata
Every call is traced automatically, with no setup required. Grouping calls into a session, attributing them to a particular user, and similar views all build on top of that automatic trace, but they are not automatic themselves: each depends on a small piece of information, called metadata, being sent along with the call.
What metadata is
Metadata is a set of your own key-value pairs, attached to a call at the time it is made. Forgebench does not interpret most of what you send; it is recorded and made available for filtering exactly as sent. A small number of keys are treated specially, described below, because they drive a particular view in Forgebench rather than acting as a plain filter.
What is already attached, without you sending anything
Alongside anything you send yourself, Forgebench writes a further set of information onto every trace automatically. This part is not something you configure, and it cannot be altered or forged by a caller. It is what makes a trace trustworthy for questions of attribution and billing:
| Field | What it is |
|---|---|
agent_id | Which agent made the call, when it was made by an agent rather than a direct API call. |
actor | The identity of the person or service account that authenticated the call. |
audit_id | The entry in the audit log for this exact call. |
api_key_prefix | The non-secret, displayable prefix of the API key used to make the call (for example, sk_ab12...), never the key itself, which Forgebench never stores in a recoverable form. |
requested_model | The model actually requested, useful when a fallback model ended up serving the call instead. |
latency_ms | The true time the call took at the gateway. |
user_id | Who the call is attributed to for the Users view: your account email, the agent, or the key, in that order. This is why Users needs nothing sent to work. |
Sending metadata
Metadata is sent as a metadata.dimensions object alongside the rest of the
call. Each entry in it becomes both a filter you can search on later and part
of the permanent record of that call.
curl -X POST https://api.forgebench.ai/v1/chat/completions \
-H "Authorization: Bearer sk_..." \
-H "Content-Type: application/json" \
-d '{
"model": "mock-gpt",
"messages": [{"role": "user", "content": "Hello"}],
"metadata": {
"dimensions": {
"feature": "checkout-assistant",
"session": "conv_8f21",
"customer": "acct_4471"
}
}
}'from forgebench import Forgebench
client = Forgebench(api_key="sk_...", base_url="https://api.forgebench.ai")
resp = client.chat.completions.create(
model="mock-gpt",
messages=[{"role": "user", "content": "Hello"}],
extra_body={
"metadata": {
"dimensions": {
"feature": "checkout-assistant",
"session": "conv_8f21",
"customer": "acct_4471",
}
}
},
)import { Forgebench, type ChatCompletionRequest } from "@seedlinglabs/forgebench-sdk";
const forgebench = new Forgebench({ apiKey: "sk_...", baseUrl: "https://api.forgebench.ai" });
const res = await forgebench.chat.create({
model: "mock-gpt",
messages: [{ role: "user", content: "Hello" }],
metadata: {
dimensions: {
feature: "checkout-assistant",
session: "conv_8f21",
customer: "acct_4471",
},
},
} as ChatCompletionRequest & Record<string, unknown>);The two keys with special meaning
| Key | What it does |
|---|---|
dimensions.feature | Names the call, in place of the generic default. Use this to tell apart different kinds of calls your application makes, such as checkout-assistant versus order-lookup. |
dimensions.session | Groups every call sharing the same value into one session. See Sessions for the full picture. |
Any other key is your own choice, and is recorded as a plain, searchable
filter, for example dimensions.customer in the example above. There is no
fixed list of allowed keys beyond the two above.
Limits
| Limit | Value |
|---|---|
| Keys per call | 8 |
| Key format | Lowercase letters, numbers, underscores, and hyphens only |
| Value length | 128 characters, beyond which the value is shortened |

