Skip to content

API schemas: G

Type: object

  • id (string, required)
  • object ("model", required)
  • created (integer, required) — Always 0: an alias has no creation date of its own
  • owned_by ("m7gtw", required)

Type: object

The provider’s Interaction, relayed as received except for id and previous_interaction_id.

  • id (string) — Gateway interaction ID, signed to the key that created it; absent with store false.
  • object (string)
  • status (string, one of "in_progress", "requires_action", "completed", "failed", "cancelled", "incomplete", "requires_continuation")
  • model (string)
  • service_tier (string)
  • steps (array of object)
  • usage (object)
    • total_tokens (integer)
    • total_input_tokens (integer)
    • total_output_tokens (integer)
    • total_thought_tokens (integer)
    • total_cached_tokens (integer)
    • total_tool_use_tokens (integer)
    • input_tokens_by_modality (array of object)
      • modality (string)
      • tokens (integer)

Type: object

A Gemini Interactions request (T199); model is required unless agent is sent. Only the members the gateway reads are listed; every other documented member (system_instruction, tools, generation_config, response_format, service_tier, safety_settings, labels and the like) passes through unchanged.

  • model (string) — The gateway alias; replaced by the target model.
  • input (string or array of object, required) — A string, or a list of content blocks (text, image, audio, document, video) and steps (user_input, function_result) whose content or result lists hold blocks.
    • One of (1): string
    • One of (2): array of object
      • type (string)
      • text (string)
      • data (string) — base64
      • uri (string) — A reference the provider fetches. A Files API uri is refused when organizations share the provider project.
      • mime_type (string)
      • resolution (string, one of "low", "medium", "high", "ultra_high")
      • processing (object) — The file slice: {type: static, page_options: {start_page, end_page, content_layers: [page_image, page_text]}} for PDF, Word and PowerPoint, or {type: static, spreadsheet_options: {sheet_index, visible_cells, content_layers: [data, formulas, visual]}} for spreadsheets.
  • stream (boolean, default false)
  • store (boolean, default true) — false keeps nothing at the provider: no ID is returned, and the request may fall back to the next target.
  • previous_interaction_id (string) — The gateway ID (int_gw1.…) of an interaction this key created.
  • background (boolean) — true runs the interaction after the answer, which carries status in_progress and the gateway ID; it must be stored and not streamed.
  • agent (string) — With gemini_interactions_agents: a gateway alias whose target model is the provider’s agent; sent instead of model.

