Skip to content

Metrics reference

Three Prometheus metrics are emitted by the gateway. Names are stable; labels are stable within v1.0.0.

sgw_requests_total

Counter. One increment per request that reaches the gateway.

Label Possible values Notes
model Real OpenRouter ID, auto, smart-router, none The model field of the request (alias or auto) and the resolved real ID.
status 200, 400, 403, 500, … HTTP status code returned to the client.

Example series:

sgw_requests_total{model="deepseek/deepseek-v4-flash-0731",status="200"} 17
sgw_requests_total{model="smart-router",status="403"} 1
sgw_requests_total{model="z-ai/glm-5.2",status="200"} 1

Notes:

  • The model label uses the real OpenRouter ID for proxied requests, and smart-router for requests that were denied or short-circuited.
  • A 401 increments with status="401". The model label may be empty if the request did not carry a model field.

sgw_routing_decisions_total

Counter. One increment per routing decision inside the policy pipeline.

Label Possible values Notes
action ROUTE, SCOUT, STOP_FOR_HUMAN, FALLBACK_TRY, FALLBACK_GLM_INVOKE, FALLBACK_GLM_FAIL The action emitted by the policy.
model Internal alias key (deepseek_v4_flash, deepseek_v4_pro, nemotron_ultra, glm_5) or none The model the decision chose.

Example series:

sgw_routing_decisions_total{action="ROUTE",model="deepseek_v4_flash"} 17
sgw_routing_decisions_total{action="ROUTE",model="deepseek_v4_pro"} 4
sgw_routing_decisions_total{action="SCOUT",model="nemotron_ultra"} 2
sgw_routing_decisions_total{action="FALLBACK_TRY",model="deepseek_v4_pro"} 1
sgw_routing_decisions_total{action="FALLBACK_GLM_INVOKE",model="z-ai/glm-5.2"} 1

The decision counter increments before the upstream call; the request counter increments after. They will not match 1:1 during a failover window.

sgw_request_latency_seconds

Histogram. End-to-end request latency for non-streaming requests that completed successfully.

Label Notes
(none)

The histogram uses Prometheus's default buckets (0.005, 0.01, 0.025, …, 2.5, 5, 10, +Inf).

The latency is measured inside the gateway, from the start of the FastAPI handler to the response. nginx and TLS overhead are not included. Streaming requests are not observed in v1.0.0.

Suggested queries

Total requests per model over 5 minutes

sum by (model) (rate(sgw_requests_total[5m]))

Error rate (any 5xx)

sum(rate(sgw_requests_total{status=~"5.."}[5m]))
/
sum(rate(sgw_requests_total[5m]))

95th percentile latency

histogram_quantile(0.95, sum(rate(sgw_request_latency_seconds_bucket[5m])) by (le))

Fallback utilization rate

sum(rate(sgw_routing_decisions_total{action="FALLBACK_GLM_INVOKE"}[5m]))
/
sum(rate(sgw_routing_decisions_total{action=~"ROUTE|FALLBACK.*"}[5m]))

Privacy-deny rate

sum(rate(sgw_requests_total{status="403"}[15m]))

A non-zero rate is expected when clients misuse the free alias. A sudden spike is a sign of a misconfigured client or a malicious attempt.

See also