Six days to Christmas Eve. The AI bill lands on Ledger's desk in the counting house, twice as long as last week's and not one elf's name on it.
- Ledger
The bill doubled and every line says 'workshop'. Four hundred elves, one key. The counting house is having an identity crisis.
- Mrs. Claus
Before you go elf-hunting, dear: whatever you write on those calls stays on the traces. Who will see it?
- Ledger
Then I'll mint four hundred API keys and rotate them by hand. That's four hundred keys, every December, forever.
- Tinsel
Keep the one key: app in
name, elf inidentity. An elf id, not a home address. - Ledger
First split's in. Elf 17 has been asking the model to rhyme every single gift tag. Of course it's Elf 17.
- elfElf 17identity.id: elf-17elfElf 42identity.id: elf-42
- orq.aiTagged callname: toy-shop · identity
- 1call2costprovideranthropic/claude-haiku-5-5activitySpend per identity
How it works
Tinsel’s fix is two labels on the request you already send. Each one answers a different question.
nameis the app. It answers “which app, service or feature made this call?” It shows on every trace and filters the Traces view and the Monitors dashboards by application.identityis the person. It answers “which end user, team or client is this call for?” Onlyidentity.idis required (up to 255 characters).display_name,email,metadataandtags(up to 10) are optional.- The router picks one identity. It uses the first it finds: the
identityobject in the body (tags the call and saves the record’s details), then theX-ORQ-IDENTITY-IDheader (tags only), then the owner of a user-owned API key (tags only). - Cost is added up per identity. Each span’s cost is computed on the server. The Identities list shows requests, cost, tokens and error rate per identity, and Activity > Spend can split spend by Identities (with a project selected, Spend shows only that project).
You do not have to create an identity first. The router creates the record the first time it sees a new id.
Try it with curl
Two elves, one app:
for elf in elf-17 elf-42; do
curl -sS -o /dev/null -w "$elf %{http_code}\n" https://my.orq.ai/v3/router/responses \
-H "Authorization: Bearer $ORQ_API_KEY" \
-H "Content-Type: application/json" \
-d "{
\"model\": \"anthropic/claude-haiku-5-5\",
\"input\": \"Write a two-line label for a wooden sleigh\",
\"name\": \"toy-shop\",
\"identity\": {\"id\": \"$elf\", \"tags\": [\"wrapping\"]}
}"
done
Or from the OpenAI SDK
The fields are not part of the OpenAI request types, so pass them in extra_body:
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["ORQ_API_KEY"],
base_url="https://my.orq.ai/v3/router",
)
response = client.responses.create(
model="openai/gpt-6-luna",
input="Which reindeer pulls best in fog?",
extra_body={
"name": "toy-shop",
"identity": {"id": "elf-17", "display_name": "Elf 17"},
},
)
print(response.output_text)
Read the spend back
orq identities list --include-metrics -o json
curl "https://my.orq.ai/v2/identities?include_metrics=true" \
-H "Authorization: Bearer $ORQ_API_KEY"
With include_metrics=true, each identity carries metrics for the last 30 days: total_cost in USD, total_tokens, total_requests and error_rate.
Which label for what
| Question | Field |
|---|---|
| Which app made this call? | name |
| Which user, team or client is it for? | identity |
| Which conversation does it belong to? | thread |
| What business context applies? | metadata |
The docs’ rule: if it describes the app, use name. If it describes the user, use identity. If it is business context, use metadata. Historical traces keep their original name, so pick names you can live with.
Chat Completions and headers
On /v3/router/chat/completions, identity and thread go under the orq object (orq.identity). name stays at the top level.
Clients that cannot change the body, like coding agents or a proxy that passes the payload through untouched, can send X-ORQ-IDENTITY-ID instead. It tags the call, but it never fills in a display name, email or metadata. On endpoints with a JSON body, the metadata headers (X-ORQ-METADATA, X-ORQ-METADATA-<key>) also reach routing rules, guardrail rules and budgets. A caller who can set them can change which rules match, so only let trusted callers set them.
Nice list
- A small, fixed set of app names. The docs suggest around 50 per workspace: letters, digits and hyphens, under 50 characters.
- Generating identity ids in one place, in one format. Mixed formats for the same person are how duplicate identities appear.
- Sending the
identityobject in the body when you wantdisplay_name,emailormetadatasaved on the identity record. - Checking cost per elf with
orq identities list --include-metrics.
Naughty list
- Naming the app
toy-shop-elf-17. You end up with an app per elf instead of one app with four hundred identities. Per-user values belong inidentity. - Sending
identityat the top level on Chat Completions. There it goes underorq.identity, next toorq.thread.namestays at the top level. - Putting an elf's email or home address in
name,metadataorthread.tags. They persist on the traces. - Passing
identity_idto the Orq SDK constructor. It was removed in SDK v4.10.0: passidentityon each request instead.
Elf's challenge
Shout your name at the door without filling in the form: send one call with only the header X-ORQ-IDENTITY-ID: elf-99, then GET https://my.orq.ai/v2/identities/elf-99 with your API key. Did Elf 99 get a display name?
Stuck? Ask Tinsel for a hint
No. A header only tags the request. When the identity does not exist yet, it is created from the trace with no display name, email or metadata. The body identity object fills those in.
Christmas crackerWhy is Elf 99's mitten still in lost property?Pull it for the punchline
Only his id was sewn in. Headers don't stitch on the name.