---
title: "Provider keys"
subtitle: "Use your own OpenAI, Anthropic, Azure, or other provider keys with the gateway."
---

Add a provider key when you want gateway requests billed to your own provider account instead of [Respan credits](/docs/documentation/admin/credits-billing). Your code still authenticates with your Respan API key; Respan uses the provider key to call the model.

<Note>
Bring your own key is available on the Team plan and above.
</Note>

## Add a provider key

<Steps>
<Step title="Open Bring your own key">

Go to **Gateway** › **API keys** and click **Bring your own key**. Providers you've already added show how many keys are active.

<img src={"/docs/images/admin/provider-keys-providers-light.png"} className="block dark:hidden" alt="The Bring your own key dialog listing providers: OpenAI with 2 active keys, Anthropic with 1, and Azure OpenAI, Google Gemini AI, Bedrock, Cohere, and Deepseek not added" />
<img src={"/docs/images/admin/provider-keys-providers-dark.png"} className="hidden dark:block" alt="The Bring your own key dialog listing providers: OpenAI with 2 active keys, Anthropic with 1, and Azure OpenAI, Google Gemini AI, Bedrock, Cohere, and Deepseek not added" />

</Step>
<Step title="Add a deployment">

Click the provider, click **Add deployment**, and confirm with **I understand**. Each key you add is a deployment.

</Step>
<Step title="Enter the key">

Fill in the provider's fields. Most providers take an **API key**. Azure OpenAI also needs **API base** and **API version**, Bedrock takes AWS credentials, and Google Vertex AI takes a project, location, and credentials JSON. Click the pencil to rename the deployment.

<img src={"/docs/images/admin/provider-keys-add-deployment-light.png"} width="520" className="block dark:hidden" alt="The OpenAI provider dialog with a new deployment form: API key, Load balance weight with a 20% hint, and Model test call, above two existing deployments at 75% and 25%" />
<img src={"/docs/images/admin/provider-keys-add-deployment-dark.png"} width="520" className="hidden dark:block" alt="The OpenAI provider dialog with a new deployment form: API key, Load balance weight with a 20% hint, and Model test call, above two existing deployments at 75% and 25%" />

</Step>
<Step title="Test and save">

Under **Model test call**, pick a model and click **Send test call** to check the key. Then click **Save**.

</Step>
</Steps>

To pause a key, open it and turn off **Active**. To remove it, open it and click **Delete deployment**.

## Use several keys for one provider

Add more deployments to the same provider. Respan spreads requests across the active ones by **Load balance weight**, and each deployment shows its share, such as **Active -> 75.00%**. See [Load balancing](/docs/documentation/features/gateway/load-balancing).

For Azure OpenAI, Google Vertex AI, and Bedrock, **Advanced options** has **Available models** and **Exclude models**, so a deployment only serves the models it hosts.

## Add a custom provider

For an endpoint that isn't listed, click **New custom provider**, enter a **Provider ID**, **Provider name**, and **Base URL**, and click **Add provider**. Then add a deployment with its API key. To ask for a provider to be supported, click **Request new provider**.

## Check which key served a request

In **Gateway** › **Logs**, open a request and go to the **Config** tab. **Billing method** shows **BYOK** for your own key, or **Respan credits**. To see every request one key served, filter Logs by **Deployment**.

## Pass a key per request

To send a key with one request instead of saving it, add `customer_credentials`, keyed by provider ID such as `openai` or `anthropic`. It replaces that provider's saved keys for the request.

<Tabs>
<Tab title="Python">
```python
import os
from openai import OpenAI

client = OpenAI(
    base_url="https://api.respan.ai/api/",
    api_key=os.environ["RESPAN_API_KEY"],
)

response = client.chat.completions.create(
    model="gpt-5.5",
    messages=[{"role": "user", "content": "Hello!"}],
    extra_body={
        "customer_credentials": {
            "openai": {"api_key": os.environ["OPENAI_API_KEY"]}
        }
    },
)
```
</Tab>
<Tab title="TypeScript">
```typescript
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api.respan.ai/api/",
  apiKey: process.env.RESPAN_API_KEY,
});

const response = await client.chat.completions.create({
  model: "gpt-5.5",
  messages: [{ role: "user", content: "Hello!" }],
  // @ts-expect-error Respan parameter
  customer_credentials: {
    openai: { api_key: process.env.OPENAI_API_KEY },
  },
});
```
</Tab>
<Tab title="cURL">
```bash
curl https://api.respan.ai/api/chat/completions \
  -H "Authorization: Bearer $RESPAN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-5.5",
    "messages": [{"role": "user", "content": "Hello!"}],
    "customer_credentials": {"openai": {"api_key": "'"$OPENAI_API_KEY"'"}}
  }'
```
</Tab>
</Tabs>

<span data-docs-fragment-alias={"per-model-credential-override"} aria-hidden="true" data-pagefind-ignore="" style={{ display: "block", height: 0, scrollMarginTop: "5rem" }} />

To use a different key for one model only, such as one step in a fallback chain, use `credential_override`, keyed by model. See [Model catalog](/docs/documentation/features/gateway/models-catalog).
