Skip to content

Admin API

Admin endpoints use the Bearer token from the configured authentication provider. Resource changes are database-backed and use optimistic concurrency.

The consistency contract lists what a successful response guarantees for each admin action: which writes and audit records are durable, whether the serving replica’s routing view is already rebuilt, and how other replicas and background work converge.

Resource Common endpoints
Upstreams POST /admin/v1/upstreams, GET /admin/v1/upstreams, PUT /admin/v1/upstreams/{id}, DELETE /admin/v1/upstreams/{id}
Principals POST /admin/v1/principals, GET /admin/v1/principals, PATCH /admin/v1/principals/{id}
Keys POST /admin/v1/principals/{id}/keys, revoke through the key lifecycle endpoint
Plugins GET /admin/v1/plugins/registry, POST /admin/v1/plugins/wasm
Status GET /admin/v1/status, GET /admin/v1/export

POST /admin/v1/upstreams accepts UpstreamCreateBody. PUT /admin/v1/upstreams/{id} accepts UpstreamUpdateBody; update fields are optional. Both request bodies expose these Vertex fields:

Field Type Meaning
google_credential string Regional Vertex credential JSON. Secret; never returned.
project_id string Google Cloud project identifier or number.
location string Regional Vertex location.
express boolean Selects the Vertex Express API-key target.
api_version "v1" | "v1beta1" Vertex API path version.

These fields are accepted only for vertex_api_key and vertex_credential. Regional targets require project_id and location; Express targets use an API key and do not use those regional fields.

UpstreamResponse includes a vertex object for Vertex kinds and null or omits it for other kinds:

{
"vertex": {
"project_id": "my-project",
"location": "us-central1",
"api_version": "v1",
"express": false,
"credential_type": "service_account",
"principal_hint": null,
"quota_project_id": null
}
}

The response object fields are project_id, location, optional api_version, express, credential_type, principal_hint, and quota_project_id. Credential secrets are never included.

Every mutating request should use the current ETag or revision when the endpoint documents one. Handle 409 conflicts by reading the latest resource and presenting the new state to the operator.

OAuth draft start accepts { "provider": "anthropic" | "openai" | "gemini", "flow": "device_code" | "browser" }. Omitting provider keeps Anthropic compatibility; omitting flow uses OpenAI’s device-code flow. The browser flow is supported for OpenAI and Gemini. Paste-code providers return flow: "paste_code" and an authorize_url. OpenAI device start returns flow: "device_code", a verification URL, one-time user code, polling interval, and expiry. OpenAI browser start returns flow: "paste_code", provider: "openai", authorize_url, and state_token; Gemini browser start returns flow: "browser", provider: "gemini", authorize_url, and state_token.

Complete accepts { "state_token", "code" } for paste flows. For OpenAI browser flow, code may be the full http://localhost:1455/auth/callback?... address copied from the browser or a bare authorization code. For Gemini browser flow, code may be the full http://localhost:51121/oauth-callback?... address or a bare authorization code. A callback URL with a different state returns 400 { "error": "state_mismatch" }. OpenAI device completion may return 202 with { "status": "pending", "poll_interval_secs" } until the account is authorized, then returns the credential metadata used by from-oauth-draft.

Reconnect uses the same provider-specific flow at /admin/v1/upstreams/{id}/oauth/start and /complete, selecting the provider from the existing upstream kind. OpenAI reconnect checks the ChatGPT account id; Gemini checks the Google account email. A different account returns 409 account_mismatch without replacing the stored credential. Missing identity returns missing_account_identity or missing_existing_identity; a changed upstream revision returns 409 stale_revision.

OpenAI device completion accepts a request containing only state_token. Respect poll_interval_secs before polling again. Provider throttling returns 429 slow_down; expired and denied device codes return 400 device_code_expired and 400 access_denied. A 404 when starting device login returns device_login_unavailable; browser flow does not call the device endpoint.

New Gemini subscription sign-ins and reconnects use the Antigravity OAuth client. After Google approval, the browser lands on http://localhost:51121/oauth-callback; the page does not need to load. Copy the full URL from the address bar and paste it into the completion form. Existing Gemini CLI enterprise grants retain the gemini_cli profile; new subscription credentials use antigravity, and an absent profile defaults to gemini_cli. Google retired Gemini CLI consumer login on June 18, 2026; see the transition announcement.

Antigravity completion uses loadCodeAssist and onboardUser with Antigravity metadata and the daily host https://daily-cloudcode-pa.googleapis.com. Usage polling calls POST /v1internal:retrieveUserQuotaSummary with {"project":"<project-id>"} and uses the same parser and fallback behavior as Gemini CLI sign-ins. It reports the same four windows: Gemini models have 5-hour (gemini_5h) and weekly (gemini_7d) windows; Claude and GPT-OSS models have 5-hour (third_party_5h) and weekly (third_party_7d) windows.

[!WARNING] Google Antigravity Additional Terms §6 prohibit using third-party software, tools, or services to access the Service with Antigravity OAuth. The terms state that this is a breach and may be grounds for suspension or termination of Antigravity and/or Gemini CLI accounts. Operators decide at their own risk whether to use this integration.

Creating an upstream from a completed draft stores the provider-specific credential and seeds both token refresh and subscription usage polling. OAuth endpoints remain behind admin authentication.

