---
title: AI Gateway overview
description: One API key and one address for Claude, GPT and your own models. The Gateway picks the model, reserves each request's cost against your limits, and logs it.
url: https://agentlab.cresclab.com/docs/en/gateway
language: en
updated: 2026-10-23
---

# AI Gateway overview

One API key and one address for Claude, GPT and your own models. The Gateway picks the model, reserves each request's cost against your limits, and logs it.

## What the Gateway does

Your tools call `https://api.agentlab.cresclab.com` with a Gateway API key instead of calling a model provider directly. For each request the Gateway:

1. **Checks the key** The key belongs to your workspace and can be charged to departments.
2. **Picks the model** A model you name is used as named; `auto` picks one by how hard the task is.
3. **Holds the cost** The most the request can cost is held against your limits before it is sent. A request that does not fit is refused and costs nothing.
4. **Records it** Key, model, tokens, cost and timing are recorded. Prompt and response text are not.

It speaks three protocols, so existing clients connect by changing their base URL:

| Endpoint                    | Protocol                 | Used by                                     |
| --------------------------- | ------------------------ | ------------------------------------------- |
| `POST /v1/messages`         | Anthropic Messages       | Claude Code, the Anthropic SDK              |
| `POST /v1/responses`        | OpenAI Responses         | Codex, the OpenAI SDK (`responses`)         |
| `POST /v1/chat/completions` | OpenAI Chat Completions  | The OpenAI SDK, most frameworks, raw HTTP   |
| `GET /v1/models`            | OpenAI or Anthropic list | Every client: `auto` and the models allowed |

## Start here

- [Quickstart](https://agentlab.cresclab.com/docs/en/gateway/quickstart.md): Connect Claude Code, Codex, the OpenAI SDK, the Anthropic SDK or curl in a few copyable steps.
- [API keys](https://agentlab.cresclab.com/docs/en/gateway/keys.md): Create, charge to departments, limit, rotate and revoke keys.
- [Auto model choice](https://agentlab.cresclab.com/docs/en/gateway/auto.md): How `auto` picks a model and how a response says which one answered.
- [Limits and budgets](https://agentlab.cresclab.com/docs/en/gateway/limits.md): Monthly budgets, department ceilings, rate limits, and the three kinds of 429.
- [Usage and export](https://agentlab.cresclab.com/docs/en/gateway/usage.md): The usage page, end-user attribution and the monthly CSV export.
- [Errors](https://agentlab.cresclab.com/docs/en/gateway/errors.md): Every error code with its status, whether to retry and what fixes it.

## Reference

- [API reference](https://agentlab.cresclab.com/docs/en/gateway/api.md): endpoints, headers and the OpenAPI document.
- [Data handling](https://agentlab.cresclab.com/docs/en/gateway/data.md): what is stored about a request and what is not.
- [Self-hosting](https://agentlab.cresclab.com/docs/en/gateway/self-hosting.md): running the Gateway inside your own network.
