# API schemas: U

## UnitTopicList

Type: object

A unit's topics

- `topics` (array of object)
  - `map_id` (string)
  - `map_name` (string)
  - `facet` (string)
  - `topic_id` (string)
  - `topic_name` (string)
  - `outlier` (boolean)

## UsageChargeLine

Type: object

- `attempt` (integer, required, min 1, max 100)
- `provider` (string, required)
- `model` (string, required)
- `outcome` (string, required, one of `"answered"`, `"provider_error"`, `"transport_failure"`, `"unmeasured_answer"`) — provider_error - the provider answered an error status (known at zero, reason provider_error_not_billed); transport_failure - no answer, the provider may have billed it (unknown, attempt_outcome_unknown); unmeasured_answer - an answer the gateway could not measure (unknown, answer_not_measured).
- `status` (integer, min 100, max 599)
- `final` (boolean, required)
- `state` (string, required, one of `"known"`, `"unknown"`)
- `reason` (string, required)
- `amount_usd` (string or null, required)
- `input_tokens` (integer, min 0)
- `output_tokens` (integer, min 0)
- `rate` ([UsageRateSnapshot](/docs/api/schemas/u/#usageratesnapshot))

## UsageConnector

Type: object

One usage_connectors[] entry of the YAML (same names; finalization_hours is the effective value) with whether its credential is set and its last runs. The credential is never returned.

- `id` (string, required)
- `source` (string, required)
- `account_id` (string, required)
- `provider_id` (string, required) — Empty when the connector names no provider.
- `admin_key_env` (string, required)
- `credential_configured` (boolean, required)
- `finalization_hours` (integer, required)
- `runs` (array of object, required)

## UsageEvent

Type: object

- `timeout_kind` (string, one of `"first_byte"`, `"idle"`, `"max_duration"`, `"client_stall"`, `"request"`, `"attempt"`) — Confirmed winning timeout; omitted for normal completion or non-timeout failure. attempt (T218, migration 315): the last provider attempt exceeded the model's attempt_timeout and no target was left.
- `tags` ([UsageTagMap](/docs/api/schemas/u/#usagetagmap))
- `at` (string (date-time), required)
- `request_id` (string, required)
- `trace_id` (string, required)
- `principal` (string, required)
- `key_id` (string, required)
- `team` (string, required)
- `organization_id` (string) — The team's organization when the request resolved it (organizations on), stored on the row (T186.018); omitted otherwise
- `operation` (string, required) — The request's operation (chat, embeddings, ...; mcp_tools_call and mcp_tools_list for MCP executions, T186.018)
- `model` (string, required)
- `provider` (string, required)
- `status` (integer, required)
- `duration_ms` (integer (int64), required)
- `input_tokens` (integer (int64))
- `output_tokens` (integer (int64))
- `media_units` (string) — Images, characters, seconds of audio or seconds of accepted video measured for media pricing (ADR 0166)
- `prompt_id` (string) — prompt_tracking (T186.013): the registry prompt the request was built from; omitted when none
- `prompt_revision` (integer, min 1, max 100) — Its revision; omitted when the request named the prompt without one
- `prompt_source` (string, one of `"rendered"`, `"declared"`, `"system"`) — rendered: the request carried the gateway's render token; system: the required system prompt the gateway applied; declared: the client's X-Gateway-Prompt-Id and X-Gateway-Prompt-Revision, a claim
- `prompt_label` (string) — prompt_labels (T186.013b): the label the render resolved, when the prompt was rendered by label; omitted otherwise
- `owner_kind` (string, one of `"user"`, `"workload"`)
- `owner_id` (string)
- `end_user` (string) — Client-declared end user (end_user_tracking)
- `ttfb_ms` (integer (int64)) — Time to first response byte (request_timing)
- `session_id` (string) — Client-declared session (session_tracking)
- `attempts` (integer, min 1, max 100) — Upstream sends including retries and fallbacks (request_attempts)
- `requested_model` (string, max length 200) — model_aliases (T103): the model alias the client sent; model is then the canonical model that served the request. Omitted when the client named the model itself.
- `service_tier` (string, pattern `^[a-z][a-z0-9_-]{0,31}$`) — T110: the service tier the provider reported serving the answer in (service_tier of an OpenAI-dialect answer: default, priority, flex...), as it named it. Omitted when the answer named none.
- `error_code` (string, pattern `^[a-z][a-z0-9_]{0,63}$`) — T146: the gateway's own problem code the client received (rate_limited, guardrail_blocked, model_forbidden...). T195: for an answer that had already started and was cut, stream_interrupted (the provider cut it), stream_aborted (the gateway ended it) or client_closed_stream (the client stopped reading); status is then the one the client received (usually 200) and the token counts are absent. Omitted on success and when the provider answered with its own error status; recorded from migration 111 on.
- `guardrail_blocked` (string, max length 128) — T146: the guardrail that blocked the request or its answer. Omitted otherwise; recorded from migration 111 on.
- `origin` (string, one of `"app"`, `"evaluation"`, `"experiment"`, `"playground"`, `"helper"`, `"shadow"`, `"replay"`) — T186.004 (evaluation_tracing): how the request entered the gateway, set by the gateway from its own call path and never from a client header or body field: app (a client with a key, a batch line), evaluation (a judge's model call), experiment (an experiment item), playground (a console Playground request sent with the session through /api/v1/admin/playground, or an evaluator test), helper (the gateway's own feature call, see helper_kind), shadow (a shadow copy); replay is reserved. A request-level fallback attempt keeps its caller's origin. Omitted with the flag off and on rows written without it, which read as app.
- `helper_kind` (string, one of `"guardrail"`, `"classifier"`, `"summary"`, `"ask_ai"`, `"cache_embedding"`, `"tool_search"`, `"vector_store"`, `"model_test"`) — T186.004 S3b: the closed sub-kind of a helper call (a moderation guardrail, the routing classifier and its embeddings, a context summary, m7 ai, a semantic cache embedding, an MCP tool search embedding, a vector store embedding or OCR call, an administrator's model connection test). Omitted on every other row.
- `parent_request_id` (string, max length 256) — T186.004 S3b: the client request a helper call or a request-level fallback attempt was made for. A row with it is not a client request of its own: analytics leave it out of request, success, error and latency counts, and its cost is counted.
- `batch_id` (string, max length 256) — T186.004 S3b: the batch of a batch line (origin app, counted as a request).

## UsageRateSnapshot

Type: object

Consulted rate content is immutable by hash. Absent from scoped console responses. Connection is a fingerprint, never a credential.

- `provider_id` (string)
- `model_id` (string)
- `connection` (string)
- `currency` (string)
- `unit` (string)
- `input_per_million` (string)
- `output_per_million` (string)
- `unit_price` (string) — Exact decimal USD per image, character, second of audio or second of video when unit is a media unit (ADR 0166)
- `image_input_per_million` (string) — T060.004: USD per million image input tokens when unit is per_million_image_tokens; input_per_million then prices text input and output_per_million text output. On a text rate (T077.005), the price of the image input tokens a Gemini answer reports apart, when the catalog publishes one
- `image_output_per_million` (string) — T060.004: USD per million image output tokens when unit is per_million_image_tokens; on a text rate (T077.005), of the image output tokens a Gemini answer reports
- `audio_input_per_million` (string) — T077.005: on a text rate, USD per million audio input tokens a Gemini answer reports apart, when the catalog publishes one (input_cost_per_audio_token); without it those tokens leave the event unknown (media_token_unpriced)
- `audio_output_per_million` (string) — T077.005: on a text rate, USD per million audio output tokens (output_cost_per_audio_token)
- `video_input_per_million` (string) — T077.005: on a text rate, USD per million video input tokens (input_cost_per_video_token)
- `source` (string)
- `source_url` (string)
- `effective_from` (string)
- `fetched_at` (string (date-time))
- `manual_fallback` (boolean) — The manual price book supplied these rates; an entry in effect wins over every automatic price. The name predates that rule and is kept so stored snapshots keep their identity
- `override` (boolean) — Present and true when the manual rates replaced an automatic price that was available
- `cache_read_counter_required` (boolean) — Published pricing requires explicit zero cache-read usage before using flat token rates
- `cache_write_counter_required` (boolean) — Published pricing requires explicit zero cache-write usage before using flat token rates
- `cache_read_per_million` (string)
- `cache_write_per_million` (string)
- `cache_write_1h_per_million` (string)
- `service_tier` (string) — T110: the service tier whose prices this snapshot holds, selected by the tier the provider reported; omitted for the standard tier.
- `service_tiers` (object) — T110: the other tiers' prices known when the request was sent; the reported tier picks one. A reported tier missing here leaves the event unknown (service_tier_unpriced).
  - any other key: [ServiceTierPrice](/docs/api/schemas/s/#servicetierprice)

## UsageTagMap

Type: object

Bounded usage metadata from client declarations or opt-in authenticated-team defaults. No billing or provenance guarantee; omitted when usage_tags is disabled. Empty map may be omitted.

- any other key: string

## UsageTagPolicy

Type: object

- `allowed_values` (object, required)
  - any other key: array of string
- `defaults_by_team` (object) — Optional finite defaults for authenticated team IDs; applied only with usage_tag_defaults. Values must belong to allowed_values; canonical policy remains bounded to 16 KiB. Client declarations override same-name defaults; empty header object does not suppress defaults. Omitted or empty preserves legacy policy fingerprints.
  - any other key: [UsageTagMap](/docs/api/schemas/u/#usagetagmap) and object
    - All of (1): [UsageTagMap](/docs/api/schemas/u/#usagetagmap)
    - All of (2): object
- `defaults_by_model` (object) — T168: defaults for a model alias (its canonical ID, as admitted for the request), layered over the team defaults. Applied only with usage_tag_defaults and usage_tag_scoped_defaults; a PUT that sets it with usage_tag_scoped_defaults off answers 403 feature_disabled. Precedence, lowest first: team, model, key, X-Gateway-Tags. An ID with no alias stays latent.
  - any other key: [UsageTagMap](/docs/api/schemas/u/#usagetagmap) and object
    - All of (1): [UsageTagMap](/docs/api/schemas/u/#usagetagmap)
    - All of (2): object
- `defaults_by_key` (object) — T168: defaults for one authenticated key ID (YAML or managed), layered over the team and model defaults, under the same flags as defaults_by_model. A batch's required-attribution check counts team and key defaults only, since its lines name their models later.
  - any other key: [UsageTagMap](/docs/api/schemas/u/#usagetagmap) and object
    - All of (1): [UsageTagMap](/docs/api/schemas/u/#usagetagmap)
    - All of (2): object

## UsageTagPolicySnapshot

Type: object

- `version` (integer, required, min 0) — Global control configuration version
- `source` (string, required, one of `"yaml"`, `"console"`)
- `effective` ([UsageTagPolicy](/docs/api/schemas/u/#usagetagpolicy), required)
- `base_fingerprint` (string, required, pattern `^[a-f0-9]{64}$`)

