Find a model

Browse the full catalog →

Cost allocation metadata

Attribute every request without putting metadata in the prompt.

Attach up to 50 AWS style tags to Chat Completions, Responses, Messages, or Embeddings. TrustedRouter stores the effective tag set with generation metadata and keeps it out of provider request bodies.

Use tags for environment, application, team, project, cost center, customer tier, or any other non sensitive business dimension.

OpenAI Python SDKextra_body
from openai import OpenAI

client = OpenAI(
    api_key="sk-tr-v1-...",
    base_url="https://api.trustedrouter.com/v1"
)

response = client.chat.completions.create(
    model="trustedrouter/zdr",
    messages=[{
        "role": "user",
        "content": "Summarize this contract."
    }],
    user="user_123",
    extra_body={
        "session_id": "matter_456",
        "tags": {
            "environment": "production",
            "team": "legal",
            "cost-center": "legal-01"
        }
    }
)

The contract

Shape

A string map.

Send tags as a JSON object. Keys and values are case sensitive strings. Empty values are allowed. Empty keys are not.

Limits

Fifty tags per request.

Keys may contain 128 Unicode characters. Values may contain 256. The effective compact map is capped at 4 KiB.

Characters

A portable AWS style set.

Use Unicode letters, numbers, and spaces plus + - = . _ : / @. The prefixes aws: and trustedrouter: are reserved.

Defaults

Set defaults once on an API key.

POST /v1/keys and PATCH /v1/keys/{hash} accept the same tag map. Request tags override key defaults. The merged result is frozen when TrustedRouter authorizes the request, so retries and later key edits cannot rewrite historical attribution.

API key defaultscurl
curl https://trustedrouter.com/v1/keys \
  -H "Authorization: Bearer $MANAGEMENT_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "production-legal",
    "tags": {
      "environment": "production",
      "team": "legal"
    }
  }'

OpenRouter attribution compatibility

Body fields

  • user identifies a stable end user
  • session_id groups related requests
  • trace carries Broadcast metadata
  • tags allocates TrustedRouter usage and cost

Headers

  • X-Session-Id
  • HTTP-Referer
  • X-NYTE-Title, X-OpenRouter-Title and X-Title, in that order
  • X-OpenRouter-Categories
  • X-OpenRouter-Metadata: enabled opts into router metadata

When enabled for Chat Completions or Responses, TrustedRouter returns route metadata in openrouter_metadata. It never includes credentials, tags, trace contents, prompts, or outputs.

gateway_region identifies the TrustedRouter gateway, not where the upstream provider ran inference. The provider's serving location is separate in usage.inference_location.serving_region and remains null when not reported.

Query usage

Filter or group activity by one tag.

Use exact matches for cost allocation. Tag filters operate on a bounded recent/date scan and the response reports whether that scan was truncated. Tag values are private to the workspace and are never included in public provider rankings.

Activity APIGET
# Individual generations
GET /v1/activity?group_by=none&tag_key=team&tag_value=legal

# Daily model and provider totals split by tag value
GET /v1/activity?group_by=tag:team
In the console

See tags on the Observability page.

The Observability page shows each request's tags as chips in the request list. Click a chip, or pick a key and a value under Tags, to filter the list to that tag. The filter stays when you change the range.

The Tags panel breaks requests, cost, tokens, and median generation time down by the values of one key. It counts every request in the selected range, not a sample. The 50 most expensive values each get a row, the rest are combined into Other, and requests without the key are shown as Untagged. Generation time is how long the server took to produce the response, not the latency your client saw. A request that fails before it produces a generation has nothing to tag, so the panel counts completed generations only.

A key with about 500,000 or more distinct values in the range, such as a request id, is not broken down. You can still filter by its values. Whenever some values are grouped in Other, which 50 are shown is a best effort for a busy key, and the panel says so. The totals in each row are exact either way.

Tags panelexample
Break down by: team        Range: 7d

Value      Requests     Cost   Median generation time
search        1,204   $18.40                   820 ms
ads             311    $4.12                   640 ms
Untagged         87    $0.95                   910 ms
Trust boundary

Tags are router metadata, not model input.

The attested gateway validates tags before authorization. Provider adapters build separate upstream payloads that omit tags, trace metadata, session identifiers, and app attribution. Generation records contain the effective tags but never the prompt or model output.

Verify the gateway

Workspace access

Sign in

Choose a sign in method to access your TrustedRouter workspace.

New to TrustedRouter?

By continuing you agree to the terms of service and privacy policy.