Browse documentation

API Consumers (the `user` field)

Plan per-consumer tracking with the user request field. nRouter does not record the field yet, so the API Consumers page stays empty for now.

The API Consumers console (/[organization]/advanced-analytics/api-consumers) provides granular usage attribution, rate limiting, and spend tracking for downstream clients via the top-level user request parameter. Consumers populate automatically when passing user on inference calls, or can be pre-registered with dedicated limits via POST /api/end-users/create.

Telemetry Rollout Notice: While passing the user field in inference requests is fully supported, automatic aggregation in the API Consumers dashboard view is currently rolling out. Pre-registration endpoints and limit enforcement structures operate as documented below.

The nRouter dashboard usage overview showing request volume, spend breakdown, and recent activity

Consumer Identification

Pass a top-level user parameter in inference payloads:

curl -s https://api.nrouter.ai/v1/chat/completions \
  -H "Authorization: Bearer sk-nrouter-<your-key>" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gemini-2.5-flash",
    "messages": [{"role": "user", "content": "hello"}],
    "user": "u_8f3a1b9c"
  }'

Formatting Patterns

PatternExample ValueTarget ArchitectureGranularity
End-User IDu_8f3a1b9cB2C apps tracking per-user consumption1 row per user
Tenant / Workspacetenant_acmeB2B SaaS enforcing customer quotas1 row per tenant
Project / Serviceproj_chatbotMicroservices tracking internal costs1 row per product
Composite Keytenant_acme:u_8f3a1b9cHierarchical tenant and user trackingRows = tenants × users

Privacy Best Practice: Always pass opaque, pseudonymous IDs (such as UUIDs or hashes); never send PII.

Management Workflows

  • Pre-Registration: Provision limits before traffic via POST /api/end-users/create or bulk via POST /api/end-users/bulk.
  • Metadata Tags: Attach labels (plan:pro, region:eu) via POST /api/end-users/tags for display filtering (tags do not enforce limits).
  • Overrides: Set consumer-specific rpm_limit, tpm_limit, and max_budget via PUT /api/end-users/overrides (tightest limit among key, team, and consumer wins).
  • Audit Logging: Configuration changes are recorded in the organization audit trail at /[organization]/audit.

API Endpoints

Method & PathOperationRequired Role
POST /api/end-users/createPre-register a consumerOwner / Org Admin
POST /api/end-users/bulkBulk import consumersOwner / Org Admin
GET /api/end-users/tags?organization_id=<uuid>[&end_user_id=<str>]List consumer tagsMember
POST /api/end-users/tagsAttach consumer tagMember (excl. Viewer)
DELETE /api/end-users/tags?id=<uuid>&organization_id=<uuid>Remove consumer tagMember (excl. Viewer)
GET /api/end-users/overrides?organization_id=<uuid>Retrieve limit overridesMember
PUT /api/end-users/overridesUpsert limits and budgetsOwner / Org Admin

Parameters: user (max 200 chars), tag (max 60 chars), notes (max 500 chars). Table view paginates at 25 consumers per page.

Frequently asked questions

Do I need a mapping table on my side?

Optional: keep PII mappings in your own database and send only opaque IDs to nRouter.

Can I rename a consumer?

No, the user string is the identity, and changing it creates a new consumer record.

Does the field count against my budget?

No, the user field is an attribution parameter that carries no extra cost.

Is the field forwarded to the model provider?

Yes, OpenAI and other upstream providers receive the parameter in their native formats.

What if I send no user value at all?

The request succeeds and is billed normally without consumer attribution.

Why is my consumer's spend zero in the chart but non-zero in the table?

Charts show current billing cycle spend, while tables reflect lifetime cumulative volume.

Can a tag block a request?

No, tags are display labels only; hard caps are enforced via rate limit and budget overrides.

Where to go next

Was this page helpful?