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

# Internal gateway

> Route every agent through one Anthropic-compatible proxy for central control and guardrails.

The **internal gateway** lets your org route every coding agent through a single
**Anthropic-compatible proxy** at an endpoint you control. That's the place to
enforce guardrails, central logging, and a single set of credentials — instead of
scattering provider keys per agent.

## Configure it

<Steps>
  <Step title="Set provider to Internal gateway">
    Under **Admin → Agent LLM**, pick **Internal gateway**.
  </Step>

  <Step title="Enter the endpoint URL">
    The gateway **origin** — for example `https://llm.your-corp.internal`.
  </Step>

  <Step title="Add the gateway API key">
    Write-only, encrypted. This one key fronts all agents.
  </Step>

  <Step title="(Optional) require the gateway for everyone">
    Set **provider policy** to `gateway_only` so no task can bypass it.
  </Step>
</Steps>

## The `/v1` gotcha

<Warning>
  Enter the gateway **origin only — no trailing `/v1`.** The Claude CLI always appends
  `/v1/messages` itself, so a URL ending in `/v1` produces `/v1/v1/messages` → a 404 that the CLI
  misreports as **"the selected model may not exist."** People then waste time debugging the model
  name.
</Warning>

AgentBees auto-strips a single trailing `/v1` to protect you, but the correct
value to enter is the origin. One origin serves every agent — the platform derives
the right path per protocol automatically (Claude and Gemini use the origin;
Codex, on the OpenAI SDK, gets `/v1` appended).

## One key, or per-model-family keys

By default all agents share the one gateway endpoint and key. Set a **per-agent
key** only if your gateway issues a **different key per model family** — otherwise
leave it blank and the main gateway key is reused.

## Gateway-fronted Bedrock models

If your gateway routes Anthropic models to AWS Bedrock, you can add representative
Bedrock inference-profile IDs to your Claude model allowlist with one click (e.g.
`us.anthropic.claude-opus-4-1-v1:0`). The gateway does the Bedrock auth — no AWS
credentials live in AgentBees. Edit them to the exact names your gateway exposes.

## Auth: stored key vs SSO-brokered

* **Stored key** — an encrypted org key fronts every task.
* **SSO-brokered** — a short-lived per-task credential is minted from the user's
  SSO session, so no long-lived key is stored at all.

## Guardrails & MCP

Because everything flows through one endpoint, the gateway can enforce policy
centrally (which models, which tools). AgentBees can also auto-connect the
gateway's **MCP endpoint** (derived as `<origin>/mcp`) in Claude tasks, using the
same injected key — and the gateway still decides which tools that key may run.

<Note>
  A gateway provider with **no endpoint fails loudly** rather than silently calling the public API —
  so a misconfiguration can't quietly defeat your gateway policy.
</Note>
