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

# LLM Gateway

> One address for every model call your organization makes, from agents, apps and the coding tools people use, with your keys, models, budgets and records applied to each call.

The LLM Gateway is a single address for every model call your organization makes. Your agents, your apps, and the coding tools people run on their computers (Claude Code, Codex and OpenCode) call it with an xpander key instead of a provider key. Each call is checked against your organization's settings, sent to the provider on the right key, and recorded under the person who made it.

## What happens to each call

1. **Who is calling.** The key on the call identifies the caller: a person's API key, an agent's run, or an organization API key. An unknown, revoked or expired key is refused.
2. **What they may use.** The model is checked against the models your organization turned on and the person's groups. A model name can be an [alias](/run/llm-gateway/aliases) your admins defined.
3. **Who pays.** A person's own Claude plan (where xpander has enabled it), a provider key your organization stored, or xpander's key billed in credits ([Licenses and who pays](/run/llm-gateway/which-key-pays)). Callers never hold a provider key.
4. **Budgets.** The budgets of the organization, the group, the person, the agent and the key are checked before the call leaves ([Budgets](/run/llm-gateway/budgets-and-blocks)).
5. **Fallbacks.** When the provider is overloaded or fails, the call is retried, then tried on the alias's next model.
6. **The record.** One record per call: who, what started it, which client, model and provider, tokens, cost and timings ([Usage and logs](/run/llm-gateway/requests-and-costs)).

Prompt and response text is saved with each request, encrypted, unless an admin turns off [Saved prompt text](/run/llm-gateway/policies#prompt-and-response-text) for the account or for a group. Model calls xpander makes for your organization, such as conversation summaries, also go through the gateway and show in Logs with a **System** badge.

## Cloud, Hybrid and Air-Gapped

| | xpander cloud | Hybrid | Air-Gapped |
| - | - | - | - |
| Where the gateway runs | xpander cloud | Your install, for your agents. Your people's coding tools use xpander cloud. | Your install |
| Address for people's coding tools and SDKs | `https://llm-gw.xpander.ai` | `https://llm-gw.xpander.ai` | `https://llm-gw.<your domain>` |
| Settings | [Platform](https://platform.xpander.ai/governance/model-access) | Platform, reaching your install within seconds | Your install's Platform |
| Who pays | Own Claude plan (when enabled), your keys, or xpander's keys (credits) | Own Claude plan (when enabled) and your keys; never xpander's keys | Your keys and your install's credentials |
| Request records | Your organization's own database in xpander cloud | Agents: inside your install. People's coding tools: your organization's database in xpander cloud | Inside your install |

On Hybrid and Air-Gapped installs, the gateway is part of the chart. [Self-hosted](/run/llm-gateway/self-hosted) explains how to turn it on.

## Where each setting lives

| What | Where |
| - | - |
| Providers, keys, Azure endpoints, Bedrock roles, which models are on and who may use them, aliases | [Models](https://platform.xpander.ai/governance/model-access) ([Providers and keys](/run/llm-gateway/providers-and-keys), [Aliases](/run/llm-gateway/aliases)) |
| Spending limits for the organization, groups, members, keys, agents and end users | [Budgets](https://platform.xpander.ai/governance/budgets) ([Budgets](/run/llm-gateway/budgets-and-blocks)) |
| License models, key lifetime, retention, saved prompt text | [Policies](https://platform.xpander.ai/governance/policies) ([Policies](/run/llm-gateway/policies)) |
| What the organization spent | [Usage](https://platform.xpander.ai/governance/usage) ([Usage and logs](/run/llm-gateway/requests-and-costs)) |
| Every request, and log destinations | [Logs](https://platform.xpander.ai/governance/logs) ([Log destinations](/run/llm-gateway/logs-export)) |
| Who changed what | [Audit log](https://platform.xpander.ai/governance/audit) |
| Your own API keys, coding tool setup and the models you can call | [AI models & keys](https://chat.xpander.ai/?settings=my-gateway) in Xpander Chat ([AI models and keys](/use/ai-models-and-keys)) |
| Your own spend | [Usage](https://chat.xpander.ai/?settings=my-usage) in Xpander Chat |

All of them are under **Platform > AI governance**, except the last two, which are in **Settings** in Xpander Chat. On a self-hosted install, use your own Platform and Xpander Chat addresses.

## Get started

1. **Connect a provider.** In [Models](https://platform.xpander.ai/governance/model-access), choose **Add provider** and add a key. On xpander cloud you can also start on the models included with xpander.
2. **Turn on models.** Tick the models people may use, and choose **Who may use it…** to limit them to groups.
3. **Add an alias** (optional), such as `default-coding` with a fallback.
4. **Set budgets and policies** in [Budgets](https://platform.xpander.ai/governance/budgets) and [Policies](https://platform.xpander.ai/governance/policies).
5. **Connect a coding tool.** In [AI models & keys](https://chat.xpander.ai/?settings=my-gateway), pick a client under **Connect a client** and choose **Copy setup command** ([Connect your tools](/run/llm-gateway/connect-tools)).
6. **Check it.** Your first request shows at the top of [Logs](https://platform.xpander.ai/governance/logs).

When something is refused, [Errors and what to do](/run/llm-gateway/errors) lists every message. What is stored and who can see it is on [Security and privacy](/run/llm-gateway/security).


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