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

# Custom Providers

> Connect custom endpoints and self-hosted models to the AI Gateway.

**Custom providers** are upstream endpoints you define, such as self-hosted Ollama or vLLM, a private deployment, or any OpenAI- or Anthropic-compatible API not in the [built-in catalog](/ai-gateway/reference/model-catalog).

Use a custom provider when you want the AI Gateway to call a model running on your machine, private network, or cloud GPU.

Traffic still authenticates to the gateway with an [access key](/ai-gateway/concepts/access-keys). Attach provider keys and routing rules through an [access key configuration](/ai-gateway/guides/access-key-configurations).

## When to use one

Use a custom provider when:

* You run models locally with Ollama, LM Studio, or vLLM.
* You host models on your own cloud infrastructure.
* You have a private OpenAI- or Anthropic-compatible API.
* You need a provider that isn't in the built-in catalog.

## What a custom provider defines

A custom provider tells the gateway:

* Which provider ID to use in requests, such as `my-ollama`.
* Which base URL to call, such as `https://my-ollama.internal`.
* Which API surface the endpoint supports.
* Which model IDs are available.

You call custom provider models with the same `provider:model` format as built-in providers:

```json theme={null}
{
  "model": "my-ollama:llama3.2",
  "messages": [{"role": "user", "content": "Hello"}]
}
```

## URL requirements

| URL type       | Scheme                  | Example                       |
| -------------- | ----------------------- | ----------------------------- |
| External       | `https://` only         | `https://api.example.com/v1`  |
| ngrok internal | `http://` or `https://` | `https://my-service.internal` |

HTTP is only allowed for ngrok `.internal` endpoints. External URLs must use HTTPS.

## Self-hosted on a local network

To reach models on your machine or private network, expose the service with an ngrok internal endpoint, then use that URL as the custom provider's `baseUrl`. Reaching internal endpoints may require a ngrok platform plan. See [Credits](/ai-gateway/concepts/credits).

For the full setup flow, see [Use a model you run yourself](/ai-gateway/guides/use-a-model-you-run-yourself).

## Next steps

* [Use a model you run yourself](/ai-gateway/guides/use-a-model-you-run-yourself): Connect a local or private model
* [Ollama guide](/ai-gateway/custom-providers/ollama): Connect Ollama
* [Access key configurations](/ai-gateway/guides/access-key-configurations): Attach keys and scope access
* [Model catalog](/ai-gateway/reference/model-catalog): Built-in providers and models
