Skip to main content
Associate requests with Identity identifiers for user-level observability and analytics.
Identities are Orq.ai entities used to track project expenses and token usage per user or team.

Why use identity tracking

  • Per-user cost attribution and cross-charging to tenants or customers.
  • Enforcing per-user rate limits to prevent abuse.
  • Identifying which users generate the most load or cost.
  • Linking LLM usage to existing user analytics for cohort analysis.

Use Cases

ScenarioIdentity ID StrategyMetadata Example
User Analyticsuser-{userId}[{"plan": "pro", "usage_tier": "high"}]
Customer Supportsupport-{ticketId}[{"priority": "high", "issue_type": "billing"}]
A/B Testingtest-{userId}-{variant}[{"experiment": "pricing-v2", "variant": "b"}]
Multi-tenanttenant-{orgId}-{userId}[{"org": "acme-corp", "role": "admin"}]

Quick Start

Pass a stable identifier from the system (a database user ID, UUID, or similar string) as identity.id on any request.
curl -X POST https://api.orq.ai/v3/router/responses \
  -H "Authorization: Bearer $ORQ_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openai/gpt-4o",
    "input": "How can I upgrade my account?",
    "identity": {
      "id": "user_123",
      "display_name": "John Smith",
      "email": "john@example.com",
      "metadata": [{"plan": "premium", "signup_date": "2024-01-15"}]
    }
  }'

Identity resolution

The gateway checks each of the following sources in order and uses the first match found:
OrderSourceEffect
1identity object in the request bodyTags the request and upserts the identity record (name, email, metadata)
2X-ORQ-IDENTITY-ID request headerTags the request only; does not update the identity record
3API key ownerTags the request only; applies automatically when the key is user-owned
Pass the identity object in the request body to attribute the request and keep the identity record up to date. See the Quick Start above for full examples.
curl -X POST https://api.orq.ai/v3/router/chat/completions \
  -H "Authorization: Bearer $ORQ_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openai/gpt-4o",
    "messages": [{"role": "user", "content": "Hello"}],
    "identity": {
      "id": "user_123",
      "display_name": "John Smith",
      "email": "john@example.com"
    }
  }'

Configuration

ParameterTypeRequiredDescriptionConstraints
idstringYesUnique identity identifierMax 255 characters
display_namestringNoHuman-readable identity name
emailstringNoIdentity email address
metadataobject[]NoArray of objects with custom key-value pairsMax 20 fields
logo_urlstringNoURL to identity’s profile image
tagsstring[]NoClassification tags for identity segmentationMax 10 tags

Identities: manage, list, and view metrics

Covers creating identities via the dashboard or API, listing with 30-day usage metrics, and retrieving identity records.