> ## 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.

# Pay with Credits

> Call OpenAI, Anthropic, and other supported models through ngrok.ai with only an access key, and learn how credits cover the model cost.

Pay with credits when you want the AI Gateway to supply the provider credentials for you, so you don't need a provider account.

Your app sends an [access key](https://ngrok.com/docs/ai-gateway/concepts/access-keys.md) to the gateway.
The gateway authenticates to the supported upstream provider, and credits cover the model cost plus the gateway processing fee.

> [!NOTE]
>
> You can pay with credits for models from OpenAI, Anthropic, Google, DeepSeek, xAI, Moonshot AI, Z.ai, and other built-in providers.
> Availability is per model; the [model catalog](https://ngrok.com/docs/ai-gateway/reference/model-catalog.md#billing-and-provider-credentials) shows which providers support it.
> For providers that require your own credentials, [bring your own provider key](https://ngrok.com/docs/ai-gateway/guides/attaching-provider-keys.md).

## What you'll need

* An ngrok account.
* An [access key](https://ngrok.com/docs/ai-gateway/concepts/access-keys.md) from [app.ngrok.ai](https://app.ngrok.ai).
* Credits in your AI Gateway account.

## Create an access key

Create an access key in [app.ngrok.ai](https://app.ngrok.ai).
Use this key as the API key in your SDK.

The access key authenticates your application to the gateway.
It's different from a provider key, which authenticates the gateway to an upstream provider.

## Call a supported OpenAI model

```json theme={"theme":{"light":"css-variables","dark":"css-variables"}}
{
  "model": "openai:gpt-4o",
  "messages": [{"role": "user", "content": "Hello"}]
}
```

You can also use the model ID directly:

```json theme={"theme":{"light":"css-variables","dark":"css-variables"}}
{
  "model": "gpt-4o",
  "messages": [{"role": "user", "content": "Hello"}]
}
```

## Call a supported Anthropic model

```json theme={"theme":{"light":"css-variables","dark":"css-variables"}}
{
  "model": "anthropic:claude-sonnet-4-6",
  "messages": [{"role": "user", "content": "Hello"}]
}
```

## How billing works

When you pay with credits, credits cover:

* The upstream model cost.
* [Hosted tools](https://ngrok.com/docs/ai-gateway/concepts/hosted-tools.md) the provider bills, such as web search, code execution, and image generation.
* The AI Gateway processing fee.

Before sending a request, the gateway checks that you can pay for it with credits.
If you can't pay for a model or feature with credits, you get an error asking you to add your own provider key.
See [`ERR_NGROK_27238`](https://ngrok.com/docs/ai-gateway/reference/error-codes#err_ngrok_27238).

For providers or models you can't pay for with credits, or when you want your provider to bill usage directly, [bring your own provider key](https://ngrok.com/docs/ai-gateway/guides/attaching-provider-keys.md).

## When to bring your own key instead

Bring your own provider key when:

* You already have a provider account.
* You want your provider to bill usage directly.
* You have negotiated provider pricing.
* You need a provider or model that requires your own credentials.

## Next steps

* [Credits](https://ngrok.com/docs/ai-gateway/concepts/credits.md): Learn how credits work
* [Choose a model](https://ngrok.com/docs/ai-gateway/guides/model-selection-strategies.md): Choose model IDs and provider-qualified models
* [Bring your own provider key](https://ngrok.com/docs/ai-gateway/guides/attaching-provider-keys.md): Use your own upstream provider credentials


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