# AI Gateway

![AI bridge diagram](https://raw.githubusercontent.com/coder/coder/main/docs/images/aibridge/aibridge_diagram.png)

AI Gateway is a smart gateway for AI. It acts as an intermediary between your users' coding agents / IDEs
and providers like OpenAI and Anthropic. By intercepting all the AI traffic between these clients and
the upstream APIs, AI Gateway can record user prompts, token usage, and tool invocations.
AI Gateway supports clients running inside or outside Coder workspaces.

AI Gateway solves 3 key problems:

1. **Centralized authn/z management**: no more issuing & managing API tokens for OpenAI/Anthropic usage.
   Users use their Coder session or API tokens to authenticate with `coderd` (Coder control plane), and
   `coderd` securely communicates with the upstream APIs on their behalf.
1. **Auditing and attribution**: all interactions with AI services, whether autonomous or human-initiated,
   will be audited and attributed back to a user.
1. **Centralized MCP administration**: define a set of approved MCP servers and tools which your users may
   use.

> [!NOTE]
> AI Gateway requires the [AI Governance Add-On](https://coder.com/docs/ai-coder/ai-governance.md).
> As of Coder v2.32, deployments without the add-on will not be able to
> access AI Gateway.
>
> AI Gateway was previously known as "AI Bridge". Some configuration
> options, environment variables, and API paths still use the old name
> and will be updated in a future release.

## When to use AI Gateway

As LLM adoption grows, administrators need centralized auditing, monitoring, and token management. AI Gateway enables organizations to manage AI tooling access for thousands of engineers from a single control plane.

If you are an administrator or devops leader looking to:

- Measure AI tooling adoption across teams or projects
- Establish an audit trail of prompts, issues, and tools invoked
- Manage token spend in a central dashboard
- Investigate opportunities for AI automation
- Uncover high-leverage use cases last

AI Gateway is best suited for organizations facing these centralized management and observability challenges.

## Next steps

- [Set up AI Gateway](https://coder.com/docs/ai-coder/ai-gateway/setup.md) on your Coder deployment
- [Configure AI clients](https://coder.com/docs/ai-coder/ai-gateway/clients.md) to use AI Gateway
- [Configure MCP servers](https://coder.com/docs/ai-coder/ai-gateway/mcp.md) for tool access
- [Audit AI sessions](https://coder.com/docs/ai-coder/ai-gateway/audit.md)
- [Monitor usage and metrics](https://coder.com/docs/ai-coder/ai-gateway/monitoring.md) and [configure data retention](https://coder.com/docs/ai-coder/ai-gateway/setup.md#data-retention)
- [Reference documentation](https://coder.com/docs/ai-coder/ai-gateway/reference.md)

<children></children>
