## Overview

The Barndoor **LLM Gateway** is a proxy that sits between your AI tools and one or more upstream LLM providers (OpenAI, Anthropic, Azure OpenAI, AWS Bedrock, Google Vertex AI, and many more). It speaks both the **OpenAI Chat Completions / Responses / Embeddings** APIs and the **Anthropic Messages** API natively, so most clients — including OpenAI’s and Anthropic’s SDKs, Cursor, Claude Code, Codex, LangChain, and similar tools — work simply by pointing their base URL at Barndoor. Pointing your client at the gateway gives you a single endpoint that:

- **Centralizes provider credentials** — provider API keys stay in Barndoor, never on developer machines.
- **Enforces governance** — rate limits, token budgets, and per-user / per-team model access policies.
- **Routes intelligently** — model routes, multi-provider failover, and automatic retries on transient 429s.
- **Records usage** — per-request token, cost, and latency telemetry surfaced in the Barndoor portal.

Anything that speaks the OpenAI Chat Completions / Embeddings / Responses API can use the gateway by setting `base_url`. Clients that prefer Anthropic’s Messages API (for example **Claude Code**) can talk to the gateway directly as well.

## Architecture at a Glance

Bearer bd-…  
OpenAI / Anthropic JSON  
Barndoor LLM Gateway  
API-key auth  
Model access policies  
Rate limits & budgets  
Routing, retry & failover  
Your client  
Cursor • Claude Code • Codex • SDK • curl  
OpenAI  
Anthropic  
Azure OpenAI  
AWS Bedrock  
Google Vertex AI  
…and other supported providers

## Before You Begin

You’ll need:

- A Barndoor account with access to the **LLM Management** area (admin) and/or the **My Models** settings page (any user).
- The base URL of your Barndoor portal. Throughout this guide we use `https://app.barndoor.ai` (the Barndoor SaaS host). The authoritative value for your tenant is shown in the **LLM Gateway Endpoint** card on **Settings → My Models** — copy it from there.
- For **admins** setting up the gateway for the first time: an upstream provider account (OpenAI, Anthropic, etc.) and credentials for it.

The LLM Gateway is being rolled out per tenant. If you don’t see the **LLM Management** or **My Models** menu items, contact your Barndoor admin or support@barndoor.ai to have it enabled for your organization.

**Self-hosted and private-cloud deployments:** if Barndoor is running on your own infrastructure, swap `app.barndoor.ai` for your organization’s portal hostname everywhere in this guide. The path (`/api/llm-gateway/v1`) is the same.

## Next Steps

Ready to set up the gateway and send your first request? Continue to the **Quickstart Guide**, which covers:

- A two-minute quickstart (get a key, find your endpoint, send a request).
- Admin configuration — credentials, providers, models, pricing, and model routes.
- Connecting your tools — Cursor, Claude Code, Codex, and the OpenAI/Anthropic SDKs.
- Sending requests, observability headers, failover, troubleshooting, and FAQ.

For Codex CLI and Codex Desktop specifically (Responses wire format, `config.toml`, and the `/v1` base-URL footgun), see **Use Codex with the LLM Gateway**.