Principal create and update requests accept an optional openai_oauth_compat object. Its fields match the server [openai_oauth_compat] policy (store_true, sampling, logprobs, truncation_auto, prompt_cache_in_memory, service_tier, web_search_preview, metadata, max_tool_calls, background, hosted_tools, compact, chat_n, chat_stop, chat_seed_penalties, and transcription). Set only the fields that should differ; unset fields inherit the server default. Send null to clear the complete override. The effective policy is resolved for each request (and each Responses WebSocket frame). This field is returned by principal reads but is omitted from exports.

warmup_enabled is accepted for OAuth upstreams of kind anthropic_oauth, openai_oauth, and gemini_oauth. POST /admin/v1/upstreams and OAuth sign-in create these upstreams with warm-up enabled by default. API-key upstreams reject the field. Warm-up requires stored OAuth credentials; it does not send requests for disabled or credential-less upstreams.

The admin upstream detail exposes the Warm-up toggle, status, manual Fire now action, and history for supported OAuth upstreams. warmup_dialect_plugin is available for all three OAuth kinds; the plugin must export the upstream provider’s shape hook.

Warm-up runs in lanes, one per quota group. Every supported upstream has a primary lane. gemini_oauth upstreams also have a third_party lane for the Claude and GPT-OSS models, which only the Antigravity profile can serve.

  • GET /admin/v1/upstreams/{id}/warmup returns upstream_id, dialect_plugin, and a lanes array. Each lane entry has lane, eligible, ineligible_reason (null, profile_unsupported, or quota_group_absent), target_windows, next_scheduled_at_unix_secs, last_attempt, and recent_attempts (the lane’s last 10).
  • GET /admin/v1/upstreams/{id}/warmup/attempts accepts optional lane, status, limit, before (pagination cursor), and since_unix_secs filters. since_unix_secs is a non-negative integer Unix timestamp, inclusive of attempts at that second, and combines with the other filters before pagination. Keep it unchanged when following next_cursor; omit it for all-time history. A negative value returns 400 invalid_warmup_since. Every attempt includes lane; rows recorded before lanes existed read as primary.
  • POST /admin/v1/upstreams/{id}/warmup/fire-now accepts an optional lane query parameter and defaults to primary. A lane the upstream kind does not have returns 400 warmup_lane_unsupported; an unknown lane name returns 400 invalid_warmup_lane. An ineligible lane sends nothing and records a quota_group_unavailable skip. The response includes lane.

status.last_warmup_at_unix_secs is the time any lane last succeeded. See Upstream warm-up source notes for scheduling details.

A principal receives the built-in subscription-preference router entry at creation. Use the plugin-chain endpoints to add, remove, or reorder additional entries. Registry reference counts include principal chains and upstream warm-up dialect bindings.

Keep-alive sessions, decisions, and request events use static detail paths with a required id query parameter:

Resource Endpoint
Keep-alive session or decision GET /admin/v1/principals/{principal_id}/cache-keepalive/detail?id=<encoded ID>
Request event, including a keep-alive renewal GET /admin/v1/events/detail?id=<encoded ID>

Pass the original ID to URLSearchParams or an equivalent query encoder, such as Python’s urllib.parse.urlencode or Rust’s url::form_urlencoded. Encode the query value once; do not call encodeURIComponent before passing it to URLSearchParams.

const sessionQuery = new URLSearchParams({ id: sessionId });
const eventQuery = new URLSearchParams({ id: eventId });
const sessionUrl = `/admin/v1/principals/${principalId}/cache-keepalive/detail?${sessionQuery}`;
const eventUrl = `/admin/v1/events/detail?${eventQuery}`;

Stored IDs, including composite IDs containing /, stay unchanged. Authentication, principal scoping, and response shapes are unchanged.

The old /admin/v1/principals/{principal_id}/cache-keepalive/{session_or_decision_id} and /admin/v1/events/detail/{event_id} routes are removed. Migrate direct scripts and API clients to the query endpoints. Event-detail audit entries use the static route /admin/v1/events/detail and retain the original ID in payload.event_id.

The request-event endpoints accept event_kind as a comma-separated value or as repeated query keys. Both forms select the same set of effective event kinds:

event_kind=messages,openai_responses
event_kind=messages&event_kind=openai_responses

The filter applies to recent rows, histogram buckets, delta pages, SSE backfill, and live partial and final updates. Any unknown or empty entry returns 400 {"error":"invalid_event_kind"}. Omitting event_kind preserves the default exclusion of cache-keepalive renewal events. source_kind remains conjunctive when supplied with event_kind.

Request events are stored in request_events_v1 with all 99 operational, latency-breakdown, and abnormal-stream-error scalar fields in typed relational columns. The payload column is dropped, so GET /admin/v1/events/detail?id=<encoded ID>, GET /admin/v1/events/delta, and final updates on GET /admin/v1/events/stream read the committed relational representation directly with zero TOAST overhead.

The optional observability.request_diagnostics_log setting additionally emits a cc_lb.request_diagnostics.v1 stdout line after the row commits. Each line carries the deep diagnostic fields cache_breakpoints, cache_control_message_indices, routing_trace, iterations, and internal_errors, plus the outcome and session-correlation fields thread_id, observed_session_id, input_tokens, output_tokens, cache_read_input_tokens, cache_creation_input_tokens, duration_ms, and upstream_ttfb_ms. Serving-bundle cache_breakpoints retain at most 32 prefix candidates in total, including bounded lookback_prefixes and their breakpoint/content-block positions; these remain outside request-event rows and admin event reads. Optional fields are omitted when absent: native_cache when no native cache analysis is recorded. cache_write_input_tokens, cache_write_input_tokens_30m, and cache_write_input_tokens_12h are omitted when unreported or when the write component is invalid; a valid reported 0 is emitted as 0.