Type: object

  • id (string, required)
  • name (string, required, max length 80)
  • mode (string, required, one of "mask", "block", "monitor") — mask replaces findings with [REDACTED:<name>] and forwards; block rejects with 400 guardrail_blocked; monitor (T128) evaluates the request text and the non-streaming answer as monitor_action would, on sample_percent of requests, and changes nothing: no rewrite, block, refusal or client header. It records would_block or would_mask in the request event (logging.request_events), gateway_guardrail_findings_total{guardrail,outcome} and an Info guardrail_monitor log line, never the matched text. A provider monitor that fails records error_allowed whatever on_error says; it neither refuses streams nor enters the semantic cache key. The parameter catalog (V10/V11) still lists mask and block only.
  • monitor_action (string, one of "block", "mask") — T128, mode monitor only: what the guardrail would do; default block. A provider guardrail only blocks. Switching to enforcement is mode set to this value.
  • sample_percent (integer, min 0, max 100) — T128, mode monitor only: share of requests evaluated at each stage, drawn independently per stage with crypto/rand; default 100. 0 evaluates nothing. Enforcing modes always run.
  • detectors (array of string, required)
  • default_on (boolean) — false: runs only where a guardrail policy adds it (ADR 0145); absent means true
  • selectable_teams (array of string, max items 64) — T164.006 (request_guardrails): teams whose keys may add this guardrail to one request with X-Gateway-Add-Guardrails; * is any team. Empty or absent means no key may add it.
  • patterns (array of object, max items 8)
    • name (string, required, pattern ^[a-z][a-z0-9_]{0,31}$)
    • regex (string, required, max length 256)
  • models (array of string) — Model aliases; empty means every model
  • stages (array of string) — input (default) inspects request text; output inspects non-streaming answers of Chat Completions (choices[].message.content), Anthropic Messages (content[] text blocks) and Responses (output[].content[] output_text), native or translated. mask rewrites the text; block replaces the answer with the refusal (200, the route’s own shape: finish_reason content_filter, stop_reason refusal, or status incomplete with incomplete_details.reason content_filter; the provider’s usage is kept and billed) or, for a local guardrail without a refusal, answers 502 guardrail_blocked_output. An unparseable answer is refused with 502 guardrail_output_unavailable. Output findings are counted in X-Gateway-Guardrails-Output. Streams are inspected at output only with features.guardrail_streaming (see stream, T059); otherwise, with a provider guardrail on the output stage, a stream, a Responses background request, a Responses request in a conversation, native Gemini GenerateContent and a /v1/realtime session are refused with 400 guardrail_output_unsupported before dispatch (T107). An answer longer than the service checks is withheld with 502 guardrail_output_unavailable whatever on_error says.
  • stream (string, one of "inspect", "refuse") — T059, output stage only: with features.guardrail_streaming, inspect (default) checks streamed Chat Completions, Messages and Responses answers in bounded windows before release (guardrail_streaming block); a finding of a block guardrail, a required check that failed or a buffer limit ends the stream with one error event in the route’s dialect (code guardrail_blocked_output with the refusal as message, guardrail_unavailable or guardrail_output_unavailable) after the provider’s end, so its usage is measured; refuse keeps answering stream requests with 400 guardrail_output_unsupported. Without the flag the field has no effect.
  • refusal (string, min length 1, max length 500) — T107: text that replaces an answer this guardrail blocks at output; needs mode block (or mode monitor that would block, where it is kept unused until the mode changes) and the output stage; no surrounding spaces; line breaks allowed, no other control, line-separator or bidirectional-override characters. Empty: a provider guardrail uses ‘This answer was withheld by a content policy.’, a local guardrail answers 502 guardrail_blocked_output.
  • provider (object) — External check (ADR 0105, ADR 0115, ADR 0117): Azure AI Content Safety, a Presidio PII analyzer, or a moderations alias of this gateway (type moderation: the text goes to /v1/moderations of that alias as the caller, narrowed to it, so the request log and the usage ledger see it; the caller needs no access of its own; the call is exempt from budget, token and RPM admission (no reservation, never 422 quota_profile_unsupported, not counted toward the caller’s RPM), and a guarded request its quota admission is certain to refuse answers that admission’s 429 quota_exceeded before the check is made; categories name the provider’s categories and score_threshold blocks on category_scores, otherwise the provider’s flags block), or Amazon Bedrock Guardrails (type bedrock_guardrail, ADR 0118: ApplyGuardrail signed by the bedrock provider named in connection; only BLOCKED policy actions block, ANONYMIZED ones pass unmasked), or any service behind the generic guardrail API (type generic_api, ADR 0119: POST {endpoint}, the full URL, with texts, model, input_type, request_data, call_id and trace_id; action BLOCKED blocks; GUARDRAIL_INTERVENED texts are advice unless apply_redactions is set; api_key_env goes as x-api-key), or Lakera Guard (type lakera_guard, ADR 0128: POST {endpoint or https://api.lakera.ai}/v2/guard with the request texts and breakdown, under project_id; flagged blocks, each detector that fired is a finding). Requires mode block and no detectors or patterns. Runs after the local guardrails on the already-masked text; findings at or above severity_threshold, a Prompt Shields attack, or a Presidio entity of a listed type at or above score_threshold, block with 400 guardrail_blocked. On the output stage (T107) it checks the answer’s generated text (content, refusals, reasoning and tool-call arguments) after local masking, as input_type response (generic_api), source OUTPUT (Bedrock) or assistant messages (Lakera); Prompt Shields does not run on answers, so azure_content_safety needs categories there; a moderation check is an internal call with the derived ID <request_id>.guardrail-output. on_error block (default) answers 503 guardrail_unavailable when the service fails, on input and on output (the generated answer is withheld); allow lets it through, and such an answer is never cached.
    • type (string, required, one of "azure_content_safety", "presidio", "moderation", "bedrock_guardrail", "generic_api", "lakera_guard", "extension", "judge")
    • evaluator (string, pattern ^[A-Za-z0-9_-]{1,64}$) — judge (T186.015, judge_guardrails): the evaluator whose published version judges the checked text; a fail assessment blocks (or, in monitor mode, would block). It must be an LLM judge or rule evaluator of the request’s team or of a team in the same organization, with pass criteria (or boolean output); otherwise the check fails and on_error decides. {{output}} is the checked text at either stage and {{input}} the request text at input. The judge’s call is a helper call of the request’s team (as the caller, narrowed to the judge alias, one attempt, <request_id>.guardrail-judge.0 or .guardrail-judge-output.0), a child span of the guardrail span, and never itself checked by a judge guardrail; every decision is an evaluation result on the request with its judge cost. Streams are refused (stream: refuse).
    • max_tokens (integer, min 16, max 600) — judge: the judge’s output token bound, default 64
    • max_input_chars (integer, min 100, max 100000) — judge: the most characters the judge reads, default 8000; longer text fails the check as text_too_large (never cut), on_error decides, and an answer is always withheld
    • extension (string, pattern ^[a-z][a-z0-9-]{1,63}$) — extension (T058, flags extensions and extension_guardrails): the plugin whose active approved version decides. The plugin gets the stage, texts (after local masking), model alias and calling team, and answers allow, deny (400 guardrail_blocked; on output the refusal or 502) or redact (input only: one replacement per text, applied before external checks; on output a redact verdict withholds the answer). A team-owned plugin runs only for its team. Timeouts, traps, limits and concurrency refusals follow on_error.
    • endpoint (string) — https://<resource>.cognitiveservices.azure.com, or the Presidio analyzer URL (http(s), e.g. http://presidio-analyzer:3000); empty for moderation
    • model (string) — moderation: the moderations alias that checks the text
    • connection (string) — bedrock_guardrail: ID of a bedrock provider whose region and SigV4 identity sign ApplyGuardrail
    • guardrail_id (string, pattern ^[a-z0-9]{1,64}$) — bedrock_guardrail: guardrail identifier
    • guardrail_version (string, pattern ^(DRAFT|[1-9][0-9]{0,7})$) — bedrock_guardrail: version, default DRAFT
    • project_id (string, pattern ^[A-Za-z0-9_-]{1,64}$) — lakera_guard: Lakera project whose policy applies
    • params (object) — generic_api: sent as additional_provider_specific_params
      • any other key: string
    • apply_redactions (boolean) — generic_api (T058.003), default false: apply the texts of a GUARDRAIL_INTERVENED answer instead of treating them as advice. The answer must carry one JSON string per text sent, in the same order, each at most twice the original plus 4096 bytes; anything else is a service failure that on_error decides. On input the texts replace the request text in place (roles, tool calls and message structure unchanged) before later checks and the provider; on a non-streaming answer they replace the visible text and refusals, and a change to reasoning, a transcript, a tool call or a block checked as raw JSON withholds the answer with the refusal. A streamed window cannot be rewritten: a redaction ends the stream like a block. Choice or part logprobs would spell the original again, and a Responses answer not sent with store false stays readable through its ID, so a redaction there withholds the answer too. Monitors count a redaction as a finding. Pair it with on_error block: with allow, a check the service cannot finish lets the original through. Applied redactions are counted in X-Gateway-Guardrails(-Output) and the request event as masked, never with their text.
    • timeout (string, pattern ^[0-9]+(\.[0-9]+)?(ms|s)$) — T058.003, every provider type except extension (whose signed manifest sets timeout_ms): the deadline of one check, a duration from 100ms to 30s, default 5s. The deadline cancels the call, which then fails as on_error says.
    • api_key_env (string) — Environment variable with the key (Ocp-Apim-Subscription-Key); empty uses the gateway’s Entra ID
    • categories (array of string, max items 30) — Azure: Hate, SelfHarm, Sexual, Violence. moderation: lower-case provider categories (violence, self-harm/intent…); empty blocks whatever the provider flags.
    • severity_threshold (integer, min 0, max 7) — 0 means 4
    • prompt_shields (boolean)
    • entities (array of string, max items 50) — Presidio entity types that block (CREDIT_CARD, US_SSN, PERSON, IBAN_CODE…)
    • language (string, pattern ^[a-z]{2}$) — Presidio text language, default en
    • score_threshold (number, min 0, max 1) — Presidio minimum recognizer score (0 means 0.5); moderation: block when a category score reaches it (0 uses the provider’s flags)
    • on_error (string, one of "block", "allow")
  • disabled (boolean)
  • source (string, one of "yaml", "console", read-only)
  • declared (boolean, read-only)

Type: object

A guardrail policy (ADR 0145), in the YAML key names of guardrail_policies[]. A guardrail with default_on false runs only where a policy adds it.

  • id (string, required, max length 64)
  • name (string, required, max length 80)
  • description (string, max length 500)
  • inherit (string) — The id of the policy this one extends.
  • guardrails (array of string, required, max items 50)
  • remove (array of string, max items 50) — Guardrails of the inherited policy this one does not want.
  • teams (array of string, max items 100) — Teams the policy is attached to; “*” for all.
  • keys (array of string, max items 100) — Keys the policy is attached to; “*” for all.
  • models (array of string, max items 100) — Model aliases the policy is attached to; “*” for all.
  • source (string, one of "yaml", "console", read-only) — Where the policy is defined; set by the gateway, ignored on a save.

Type: object

T059: the boot guardrail_streaming settings, read-only (a configuration rollout changes them), under the YAML block’s name; enabled is features.guardrail_streaming.

  • enabled (boolean)
  • window_bytes (integer) — guardrail_streaming.window_bytes, effective.
  • holdback_bytes (integer) — guardrail_streaming.holdback_bytes, effective.
  • boundary (string, one of "sentence", "bytes") — guardrail_streaming.boundary, effective.
  • max_held_bytes (integer) — guardrail_streaming.max_held_bytes, effective.
  • responses_mask (boolean) — T168: features.guardrail_stream_responses_mask. A mask finding on a native Responses stream rewrites its deltas, done events and terminal response in place (event order and sequence numbers unchanged) instead of ending the stream.

m7gtw[email protected]