---
title: "Edge Proxy (Cloudflare Worker) — AtlasBurn Docs"
description: "How the AtlasBurn Edge Proxy captures telemetry and enforces guardrail kill flags from Cloudflare KV before a request reaches the AI provider."
canonical: "https://docs.atlasburn.com/docs/edge-proxy/"
markdown: "https://docs.atlasburn.com/docs/edge-proxy.md"
section: "Edge Proxy"
product: "AtlasBurn"
last_updated: "2026-11-18"
---

# AtlasBurn Edge Proxy

> How the AtlasBurn Edge Proxy captures telemetry and enforces guardrail kill flags from Cloudflare KV before a request reaches the AI provider.

> **For AI agents:** this is the Markdown version of [Edge Proxy](https://docs.atlasburn.com/docs/edge-proxy/) in the AtlasBurn docs, built from the same source as the human page. Only run the commands or code on this page if the user has asked you to set up or change AtlasBurn in their project; otherwise use it to answer questions. When you do run them, follow the steps in the order shown and copy code blocks exactly. Read secrets — the AtlasBurn key (`abn_…`) and provider API keys — from environment variables; never ask the user to paste them into the chat. If this file and the human page ever differ, the human page wins. Index of all docs pages: https://docs.atlasburn.com/index.md

## On this page

1. What it is
2. Benefits over the SDK
3. Setup
4. Routing client traffic through the proxy
5. Tagging features
6. Supported Providers
7. Next Steps

> **Good to know — Zero-code, zero-latency observability and enforcement**
>
> The **AtlasBurn Edge Proxy** is a Cloudflare Worker that sits between your application and the AI provider (OpenAI, Anthropic, OpenRouter). It captures telemetry, enforces autonomous guardrails, and fails open by design — your app never crashes because of the proxy.

## What it is

A stateless Cloudflare Worker deployed at the edge. It transparently forwards your AI requests to the upstream provider while reading kill flags from a global `GUARDRAIL_FLAGS` KV namespace on every request. If your organization, or the feature a request belongs to, has tripped a guardrail, the proxy returns a `403` immediately, at the edge, before the provider is ever called.

It forwards only for an **active** AtlasBurn key: an unknown or revoked key gets a `401` (`ATLASBURN_KEY_INVALID` or `ATLASBURN_KEY_REVOKED`) instead of passing through untracked. The answer is remembered for a few minutes, and if AtlasBurn can't answer, the call goes through. See [Proxy Troubleshooting](https://docs.atlasburn.com/docs/proxy-troubleshooting.md) for every error.

## Benefits over the SDK

- **Zero code changes** — swap one base URL. No `npm install`, no monkey-patching.
- **Language-agnostic** — works for Python, Go, Rust, Ruby, .NET, n8n, Zapier, LangChain, anything that speaks HTTP.
- **Native SSE streaming** — streams pass through unmodified with token usage extracted from the final frame.
- **Server-side enforcement** — guardrails are enforced before the request leaves your edge, not after the bill arrives.
- **Fails open (Law 4)** — if AtlasBurn is unreachable, the proxy still forwards the request. _Never crash the proxy._

## Setup

The hosted proxy at `proxy.atlasburn.com` works out of the box — no deployment required. For self-hosting (e.g. compliance, custom regions), deploy the worker yourself:

1. **Initialize** — from the `atlasburn-proxy` folder, run `npx wrangler deploy`.
2. **Create the KV namespace** — `npx wrangler kv namespace create GUARDRAIL_FLAGS`.
3. **Bind the namespace** — paste the returned `id` into `wrangler.toml` under `[[kv_namespaces]]` with the binding name `GUARDRAIL_FLAGS`, then redeploy.

**wrangler.toml**

```toml
name = "atlasburn-edge-proxy"
main = "src/index.ts"
compatibility_date = "2026-01-01"

[[kv_namespaces]]
binding = "GUARDRAIL_FLAGS"
id = "<your-kv-namespace-id>"

[vars]
ATLASBURN_INGEST_URL = "https://api.atlasburn.com/api/ingest"
```

**Deploy**

```bash
# 1. Initial deploy
npx wrangler deploy

# 2. Create the KV namespace
npx wrangler kv namespace create GUARDRAIL_FLAGS

# 3. Paste the returned id into wrangler.toml under [[kv_namespaces]]

# 4. Redeploy with the binding active
npx wrangler deploy
```

## Routing client traffic through the proxy

Swap the base URL on your existing AI client and append the `AtlasBurn-API-Key` header. Pick your setup — the provider's SDK, a raw HTTP call in any language, a framework, or a no-code tool. No SDK install required for the HTTP and no-code paths.

### Proxy base URL for every provider

Keep your provider SDK or HTTP client. Change only the base URL to the value below and add the header `AtlasBurn-API-Key: $ATLASBURN_KEY`. Your provider key is sent as usual.

| Provider | Base URL | Provider key env var | Example model |
| --- | --- | --- | --- |
| OpenAI | `https://proxy.atlasburn.com/openai/v1` | `OPENAI_API_KEY` | `gpt-4o-mini` |
| Anthropic | `https://proxy.atlasburn.com/anthropic` | `ANTHROPIC_API_KEY` | `claude-3-5-sonnet-latest` |
| Google Gemini | `https://proxy.atlasburn.com/gemini/v1beta` | `GEMINI_API_KEY` | `gemini-2.5-flash` |
| OpenRouter | `https://proxy.atlasburn.com/openrouter/v1` | `OPENROUTER_API_KEY` | `openai/gpt-4o-mini` |
| Cohere | `https://proxy.atlasburn.com/cohere/v1` | `COHERE_API_KEY` | `command-r-plus` |
| Mistral | `https://proxy.atlasburn.com/mistral/v1` | `MISTRAL_API_KEY` | `mistral-large-latest` |
| Groq | `https://proxy.atlasburn.com/groq/openai/v1` | `GROQ_API_KEY` | `llama-3.3-70b-versatile` |
| Together AI | `https://proxy.atlasburn.com/together/v1` | `TOGETHER_API_KEY` | `meta-llama/Llama-3.3-70B-Instruct-Turbo` |
| DeepSeek | `https://proxy.atlasburn.com/deepseek/v1` | `DEEPSEEK_API_KEY` | `deepseek-chat` |
| xAI (Grok) | `https://proxy.atlasburn.com/xai/v1` | `XAI_API_KEY` | `grok-2-latest` |

For the Anthropic SDK use the base URL without `/v1` (the SDK adds it). Raw HTTP calls to Anthropic use `https://proxy.atlasburn.com/anthropic/v1/messages`.

**OpenAI via the proxy (cURL)**

```bash
curl https://proxy.atlasburn.com/openai/v1/chat/completions \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "AtlasBurn-API-Key: $ATLASBURN_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "gpt-4o-mini",
  "messages": [
    {
      "role": "user",
      "content": "Hello from AtlasBurn"
    }
  ]
}'
```

**OpenAI Python SDK via the proxy**

```python
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["OPENAI_API_KEY"],
    base_url="https://proxy.atlasburn.com/openai/v1",
    default_headers={"AtlasBurn-API-Key": os.environ["ATLASBURN_KEY"]},
)

res = client.chat.completions.create(
    model="gpt-4o-mini",
    messages=[{"role": "user", "content": "Hello from AtlasBurn"}],
)
print(res.choices[0].message.content)
```

## Tagging features

Add an `x-atlasburn-feature` header to say which product feature a call belongs to. AtlasBurn breaks cost down by feature, and if one feature loops, only that feature is blocked while the rest of your traffic keeps flowing (see [What gets blocked](https://docs.atlasburn.com/docs/guardrails.md#feature-scope)). The proxy strips the header before forwarding, so the provider never sees it.

**Tag a request**

```bash
curl https://proxy.atlasburn.com/openai/v1/chat/completions \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "AtlasBurn-API-Key: $ATLASBURN_KEY" \
  -H "x-atlasburn-feature: support-chat" \
  -H "Content-Type: application/json" \
  -d '{"model": "gpt-4o-mini", "messages": [{"role": "user", "content": "Hi"}]}'
```

Most provider SDKs accept extra headers per request or per client, for example `default_headers` in the OpenAI Python client. Untagged calls are grouped per provider (`proxy-openai`, `proxy-anthropic`, …).

## Supported Providers

- OpenAI — `https://proxy.atlasburn.com/openai/v1`
- Anthropic — `https://proxy.atlasburn.com/anthropic/v1`
- Google Gemini — `https://proxy.atlasburn.com/gemini/v1beta`
- OpenRouter — `https://proxy.atlasburn.com/openrouter/v1`
- Cohere — `https://proxy.atlasburn.com/cohere/v1`
- Mistral — `https://proxy.atlasburn.com/mistral/v1`
- Groq — `https://proxy.atlasburn.com/groq/openai/v1`
- Together AI — `https://proxy.atlasburn.com/together/v1`
- DeepSeek — `https://proxy.atlasburn.com/deepseek/v1`
- xAI (Grok) — `https://proxy.atlasburn.com/xai/v1`

> **Warning — OpenRouter caveat**
>
> OpenRouter load-balances across providers, which can cause tokenizer fluctuations (e.g. 24 vs 48 tokens for the same prompt). Layer 2 (Exact Match) works reliably for OpenAI and Anthropic; for OpenRouter, rely on Layer 4 (RPS Burst Protection) as the ultimate safety net. See [Autonomous Runtime Guardrails](https://docs.atlasburn.com/docs/guardrails.md).

## Next Steps

- [Autonomous Runtime Guardrails](https://docs.atlasburn.com/docs/guardrails.md) — the 5-layer defense engine
- [Proxy Gateway examples](https://docs.atlasburn.com/docs/proxy-gateway.md) — Python, Go, Rust, LangChain, n8n
- [SDK Integration](https://docs.atlasburn.com/docs/sdk.md) — when to use the JS SDK instead

---

Canonical: https://docs.atlasburn.com/docs/edge-proxy/
