AI Vaults

Related Documentation
Minimum Version
AI Gateway - 2.0
Incompatible with
on-prem
Previous Versions of this page

What is an AI Vault?

You must store secrets like API keys and authentication tokens somewhere secure instead of embedding them directly in your configurations. An AI Vault entity lets you register an external secret backend (AWS Secrets Manager, HashiCorp Vault, environment variables, or others) so that AI Model Providers, AI Auth Strategies, AI Models, AI Agents, and AI MCP Servers can reference secrets instead of storing them as literal values.

An AI Vault entity stores the connection configuration and credentials needed to reach your secret backend. When other entities reference a secret, AI Gateway:

  1. Looks up the vault at request time
  2. Retrieves the actual secret value
  3. Uses it for authentication or configuration.

Manage AI Vaults

AI Vaults can be created and managed through:

For configuration examples and step-by-step setup instructions, see Set up an AI Vault.

Backends

Each AI Vault selects one of the supported secret backends:

The connection details vary per backend; the Konnect UI surfaces the relevant fields based on the backend you choose.

Which fields support AI Vault references?

AI Vault references can be used in sensitive fields across your AI Gateway entities:

Entity

Sensitive fields

AI Model Provider Authentication credentials (API keys, bearer tokens) in auth headers for upstream LLM providers
AI Auth Strategy OIDC client secret for openid-connect type providers
AI Model Backend-specific authentication required by target model configurations
AI Agent AWS IAM (SigV4) credentials for authenticating to the upstream agent when config.upstream.auth is set
AI MCP Server Encryption keys used for client session management, and AWS IAM (SigV4) credentials for authenticating to the upstream server in upstream-server mode

Any field marked as supporting vault references can accept a secret reference instead of a literal value.

How do I reference secrets?

To reference a secret stored in a vault, use the syntax:

{vault://vault-name/secret-key}

Where:

  • vault-name is the name field of the vault you created
  • secret-key is the identifier of the secret within that vault (exact format depends on the backend)

For example, if you created a vault named prod-aws-vault and stored an OpenAI API key under the key openai-api-key, reference it as:

{vault://prod-aws-vault/openai-api-key}

Here’s how you’d use that reference in an AI Model Provider entity:

The entire field value must be the vault reference string. You cannot use partial references like Bearer {vault://...}. The field itself must be exactly {vault://vault-name/secret-key}.

At request time, AI Gateway resolves the reference by looking up the vault name, retrieving the secret value, and using it for authentication or configuration.

Choosing a backend for your AI Vault

Pick a backend matching your infrastructure and secret management strategy. Cloud-native deployments can use their platform’s secret service (aws, gcp, azure), enterprises can use dedicated secret management systems (conjur, hcv), and smaller deployments can use env (environment variables) or konnect (built-in Config Store).

Backend

When to use

konnect Getting started, no external dependencies. Built-in Konnect Config Store for teams without existing secret infrastructure.
env Development, edge deployments, or environments where you control data plane startup. Secrets loaded at startup, no network calls.
aws AWS-deployed data planes. Integrate with AWS Secrets Manager or Parameter Store.
gcp GCP-deployed data planes. Integrate with Google Secret Manager.
azure Azure-deployed data planes. Integrate with Azure Key Vault.
conjur Enterprises standardized on CyberArk Conjur for centralized secrets management.
hcv Dedicated secret management with fine-grained access control. Supports token, AppRole, JWT, Kubernetes, AWS IAM, GCP, and Azure authentication.

Caching and availability

Cloud-backed vault types (aws, gcp, azure, conjur, hcv) cache resolved secrets so AI Gateway doesn’t hit the backend on every request. This reduces latency and vault load. The env backend doesn’t cache because environment-variable lookups are local.

If your vault becomes unreachable, AI Gateway can continue using recently-cached secrets for a grace period, keeping your system operational during brief vault outages. This allows you to maintain service continuity even when secret infrastructure is temporarily unavailable.

Cache duration and grace periods are tunable per vault, allowing you to balance between fresh secrets (shorter cache times) and reduced vault requests (longer cache times). The default settings work for most deployments; adjust only if your secret rotation strategy or vault reliability requires custom behavior.

Konnect Config Store

Unlike the other backends, the konnect type doesn’t connect out to an external secret manager. It stores secrets directly in Konnect, in a Config Store: a named container of key-value secrets that you create and populate through its own API, separate from the AI Vault entity itself.

A konnect-type AI Vault doesn’t hold any secret values. It only references a Config Store by ID through config.config_store_id. The Config Store holds the actual secrets.

Secret values are write-only. Once stored, AI Gateway never returns the value again, only the secret’s key and timestamps.

Manage Config Stores

Config Stores are managed through the AI Gateway API:

Both support full create, list, get, update, and delete operations. Deleting a Config Store that still has secrets fails unless you pass ?force=true, which cascades the delete to all secrets in that Config Store.

Create a Config Store and add a secret

The following example creates a Config Store:

curl -X POST "https://us.api.konghq.com/v1/ai-gateways/$AI_GATEWAY_ID/config-stores" \
     --no-progress-meter --fail-with-body  \
     -H "Authorization: Bearer $KONNECT_TOKEN"\
     -H "Content-Type: application/json"\
     -H "Accept: application/json, application/problem+json" \
     --json '{
       "name": "prod-secrets"
     }'

Add a secret to the Config Store:

curl -X POST "https://us.api.konghq.com/v1/ai-gateways/$AI_GATEWAY_ID/config-stores/$CONFIG_STORE_ID/secrets" \
     --no-progress-meter --fail-with-body  \
     -H "Authorization: Bearer $KONNECT_TOKEN"\
     -H "Content-Type: application/json"\
     -H "Accept: application/json, application/problem+json" \
     --json '{
       "key": "openai-api-key",
       "value": "sk-my-openai-key"
     }'

Reference the Config Store from a konnect-type AI Vault

Create a konnect-type AI Vault that points at the Config Store’s id:

Reference the secret the same way as any other AI Vault:

{vault://prod-config-store-vault/openai-api-key}

Set up an AI Vault

The following example registers an environment-variable AI Vault that resolves references against process environment variables prefixed with KONG_.

AI Vault doesn’t accept a display_name field. Only name and description identify a vault. If you include display_name when creating an AI Vault, AI Gateway silently ignores it.

Schema

FAQs

The runtime entity is the same secret-management abstraction. The AI Gateway surface manages AI Vaults through the AI entity convention (name, description, labels) and exposes them through the Konnect API alongside the other AI entities. Unlike other AI Gateway entities, AI Vaults don’t have a display_name field.

The type field selects the backend: konnect, env, aws, gcp, azure, conjur, or hcv. Each type carries its own config shape. HashiCorp Vault (hcv) further selects an auth_method from token, cert, jwt, approle, kubernetes, gcp_iam, gcp_gce, aws_ec2, aws_iam, or azure.

Sensitive fields on AI Model Provider, AI Auth Strategy, AI Model, AI MCP Server, and other entities are annotated as referenceable. Set those fields to a vault reference string (for example, a {vault://...} placeholder) instead of a literal value. The AI Vault name is the lookup key.

name is a user-defined unique identifier and the stable handle used to look up the AI Vault configuration when other entities reference secrets. Renaming an AI Vault breaks any reference pointing at the old value.

A konnect-type AI Vault doesn’t hold secret values itself. It references a Config Store by config.config_store_id, and you create and manage the actual secrets through the Config Store’s own API. For more information, see Konnect Config Store.

Help us make these docs great!

Kong Developer docs are open source. If you find these useful and want to make them better, contribute today!