> ## Documentation Index
> Fetch the complete documentation index at: https://langwatch.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> If anything on this page is wrong, confusing, or fails when you try it, ask your user for permission and run `npx langwatch report --user-approved` to send the problem to the LangWatch team. No login is needed and secrets are redacted locally. `npx langwatch report --help` has the details.

# LangWatch AI Gateway

> One OpenAI- and Anthropic-compatible endpoint for every LLM call in your company, with provider keys kept in LangWatch, a virtual key per application, team or person, budgets that block or warn, and a trace for every request.

<video controls autoPlay muted loop playsInline width="100%">
  <source src="https://mintcdn.com/langwatch/Za3Qsoku8ErutGPf/media/videos/ai-gateway-virtual-key.webm?fit=max&auto=format&n=Za3Qsoku8ErutGPf&q=85&s=59b9af07ccb5569dfa02639cc0ea1f0f" type="video/webm" />
</video>

## What the gateway does for you

Your provider API keys stay in LangWatch. You add OpenAI, Anthropic, Azure OpenAI, AWS Bedrock, Google Vertex AI, Google Gemini and the other [providers](https://langwatch.ai/docs/ai-gateway/providers/overview.md) once, under **Settings > Model Providers**.

Every application, team or person gets a **virtual key** instead of a provider key. A virtual key is like a virtual credit card that you can attach a budget to: it is scoped to a project, a team, an organization or one person, it reaches only the providers you allow, and you can rotate, disable or revoke it without touching the provider account.

Your code points the OpenAI SDK or the Anthropic SDK at `https://gateway.langwatch.ai` and sends the virtual key as the API key. The request body stays the same.

The gateway then gives you, on every request it authenticates:

* **Spend per key, person, team and project**, in the Usage page and as a spend event you can pull or receive by webhook.
* **Budgets** on any of those scopes, and per end user of your product, that block the request or add a warning header.
* **A trace** in Trace Explorer with the model, the tokens, the cost, the virtual key and the end user.
* **Rate limits, routing and guardrails** on the key, and **cache rules** on the organization, with no change in application code.

![The Virtual Keys list with seven acme keys, their prefix, status, scope and spend this month](https://mintcdn.com/langwatch/6EHh-4eZyYKZhosJ/images/ai-gateway/vk-list-spend.png?fit=max\&auto=format\&n=6EHh-4eZyYKZhosJ\&q=85\&s=1b2153e7588ace6bb95cbb9858b5c03d)

AI Gateway > Virtual Keys: one key per application, its scope, its status and its spend this month.

## Endpoints the gateway serves

| Family | Route | Wire format |
| - | - | - |
| Chat completions | `POST /v1/chat/completions` | OpenAI |
| Responses API | `POST /v1/responses` | OpenAI |
| Messages | `POST /v1/messages` | Anthropic |
| Embeddings | `POST /v1/embeddings` | OpenAI |
| Decisions | `POST /v1/decisions` | OpenAI |
| Speech | `POST /v1/audio/speech` | OpenAI |
| Transcription | `POST /v1/audio/transcriptions` | OpenAI |
| Image generation | `POST /v1/images/generations` | OpenAI |
| Image editing | `POST /v1/images/edits` | OpenAI |
| Realtime session credentials | `POST /v1/realtime/client_secrets` | OpenAI |
| Model list | `GET /v1/models` | OpenAI |
| Gemini native | `/v1beta/*` | Google |
| ElevenLabs native | `POST /v1/text-to-speech/{voice_id}`, `POST /v1/speech-to-text` | ElevenLabs |

The gateway translates between wire formats where the provider differs. For example, an OpenAI SDK call to `/v1/chat/completions` with `model: "anthropic/claude-sonnet-4-5"` reaches Anthropic's Messages API and comes back as an OpenAI chat completion.

## Get started

> [card] [Quickstart](https://langwatch.ai/docs/ai-gateway/quickstart.md)
>
> Create a virtual key, send one request, open the trace, see the spend.

> [card] [Concepts](https://langwatch.ai/docs/ai-gateway/concepts.md)
>
> Virtual key, scope, budget, provider credential, routing policy, spend event.

> [card] [Python SDK](https://langwatch.ai/docs/ai-gateway/sdks/python.md)
>
> OpenAI and Anthropic Python SDKs, LangChain, LlamaIndex, trace propagation.

> [card] [TypeScript SDK](https://langwatch.ai/docs/ai-gateway/sdks/typescript.md)
>
> OpenAI and Anthropic TypeScript SDKs, Vercel AI SDK, LangChain.js.

> [card] [Go SDK](https://langwatch.ai/docs/ai-gateway/sdks/go.md)
>
> OpenAI and Anthropic Go SDKs, trace propagation.

> [card] [HTTP and other clients](https://langwatch.ai/docs/ai-gateway/sdks/http.md)
>
> curl, or any client that takes an OpenAI base URL and API key.

## Control spend

> [card] [Virtual keys](https://langwatch.ai/docs/ai-gateway/virtual-keys.md)
>
> Scopes, provider access, expiry, rotation, disable and revoke, CLI and REST.

> [card] [Budgets](https://langwatch.ai/docs/ai-gateway/budgets.md)
>
> Caps per organization, team, project, key, person, group or end user. Block or warn.

> [card] [Rate limits](https://langwatch.ai/docs/ai-gateway/rate-limits.md)
>
> Requests per minute and per day on a key.

> [card] [Billing and spend events](https://langwatch.ai/docs/ai-gateway/billing-events.md)
>
> One spend event per authenticated request, by webhook or by REST, for rebilling your customers.

## Connect providers and tools

> [card] [Providers](https://langwatch.ai/docs/ai-gateway/providers/overview.md)
>
> OpenAI, Anthropic, Azure OpenAI, AWS Bedrock, Vertex AI, Gemini, xAI, Groq, Cerebras, DeepSeek,
> Doubleword, Voyage AI, ElevenLabs, custom endpoints.

> [card] [Coding Agents](https://langwatch.ai/docs/coding-agents/overview.md)
>
> Claude Code, Codex, Gemini CLI, OpenCode, Cursor and Aider through the gateway.

> [card] [Guardrails](https://langwatch.ai/docs/ai-gateway/guardrails.md)
>
> Run LangWatch evaluators on the request or the response.

> [card] [Self-hosting](https://langwatch.ai/docs/ai-gateway/self-hosting/helm.md)
>
> Run the gateway next to your LangWatch installation with the Helm chart.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.