Skip to main content

Key Interception

Clevername automatically detects API keys in agent prompts, strips them before they reach the AI provider, and offers to store them securely in the BYOK key store. Available on every tier (Free, Pro, Team, Enterprise) and on by default — no setup required.

Key Concepts

What is key interception?

When you or an agent includes an API key in a prompt routed through Clevername's governance gateway, the key is detected before the request reaches the AI provider. The key is stripped from the prompt, and you are offered the option to store it in your BYOK key store (GCP Secret Manager in production, AES-256-GCM in local dev). This prevents accidental key leakage to third-party AI providers.

Available on every tier

Key interception, multi-key labels, agent-key bindings, and the 6-hour key health check are included on Free, Pro, Team, and Enterprise. Paid tiers do not unlock additional interception modes — they raise governed-agent and gateway-token caps and add features like the SOC console (Team+) and SIEM export (Enterprise).

Why does this matter?

  • API keys sent in prompts can end up in provider logs and training data
  • Keys shared in conversation context may be visible to other tools and agents
  • Manual copy-paste is error-prone — interception catches mistakes automatically
  • Stored keys are encrypted with AES-256-GCM and protected by CMEK

No setup needed

Key interception is enabled by default in detect_and_offer mode for all users. When a key is detected, you see a prompt asking whether to store it. You can change the mode at any time from your organization settings or through the Agent Review questionnaire.

How Key Interception Works
1

You send a message containing an API key

You type or paste a message that includes something like sk-proj-abc123... into the chat. This could be intentional or accidental.

2

Clevername detects the key pattern

Before the message leaves Clevername, the scanner identifies the key using provider-specific patterns (OpenAI, Anthropic, Google, AWS, and others). The key is stripped from the prompt so the AI provider never sees it.

3

You choose what to do

Depending on the interception mode, you are either prompted to store the key, or it is stored automatically. In detect_and_offer mode (the default), a dialog appears with these options:

  • Store securely — saves the key to GCP Secret Manager
  • Dismiss — the key is discarded and not stored
4

Key is stored and available

Once stored, the key appears in your API Keys settings and is available for routing AI calls. Future requests to that provider use the stored key automatically — no need to paste it again.

Interception Modes

Key interception supports four modes. Your organization admin can set the default, and the Agent Review questionnaire (question D7) can override it per agent.

detect_and_offerDetect & Offer (default)

Keys are detected and stripped. You are prompted to store them. Best for most teams — catches mistakes without forcing storage.

auto_storeAuto Store

Keys are detected, stripped, and stored automatically without prompting. Best for teams that always want keys captured.

strip_onlyStrip Only

Keys are detected and stripped from the prompt but not stored. The key is discarded. Best for compliance-heavy environments.

offOff

No interception. Keys in prompts are sent through to the AI provider as-is. Not recommended for production use.

Tip
To change the mode, go to Dashboard → Organization → Settings → Security and select your preferred interception mode. Org admins can enforce a mode across all members.

How to Configure It

There are two ways to control key interception:

Organization settings

Go to Dashboard → Organization → Settings → Security. The Key Interception Mode dropdown lets you set the default for all members. Individual agents can override this through their review questionnaire.

Agent Review questionnaire (D7)

Question D7 in agent review security questionnaire asks: “How should this agent handle API keys encountered in prompts?” The answer sets the interception mode for that specific agent, compiled into its guardrail profile. This overrides the org-level default for that agent only.

Key Rotation

When you paste a new key for a provider where you already have a stored key, Clevername detects that it is a replacement. The flow depends on your interception mode:

  • 1.The new key is intercepted and identified as belonging to the same provider as an existing key.
  • 2.In detect_and_offer mode, you are asked whether to replace the existing key or store the new one alongside it (multi-key).
  • 3.If you choose to replace, the old key version is permanently destroyed in Secret Manager and the new key takes its place. There is no undo.
Important
Key rotation is irreversible. Once the old key version is destroyed in Secret Manager, it cannot be recovered. Make sure you no longer need the old key before confirming.

Multi-Key Support

You can store multiple keys for the same provider — for example, separate OpenAI keys for different projects or cost centers. Each key gets a label so you can tell them apart.

ProviderLabelHintUsed By
OpenAIProductionsk-p…8x2fAgent A, Agent B
OpenAIDevelopmentsk-d…3k9mAgent C
AnthropicDefaultsk-a…7j1nAll agents

When an agent needs a key, Clevername selects the one bound to that agent. If no specific binding exists, the default key for that provider is used. See Agent Key Binding for details.

Supported Providers

Key interception recognizes key patterns from these providers:

OpenAI
Anthropic
Google (Gemini)
AWS
Azure OpenAI
Cohere
Mistral
Replicate
Hugging Face

Custom key patterns can be added for enterprise deployments. Contact support for details.