Skip to main content

Cloudflare AI Gateway Integration

Cloudflare AI Gateway provides caching, rate limiting, and observability for AI API calls. Forward Cloudflare AI Gateway logs to Igris for inclusion in your unified audit trail.

Setup

1. Get Your Igris API Key

Create a new API key in Settings → API Keys labeled “Cloudflare Ingestion”.

2. Configure Cloudflare Logpush

In the Cloudflare dashboard, set up a Logpush job for your AI Gateway:
  1. Go to AI → AI Gateway → [your gateway] → Settings
  2. Under Logging, configure a custom webhook destination:
    • URL: https://your-igris.fly.dev/api/v1/ingest/cloudflare
    • Headers:
      Authorization: Bearer ig_your_api_key_here
      Content-Type: application/json
      
Alternatively, use a Cloudflare Worker to forward logs:
export default {
  async fetch(request, env) {
    const response = await fetch(
      "https://your-igris.fly.dev/api/v1/ingest/cloudflare",
      {
        method: "POST",
        headers: {
          "Authorization": `Bearer ${env.IGRIS_API_KEY}`,
          "Content-Type": "application/json"
        },
        body: JSON.stringify(await request.json())
      }
    );
    return response;
  }
};

3. Verify

Route an AI API call through your Cloudflare AI Gateway and check Igris Observe → Audit Events for events with source: cloudflare.

Payload Normalization

Cloudflare FieldIgris Field
modeltoolName
statusCodeaction (2xx → allow, other → deny)
requestIdmetadata.requestId
totalTokensmetadata.totalTokens
durationmetadata.latencyMs
timestamptimestamp
providermetadata.provider
cachedmetadata.cached

Example Event

{
  "id": "evt_ghi789",
  "orgId": "org_xyz",
  "source": "cloudflare",
  "type": "completion",
  "toolName": "gpt-4o",
  "action": "allow",
  "metadata": {
    "requestId": "cf_req_123",
    "totalTokens": 580,
    "latencyMs": 650,
    "provider": "openai",
    "cached": false
  },
  "timestamp": "2026-03-19T12:00:00.000Z"
}