# Using RainDragon with AI Gateways

Source: https://inference.raindragon.ai/gateways (Markdown: https://inference.raindragon.ai/gateways.md; index of all docs: https://inference.raindragon.ai/llms.txt)

Route requests to RainDragon through Cloudflare AI Gateway, Portkey, Helicone or Bifrost

RainDragon's API is OpenAI-compatible, so each gateway below can use it as a custom OpenAI-style provider. You keep your gateway's logging, caching and fallbacks; requests are billed to your RainDragon API key. Models: `google/gemma-4-26B-A4B-it` and `google/gemma-4-31B-it`.

## Cloudflare AI Gateway

In the Cloudflare dashboard go to **AI Gateway > Custom Providers > Add Custom Provider** and enter:

```
Name:     RainDragon
Slug:     raindragon
Base URL: https://inference.raindragon.ai
```

Use the root domain as the base URL (no `/v1`); the path goes in the request. Then call it through your gateway:

```
curl https://gateway.ai.cloudflare.com/v1/$ACCOUNT_ID/$GATEWAY_ID/custom-raindragon/v1/chat/completions \
  -H "Authorization: Bearer your-api-key" \
  -H "cf-aig-authorization: Bearer $CF_AIG_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"model": "google/gemma-4-26B-A4B-it", "messages": [{"role": "user", "content": "Hello!"}]}'
```

With the OpenAI Python SDK:

```
from openai import OpenAI

client = OpenAI(
    api_key="your-api-key",
    base_url="https://gateway.ai.cloudflare.com/v1/ACCOUNT_ID/GATEWAY_ID/custom-raindragon/v1",
    default_headers={"cf-aig-authorization": "Bearer CF_AIG_TOKEN"},
)

response = client.chat.completions.create(
    model="google/gemma-4-26B-A4B-it",
    messages=[{"role": "user", "content": "Hello!"}],
)
```

The `cf-aig-authorization` header is only needed if your gateway has authentication turned on.

## Portkey

Use Portkey's OpenAI provider and point its custom host at RainDragon:

```
curl https://api.portkey.ai/v1/chat/completions \
  -H "x-portkey-api-key: $PORTKEY_API_KEY" \
  -H "x-portkey-provider: openai" \
  -H "x-portkey-custom-host: https://inference.raindragon.ai/v1" \
  -H "Authorization: Bearer your-api-key" \
  -H "Content-Type: application/json" \
  -d '{"model": "google/gemma-4-26B-A4B-it", "messages": [{"role": "user", "content": "Hello!"}]}'
```

With the Portkey Python SDK:

```
from portkey_ai import Portkey

client = Portkey(
    api_key="PORTKEY_API_KEY",
    provider="openai",
    custom_host="https://inference.raindragon.ai/v1",
    Authorization="Bearer your-api-key",
)

response = client.chat.completions.create(
    model="google/gemma-4-26B-A4B-it",
    messages=[{"role": "user", "content": "Hello!"}],
)
```

For the self-hosted open-source gateway, send the same headers to `http://localhost:8787/v1/chat/completions` and drop `x-portkey-api-key`.

## Helicone

Send requests to Helicone's gateway and name RainDragon as the target with the `Helicone-Target-Url` header:

```
curl https://gateway.helicone.ai/v1/chat/completions \
  -H "Authorization: Bearer your-api-key" \
  -H "Helicone-Auth: Bearer $HELICONE_API_KEY" \
  -H "Helicone-Target-Url: https://inference.raindragon.ai" \
  -H "Content-Type: application/json" \
  -d '{"model": "google/gemma-4-26B-A4B-it", "messages": [{"role": "user", "content": "Hello!"}]}'
```

With the OpenAI Python SDK:

```
from openai import OpenAI

client = OpenAI(
    api_key="your-api-key",
    base_url="https://gateway.helicone.ai/v1",
    default_headers={
        "Helicone-Auth": "Bearer HELICONE_API_KEY",
        "Helicone-Target-Url": "https://inference.raindragon.ai",
    },
)
```

## Bifrost

Add RainDragon as a custom provider in Bifrost's `config.json`, using the `openai` base type:

```
{
  "providers": {
    "raindragon": {
      "network_config": {
        "base_url": "https://inference.raindragon.ai"
      },
      "keys": [
        {
          "name": "raindragon-key-1",
          "value": "env.RAINDRAGON_API_KEY",
          "models": ["*"],
          "weight": 1.0
        }
      ],
      "custom_provider_config": {
        "base_provider_type": "openai"
      }
    }
  }
}
```

Set your key, start Bifrost, and prefix the model with the provider name:

```
export RAINDRAGON_API_KEY="your-api-key"

curl http://localhost:8080/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{"model": "raindragon/google/gemma-4-26B-A4B-it", "messages": [{"role": "user", "content": "Hello!"}]}'
```

If Bifrost answers `virtual key is required`, either send an `x-bf-vk` header with a virtual key that allows the `raindragon` provider, or turn off `client.enforce_auth_on_inference` in `config.json` (Enforce Virtual Keys on Inference in the UI).

Generate API keys in your dashboard under API Settings.
