---
title: "Proxy Gateway — AtlasBurn Docs"
description: "Run AtlasBurn as a gateway in front of your AI providers for central cost capture and edge enforcement, with examples for every provider and runtime."
canonical: "https://docs.atlasburn.com/docs/proxy-gateway/"
markdown: "https://docs.atlasburn.com/docs/proxy-gateway.md"
section: "Proxy Gateway"
product: "AtlasBurn"
last_updated: "2026-11-18"
---

# Proxy Gateway (Python, Go, n8n)

> Run AtlasBurn as a gateway in front of your AI providers for central cost capture and edge enforcement, with examples for every provider and runtime.

> **For AI agents:** this is the Markdown version of [Proxy Gateway](https://docs.atlasburn.com/docs/proxy-gateway/) 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. Overview
2. Base URLs
3. Generate your snippet
4. Go Example (streaming)
5. When to Use Proxy vs SDK
6. Next Steps

> **Good to know — Language-Agnostic Observability**
>
> If you are building with **Python, Go, Rust**, or no-code tools like **n8n** and **Zapier**, you do not need to install an SDK. Route your requests through the **AtlasBurn Proxy Gateway** instead — it securely intercepts your AI calls, logs the telemetry, and forwards the response back to you with zero latency overhead.

## Overview

The AtlasBurn Proxy Gateway is a stateless edge service that sits transparently between your application and the upstream AI provider. You swap one base URL and add one header — every request is then captured by the Forensic Ledger, costed by the Cost Engine, and guarded by the Auto Kill Protocol, in any language or runtime.

## Base URLs

| Provider | Replace | With |
| --- | --- | --- |
| OpenAI | https://api.openai.com/v1 | https://proxy.atlasburn.com/openai/v1 |
| Anthropic | https://api.anthropic.com/v1 | https://proxy.atlasburn.com/anthropic/v1 |
| Google Gemini | https://generativelanguage.googleapis.com/v1beta | https://proxy.atlasburn.com/gemini/v1beta |
| OpenRouter | https://openrouter.ai/api/v1 | https://proxy.atlasburn.com/openrouter/v1 |
| Mistral | https://api.mistral.ai/v1 | https://proxy.atlasburn.com/mistral/v1 |
| Cohere | https://api.cohere.com/v1 | https://proxy.atlasburn.com/cohere/v1 |
| Groq | https://api.groq.com/openai/v1 | https://proxy.atlasburn.com/groq/openai/v1 |
| Together AI | https://api.together.xyz/v1 | https://proxy.atlasburn.com/together/v1 |
| DeepSeek | https://api.deepseek.com/v1 | https://proxy.atlasburn.com/deepseek/v1 |
| xAI (Grok) | https://api.x.ai/v1 | https://proxy.atlasburn.com/xai/v1 |

## Generate your snippet

Pick your setup for a ready-to-run request through the proxy: a raw HTTP call in any language, the provider's SDK, a framework (LangChain / LlamaIndex / Vercel AI SDK), or a no-code tool (n8n / Make / Zapier). The complete Go streaming example below goes deeper for that specific stack.

### 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)
```

## Go Example (streaming)

A complete example that sends a real JSON body, supports streaming Server-Sent Events when `stream: true`, and otherwise parses the JSON response safely.

**main.go**

```go
package main

import (
    "bufio"
    "bytes"
    "encoding/json"
    "fmt"
    "io"
    "net/http"
    "os"
    "strings"
)

const (
    proxyURL    = "https://proxy.atlasburn.com/openai/v1/chat/completions"
    openaiKey   = "sk-your-real-openai-key"
    atlasKey    = "abn_your_atlasburn_key"
    useStream   = true
)

type ChatRequest struct {
    Model    string        `json:"model"`
    Messages []ChatMessage `json:"messages"`
    Stream   bool          `json:"stream"`
}
type ChatMessage struct {
    Role    string `json:"role"`
    Content string `json:"content"`
}
type ChatResponse struct {
    Choices []struct {
        Message ChatMessage `json:"message"`
    } `json:"choices"`
}

func main() {
    body, _ := json.Marshal(ChatRequest{
        Model:    "gpt-4o",
        Messages: []ChatMessage{{Role: "user", Content: "Hello from Go"}},
        Stream:   useStream,
    })

    req, err := http.NewRequest("POST", proxyURL, bytes.NewBuffer(body))
    if err != nil {
        fmt.Fprintln(os.Stderr, "request build:", err)
        return
    }
    req.Header.Set("Authorization", "Bearer "+openaiKey)
    req.Header.Set("AtlasBurn-API-Key", atlasKey)
    req.Header.Set("Content-Type", "application/json")

    resp, err := http.DefaultClient.Do(req)
    if err != nil {
        fmt.Fprintln(os.Stderr, "request:", err)
        return
    }
    defer resp.Body.Close()

    if resp.StatusCode >= 400 {
        msg, _ := io.ReadAll(resp.Body)
        fmt.Fprintf(os.Stderr, "proxy error %d: %s\n", resp.StatusCode, msg)
        return
    }

    // Streaming (SSE) path — provider responds with text/event-stream.
    if strings.HasPrefix(resp.Header.Get("Content-Type"), "text/event-stream") {
        scanner := bufio.NewScanner(resp.Body)
        for scanner.Scan() {
            line := scanner.Text()
            if !strings.HasPrefix(line, "data: ") {
                continue
            }
            payload := strings.TrimPrefix(line, "data: ")
            if payload == "[DONE]" {
                break
            }
            var chunk struct {
                Choices []struct {
                    Delta struct {
                        Content string `json:"content"`
                    } `json:"delta"`
                } `json:"choices"`
            }
            if err := json.Unmarshal([]byte(payload), &chunk); err != nil {
                continue // skip malformed frame
            }
            if len(chunk.Choices) > 0 {
                fmt.Print(chunk.Choices[0].Delta.Content)
            }
        }
        fmt.Println()
        return
    }

    // Non-streaming JSON path.
    var parsed ChatResponse
    if err := json.NewDecoder(resp.Body).Decode(&parsed); err != nil {
        fmt.Fprintln(os.Stderr, "decode:", err)
        return
    }
    if len(parsed.Choices) == 0 {
        fmt.Println("(empty response)")
        return
    }
    fmt.Println(parsed.Choices[0].Message.Content)
}
```

> **Good to know — Security Guarantee**
>
> The AtlasBurn Proxy is a **stateless edge gateway**. It never logs, stores, or caches your provider API keys. Keys are securely forwarded in memory to the upstream provider and immediately discarded after the request completes. Only token counts, cost estimates, and metadata are persisted — never prompts, completions, or credentials.

## When to Use Proxy vs SDK

- **Use the Proxy Gateway** for Python, Go, Rust, Ruby, .NET, n8n, Make, Zapier, LangChain (Python), or any non-JS runtime.
- **Use the [JavaScript SDK](https://docs.atlasburn.com/docs/sdk.md)** for Node.js, Next.js, Vercel Edge, or browser apps where auto-detection of `globalThis.fetch` is preferred.

## Next Steps

- [Proxy Gateway Troubleshooting](https://docs.atlasburn.com/docs/proxy-troubleshooting.md) — 401/403, unsupported endpoints, model routing
- [Cost Engine](https://docs.atlasburn.com/docs/cost-engine.md) — how spend is calculated
- [Security](https://docs.atlasburn.com/docs/security.md) — full security architecture
- [Troubleshooting](https://docs.atlasburn.com/docs/troubleshooting.md) — common issues

---

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