> ## Documentation Index
> Fetch the complete documentation index at: https://docs.promptguard.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Store your provider keys with PromptGuard

> Store your OpenAI / Anthropic / Bedrock credentials once, then forward them server-side on every request

A **Provider Key** is an upstream LLM credential (e.g. `sk-...` for OpenAI, `sk-ant-...` for Anthropic) that you store with PromptGuard once. The gateway then attaches it as the `Authorization` header when forwarding to the provider, replacing whatever your app sends.

This is the single biggest reason teams use PromptGuard in front of their LLM provider: your application code never embeds a vendor key, your CI never leaks one, and key rotation is a one-click operation in the dashboard instead of a multi-service deploy.

**Prefer to watch?** This page as a silent, step-by-step video:

**Tutorial 07** ·  · a silent follow-along of this page. Pressing
play loads the video from YouTube.
Watch on YouTube

## When you need this vs. when you don't

> [tab] Use Provider Keys
>
> * You're proxying through `/api/v1/proxy/...` endpoints (PromptGuard forwards to the upstream provider on your behalf).
> * You want a single rotation point for your vendor credential.
> * You don't want browser/mobile clients to ever see the upstream key.
> * You're running multi-tenant inference and want PromptGuard to pick the right key per project.

> [tab] Skip Provider Keys
>
> * You're only calling [`/api/v1/guard`](https://docs.promptguard.co/api-reference/guard) to evaluate prompts before/after your own LLM call. PromptGuard never touches the upstream, there's nothing to forward.
> * You're using a self-hosted model (vLLM, Ollama) where the credential is provided by the network layer.
> * You call Bedrock with an AWS SDK and your own IAM credentials, use [auto-instrumentation](https://docs.promptguard.co/integrations/providers/bedrock.md) instead of the proxy.

## Storing a key

Open [**Dashboard → Connect → Provider Keys**](https://app.promptguard.co/dashboard/provider-keys) **→ Add provider key**, pick the provider, paste the key, give it a name. The key is encrypted at rest and the plaintext is never written to logs. Provider keys are stored reversibly because the proxy has to present the real credential to OpenAI or Anthropic on your behalf, unlike your PromptGuard API keys, which are stored as a one-way digest and shown only once, since we never need to read them back.

```bash theme={"system"}
# Or via the API:
curl -X POST https://api.promptguard.co/dashboard/provider-keys \
  -H "Authorization: Bearer $DASHBOARD_TOKEN" \
  -H "X-CSRF-Token: $CSRF" \
  -H "Content-Type: application/json" \
  -d '{
    "provider": "openai",
    "name": "Production OpenAI",
    "key": "sk-proj-..."
  }'
```

### Accepted `provider` values

`openai`, `anthropic`, `gemini`, `mistral`, `azure_openai`, `cohere`, `huggingface`,
`bedrock`, `openai_compatible`.

`bedrock` and `openai_compatible` keys carry the host they may be sent to in
`base_url`, and it is required for both: for `bedrock` it is the AWS region
the key is for (see [AWS Bedrock](https://docs.promptguard.co/integrations/providers/bedrock.md#through-the-proxy)),
for `openai_compatible` the service's endpoint (see [OpenAI-compatible
hosts](https://docs.promptguard.co/integrations/providers/openai-compatible.md)). A key without one could
never be sent anywhere, so it is refused with a `400`: on creation, and on a
`PATCH` that sets `base_url` to an empty string. The dashboard form asks for it
when you pick either provider, as **AWS region** or **Base URL**. On
PromptGuard Cloud an `openai_compatible` host must be on the public internet;
[OpenAI-compatible hosts](https://docs.promptguard.co/integrations/providers/openai-compatible.md#1-store-the-key-with-its-host)
says what is refused, and where private hosts are allowed.

One more value is accepted that is not an LLM provider: `pagerduty`, for the
Events API v2 integration key a [PagerDuty alert
destination](https://docs.promptguard.co/platform/webhooks.md#pagerduty) authenticates with. It is stored
the same way, encrypted, prefix-only afterwards, and is never used to
forward a request; the destination references it by `id`. A `base_url` is
refused for it.

> [!NOTE]
>
> `google` is accepted on input as a **deprecated alias** for `gemini` and is normalised before storage, so a key you stored as `google` reads back as `gemini`. Use `gemini` in new code. Any other value is rejected, the list exists so a provider name the proxy cannot resolve never reaches a row.

The response carries the plaintext `key` this once, with the key's `id`, its `base_url` and the masked `prefix` (the first 7 and last 4 characters) that lists show from then on. To see the plaintext again use the [reveal endpoint](#revealing-an-existing-key); each reveal is logged.

## Resolution order

When PromptGuard needs to forward a proxy request, it picks a Provider Key in this priority:

1. The most recently created **active** key for the request's project + provider.
2. If no project-scoped key exists, the most recently created active key for the **user** + provider.
3. If neither exists, the request's own `Authorization` header is forwarded as-is.

This matches the access-list scoping model: project rules win, user-wide rules are the safety net.

## Revealing an existing key

```bash theme={"system"}
curl https://api.promptguard.co/dashboard/provider-keys/$KEY_ID/reveal \
  -H "Authorization: Bearer $DASHBOARD_TOKEN"
```

Returns the decrypted plaintext key. Each reveal is recorded as a `provider_key_revealed` security event in PromptGuard's service log, with the actor, IP address and user agent. It is not shown on your organization's Audit Log page. Use it for break-glass recovery, not as a runtime fetch path, fetching the plaintext on every request defeats the purpose of having PromptGuard hold it for you.

## Rotation

Rotation is a four-line workflow:

1. Create a new Provider Key in the dashboard for the same provider.
2. Mark the old one inactive (`PATCH /dashboard/provider-keys/{old_id}` with `is_active=false`), *don't delete it yet*. New traffic will pick up the new key on the next request thanks to step 1 of resolution order.
3. Watch the dashboard for failed upstream calls for one rotation cycle.
4. Delete the old key. The audit log retains the deletion event for your retention period.

No application redeploy required.

## Next steps

> [card] [Routing rules](https://docs.promptguard.co/gateway/routing-rules.md)
>
> Rewrite the upstream provider or model per request

> [card] [Spend caps](https://docs.promptguard.co/gateway/spend-caps.md)
>
> Cap a project's monthly provider spend through the proxy

> [card] [Integrations overview](https://docs.promptguard.co/integrations/overview.md)
>
> Every provider and framework, and how to connect each


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.