# Gateways and proxies

> Route a provider's requests through your own LiteLLM proxy, egress proxy, or AI gateway, with custom headers.

Route a provider's requests through your own host, such as a LiteLLM proxy, a corporate egress proxy or an AI gateway, while keeping your normal model selection. Set the base URL under **Set up a proxy or gateway** on the provider's setup card, or in your workflow `env:`:

| Provider | Variable | Default base URL | Request |
| --- | --- | --- | --- |
| Anthropic | `ANTHROPIC_BASE_URL` | `https://api.anthropic.com` | `POST /v1/messages` |
| OpenAI | `OPENAI_BASE_URL` | `https://api.openai.com/v1` | `POST /responses` |
| Google | `GEMINI_BASE_URL` | `https://generativelanguage.googleapis.com/v1beta` | `POST /models/<model>:streamGenerateContent` |
| xAI | `XAI_BASE_URL` | `https://api.x.ai/v1` | `POST /responses` |
| DeepSeek | `DEEPSEEK_BASE_URL` | `https://api.deepseek.com/v1` | `POST /chat/completions` |
| Moonshot AI | `MOONSHOT_BASE_URL` | `https://api.moonshot.ai/v1` | `POST /chat/completions` |
| Kimi Code | `KIMI_BASE_URL` | `https://api.kimi.com/coding/v1` | `POST /chat/completions` |
| Meta | `META_MODEL_BASE_URL` | `https://api.meta.ai/v1` | `POST /responses` |

The base URL replaces the default one, path included, and the request path is appended to it. The gateway receives the provider's own model IDs and API key.

- Under [Smart](https://pullfrog.com/docs/models#smart), every rung of the provider's ladder goes through the gateway, so it has to serve each rung's model ID. Pullfrog moves a rung to a newer model when one ships, and the gateway has to serve that ID too.
- Pullfrog skips its pre-run credential check for a gateway, so a gateway that refuses the credential reports its own error in the run.
- With an API key and a Claude or Grok subscription both connected, a run through the gateway pays with the API key. A subscription with no API key beside it is sent to the gateway.
- A credential embedded in the base URL is not treated as one.
- Google, xAI, DeepSeek, Moonshot AI, Kimi Code and Meta need Pullfrog 0.1.131 or later.

Other providers take other routes. [Azure OpenAI](https://pullfrog.com/docs/azure) builds its endpoint from `AZURE_RESOURCE_NAME`, and a gateway with its own model list belongs on [OpenAI-compatible endpoints](https://pullfrog.com/docs/openai-compatible).

## Anthropic

Anthropic models run through Claude Code, which honors `ANTHROPIC_BASE_URL` natively and talks to the gateway in Anthropic's own format, so prompt caching and extended thinking survive the hop.

Pick the credential variable by the header your gateway reads. A gateway that reads the other header answers `401`.

**x-api-key**, `.github/workflows/pullfrog.yml`:

```yaml
env:
  ANTHROPIC_BASE_URL: https://gateway.internal.example.com
  ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
```

**Authorization: Bearer**, `.github/workflows/pullfrog.yml`:

```yaml
env:
  ANTHROPIC_BASE_URL: https://gateway.internal.example.com
  ANTHROPIC_AUTH_TOKEN: ${{ secrets.GATEWAY_TOKEN }}
```

This route serves Claude models only. Anthropic [doesn't support routing Claude Code to non-Claude models through a gateway](https://code.claude.com/docs/en/llm-gateway), so use [OpenAI-compatible endpoints](https://pullfrog.com/docs/openai-compatible) for a provider's `/anthropic` endpoint that serves its own models.

## OpenAI

The `OPENAI_BASE_URL` variable re-points the OpenAI provider, which speaks the **Responses API** (`POST /v1/responses`). Point it at a gateway that serves that endpoint.

`.github/workflows/pullfrog.yml`:

```yaml
env:
  OPENAI_BASE_URL: https://gateway.internal.example.com/v1
  OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
```

Most third-party gateways speak the older Chat Completions API (`POST /v1/chat/completions`), which is what "OpenAI-compatible" usually means. For one of those, use [OpenAI-compatible endpoints](https://pullfrog.com/docs/openai-compatible) instead.

## Custom headers

A gateway can require more than a key, such as the service token of an access proxy. Set its extra headers under **Send custom headers** on the provider's setup card, or in your workflow `env:`, one `Name: Value` per line:

| Endpoint | Variable |
| --- | --- |
| Anthropic gateway | `ANTHROPIC_CUSTOM_HEADERS` |
| OpenAI gateway | `OPENAI_CUSTOM_HEADERS` |
| Google gateway | `GEMINI_CUSTOM_HEADERS` |
| xAI gateway | `XAI_CUSTOM_HEADERS` |
| DeepSeek gateway | `DEEPSEEK_CUSTOM_HEADERS` |
| Moonshot AI gateway | `MOONSHOT_CUSTOM_HEADERS` |
| Kimi Code gateway | `KIMI_CUSTOM_HEADERS` |
| Meta gateway | `META_MODEL_CUSTOM_HEADERS` |
| [OpenAI-compatible endpoint](https://pullfrog.com/docs/openai-compatible#custom-headers) | `OPENAI_COMPATIBLE_HEADERS` |

An OpenAI gateway behind Cloudflare Access takes two:

`.github/workflows/pullfrog.yml`:

```yaml
env:
  OPENAI_BASE_URL: https://gateway.internal.example.com/v1
  OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
  OPENAI_CUSTOM_HEADERS: |
    CF-Access-Client-Id: ${{ secrets.CF_ACCESS_CLIENT_ID }}
    CF-Access-Client-Secret: ${{ secrets.CF_ACCESS_CLIENT_SECRET }}
```

Each variable applies to its own endpoint and no other. A run that moves to another provider, through `--model` or a fallback, leaves the headers behind.

Pullfrog treats the variables as secrets and masks them in logs. A line that isn't a header fails the run before the agent starts, and the error names the line number. Custom headers need Pullfrog 0.1.122 or later, except `ANTHROPIC_CUSTOM_HEADERS` on Claude Code, which reads that variable itself.
