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

# Bring Your Own Keys

> Use your own provider API keys with the AI Gateway.

Bringing your own keys is necessary when:

* you want upstream billing on your provider account
* you need built-in providers beyond OpenAI and Anthropic
* you're running [custom providers](/ai-gateway/concepts/custom-providers)

Your application authenticates with an [access key](/ai-gateway/concepts/access-keys). Store provider keys in [app.ngrok.ai](https://app.ngrok.ai) and attach them through an [access key configuration](/ai-gateway/guides/access-key-configurations).

## Built-in providers

|                         | OpenAI & Anthropic                                      | Other built-in providers               |
| ----------------------- | ------------------------------------------------------- | -------------------------------------- |
| Provider account needed | Optional                                                | Yes                                    |
| Default credentials     | ngrok.ai inference (with credits)                       | Provider key required in configuration |
| What credits pay for    | Processing fee; plus model cost with ngrok.ai inference | Processing fee only                    |

For OpenAI and Anthropic, create a configuration routing rule with **Bring your own API key** instead of **ngrok** when you want to use your provider account.

## Custom providers

Custom providers are endpoints you define, such as Ollama, vLLM, or any OpenAI- or Anthropic-compatible API. See [Use a model you run yourself](/ai-gateway/guides/use-a-model-you-run-yourself).

Custom providers require provider keys in the configuration when the upstream needs authentication. See [Custom providers](/ai-gateway/concepts/custom-providers).

## Setup flow

1. [Add provider keys](/ai-gateway/guides/attaching-provider-keys#add-a-provider-key).
2. Create an [access key configuration](/ai-gateway/guides/access-key-configurations) with routing rules and scope.
3. Assign the configuration to an [access key](/ai-gateway/concepts/access-keys).
4. Send requests with the access key only.

## Migrating from endpoint-based setup

If you previously used Traffic Policy on an ngrok endpoint, see [Migrating from endpoints](/ai-gateway/guides/migrating-from-endpoints).

## Guides

<CardGroup cols={2}>
  <Card title="Bring your own provider key" icon="key" href="/ai-gateway/guides/attaching-provider-keys">
    Store upstream credentials
  </Card>

  <Card title="Access Key Configurations" icon="sliders" href="/ai-gateway/guides/access-key-configurations">
    Attach keys and set scope
  </Card>

  <Card title="Use a model you run yourself" icon="building" href="/ai-gateway/guides/use-a-model-you-run-yourself">
    Self-hosted and third-party endpoints
  </Card>
</CardGroup>
