Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Comprehensive Cloudflare platform skill covering Workers, D1, R2, KV, AI, Durable Objects, and security.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
references/ai-gateway/features.md
1# Features & Capabilities23## Caching45Dashboard: Settings → Cache Responses → Enable67```typescript8// Custom TTL (1 hour)9headers: { 'cf-aig-cache-ttl': '3600' }1011// Skip cache12headers: { 'cf-aig-skip-cache': 'true' }1314// Custom cache key15headers: { 'cf-aig-cache-key': 'greeting-en' }16```1718**Limits:** TTL 60s - 30 days. **Does NOT work with streaming.**1920## Rate Limiting2122Dashboard: Settings → Rate-limiting → Enable2324- **Fixed window:** Resets at intervals25- **Sliding window:** Rolling window (more accurate)26- Returns `429` when exceeded2728## Guardrails2930Dashboard: Settings → Guardrails → Enable3132Filter prompts/responses for inappropriate content. Actions: Flag (log) or Block (reject).3334## Data Loss Prevention (DLP)3536Dashboard: Settings → DLP → Enable3738Detect PII (emails, SSNs, credit cards). Actions: Flag, Block, or Redact.3940## Billing Modes4142| Mode | Description | Setup |43|------|-------------|-------|44| **Unified Billing** | Pay through Cloudflare, no provider keys | Use `cf-aig-authorization` header only |45| **BYOK** | Store provider keys in dashboard | Add keys in Provider Keys section |46| **Pass-through** | Send provider key with each request | Include provider's auth header |4748## Zero Data Retention4950Dashboard: Settings → Privacy → Zero Data Retention5152No prompts/responses stored. Request counts and costs still tracked.5354## Logging5556Dashboard: Settings → Logs → Enable (up to 10M logs)5758Each entry: prompt, response, provider, model, tokens, cost, duration, cache status, metadata.5960```typescript61// Skip logging for request62headers: { 'cf-aig-collect-log': 'false' }63```6465**Export:** Use Logpush to S3, GCS, Datadog, Splunk, etc.6667## Custom Cost Tracking6869For models not in Cloudflare's pricing database:7071Dashboard: Gateway → Settings → Custom Costs7273Or via API: set `model`, `input_cost`, `output_cost`.7475## Supported Providers (22+)7677| Provider | Unified API | Notes |78|----------|-------------|-------|79| OpenAI | `openai/gpt-4o` | Full support |80| Anthropic | `anthropic/claude-sonnet-4-5` | Full support |81| Google AI | `google-ai-studio/gemini-2.0-flash` | Full support |82| Workers AI | `workersai/@cf/meta/llama-3` | Native |83| Azure OpenAI | `azure-openai/*` | Deployment names |84| AWS Bedrock | Provider endpoint only | `/bedrock/*` |85| Groq | `groq/*` | Fast inference |86| Mistral, Cohere, Perplexity, xAI, DeepSeek, Cerebras | Full support | - |8788## Best Practices89901. Enable caching for deterministic prompts912. Set rate limits to prevent abuse923. Use guardrails for user-facing AI934. Enable DLP for sensitive data945. Use unified billing or BYOK for simpler key management956. Enable logging for debugging967. Use zero data retention when privacy required97