Skip to main content

Provider control features

This page covers the provider controls that change how the gateway picks, logs, and retries traffic, beyond the target fields in Provider configuration:

  • model_groups give clients a stable model name while you change the targets behind it.
  • logging keeps message bodies and keys out of traces and events.
  • max_context_tokens on a target compresses requests that are too long for it.
  • zero_completion_insurance retries an empty completion on the next target.
  • The top-level health_monitor section probes provider endpoints in the background.

Syntax​

For a working target with id: openai-primary, add a group and logging next to targets in the same providers section:

Inside providers
model_groups:
  - name: fast
    aliases: [default-fast]
    targets: [openai-primary]
logging:
  redact_message_bodies: true

Send a request with "model": "fast". The runtime event shows that openai-primary served it.

Body redaction changes traces and event payloads only. The upstream model still receives the full content.

Fields​

Model group fields​

FieldTypeDescription
namestringName that a request model can select. Required.
targetsarray of stringsTarget IDs of the group, in order. Each must exist in providers.targets. Required.
aliasesarray of stringsOther model names for the group
descriptionstringDescription
fallback_groupstringGroup whose targets come next. Must exist and must not create a cycle.

Logging fields​

FieldTypeDefaultDescription
redact_message_bodiesbooleanfalseWrites [REDACTED] instead of message content in traces and event payloads
redact_api_keysbooleantrueWrites [REDACTED] instead of API keys in traces and event payloads

Context compression field​

FieldTypeDescription
targets[].max_context_tokensintegerAbove this size, the gateway compresses the request from the middle before it sends it to the target.

Zero-completion insurance fields​

FieldTypeDefaultDescription
enabledbooleantrueSends an empty completion to the next eligible target

Health monitor fields​

FieldTypeDefaultDescription
providers[].namestringProvider ID that the probe reports. Use the id of a target to make the result change routing for that target. Required.
providers[].endpointstringURL that the probe calls with a plain GET. Required.
providers[].interval_secondsinteger60Seconds between two probes of this entry
providers[].timeout_msinteger5000Time limit for one probe, in milliseconds
unhealthy_thresholdinteger3Number of consecutive failed probes that make the provider unhealthy. Must be above 0.
alert_callback_urlsarray of stringsURLs that receive a POST when the health state changes

Examples​

Complete example​

Use two models that your account serves, and export both keys in the gateway terminal:

policy-config.yaml
pack:
  name: advanced-provider-controls
  version: 1.0.0
  enabled: true
providers:
  targets:
  - id: openai-prod
    provider: openai
    provider_type: openai
    format: openai
    model: your-openai-model
    max_context_tokens: 128000
    secret_key_ref:
      env: VERDICTAN_OPENAI_API_KEY
  - id: openai-secondary
    provider: openai
    provider_type: openai
    format: openai
    model: your-secondary-openai-model
    secret_key_ref:
      env: VERDICTAN_OPENAI_SECONDARY_API_KEY
  model_groups:
  - name: standard
    targets:
    - openai-prod
    - openai-secondary
  logging:
    redact_message_bodies: true
  zero_completion_insurance:
    enabled: true
policies:
  chain:
  - audit-logger
policy:
  audit-logger: {}

Health monitor​

Inside policy-config.yaml
health_monitor:
  providers:
    - name: openai-primary
      endpoint: https://health.example.com/ready

Limits and failure behavior​

Model groups​

  • When the request model matches a group, the group targets go first in the candidate list, followed by the targets of each fallback_group.
  • The provider attempt rules decide how the gateway moves through the list.
  • An unknown target ID, an unknown fallback_group, or a cycle of fallback groups is a load error.
  • A group name or alias that is also the name of a pipeline or of the auto provider is a load error.

Context compression​

Compression happens only when the selected target sets max_context_tokens and the request is longer.

Zero-completion insurance​

The check is on by default and applies only to buffered POST /v1/chat/completions responses. Turn it off if a second provider call is not approved.

Health monitor​

  • The gateway starts one probe task for each entry. Each task uses the interval_seconds and timeout_ms of its entry. When VERDICTAN_HEALTH_PROBE_INTERVAL_SECS is set, its value replaces interval_seconds for all entries. The gateway limits that value to the range 10 to 300.
  • A probe passes when the endpoint returns a 2xx status or 401. A transport error, another status, or no response before timeout_ms is a failed probe.
  • After unhealthy_threshold consecutive failed probes, the provider is unhealthy. One passed probe makes it healthy again.
  • The gateway records each result in the provider metrics under the name of the entry. When name is the id of a target, the gateway puts an unhealthy target at the end of the candidate list. The route strategy can change this sequence after that. For example, round-robin and random change the sequence.
  • GET /readyz shows the state of each entry in provider_health_monitor: provider, state (unknown, healthy, or unhealthy), consecutive_failures, last_status_code, and last_checked_at_unix. The state does not change the /readyz status code.
  • When the state changes, the gateway sends a JSON POST with event: provider.health_state_changed to each alert_callback_urls entry. A change from unknown to healthy does not send an alert. A failed callback writes a warning to the gateway log.

Next steps​