Skip to content

Gateway overview

What a paper gateway is, why your organization has one, and how it connects your agents, paperd, backends, providers, and paper console.

When your agent calls a model, that request has to travel somewhere. With paper, it travels through your organization’s gateway — and that one routing decision is what makes everything else work: the request gets recorded, the right provider credential gets applied, and the session shows up in paper console for your whole team.

The mental model

Think of the gateway as your organization’s front door for model traffic. Every agent on the team sends its model calls to the same door instead of straight to Anthropic or OpenAI. Because all the traffic passes one point your organization controls, that point can do things no individual laptop can: record every session in one shared history, hold shared provider credentials, and decide which models are reachable.

That front door is the technical term gateway: a named, per-organization cloud route for model traffic. An organization can have several. Each gateway holds its own backends — a backend is one route from the gateway to a single provider, such as api.anthropic.com.

The request path

your agent (Claude Code, Codex, Pi)
   │  base URL points at localhost
   ▼
paperd — local daemon on your machine
   │  attaches your paper identity, forwards to the cloud
   ▼
gateway — your organization's route for model traffic
   │  records the session, picks the backend, applies credentials
   ▼
backend — one route to one provider
   ▼
provider (Anthropic, OpenAI, ...) → model

Each hop has one job:

  • Your agent doesn’t change. paperctl start claude points its base URL at localhost; the agent behaves exactly as before.
  • paperd runs on your machine at 127.0.0.1:51539. It keeps your login token fresh, stamps each request with your paper identity, and forwards it to your organization’s gateway. It is not a gateway — nothing is recorded or routed here.
  • The gateway is where capture happens. It records the request and response as session data, then routes the call to a backend. Capture is fail-open: if recording ever has a problem, your request still reaches the provider.
  • A backend names the provider route: the upstream host, the request schema the provider speaks, which models are allowed, and how the request is authenticated — with the caller’s own credential passed through (transparent) or with a key your organization stores on the backend (managed).
  • paper console is where you see and manage all of this: the Gateways page shows each gateway, its backends, its provisioning status, and its endpoint; the API keys page holds your keys for direct access.

Two credentials, two jobs

Every request through a gateway carries up to two separate credentials, and keeping them apart makes the whole system easier to reason about:

  • Your paper identity says who is making this request — it’s what lets the gateway record the session under your name in your organization. paperd attaches it automatically; for direct access a gateway API key carries it instead.
  • The provider credential says who pays for the model call — an Anthropic or OpenAI key, or a ChatGPT/Claude plan login. On a transparent backend it comes from you and passes through untouched. On a managed backend the gateway injects a key your organization stores.

What you get without doing anything

When your organization is created, paper provisions a default gateway with three transparent backends:

Backend Provider route Used by
ant-default api.anthropic.com Claude Code and other Anthropic-speaking agents
chatgpt-codex chatgpt.com Codex with ChatGPT-plan sign-in
openai-transparent api.openai.com Codex and other tools using an OpenAI API key

All three accept any model name and pass your own credentials through. That’s why the quickstart never mentions setup: paperctl login discovers the default gateway, and paperctl start claude just works.

When you’ll touch the gateway

You configure gateways when your team’s needs outgrow the default:

Choose your setup walks through which of these applies to you.

Where to go next

Frequently asked questions

Do I need to set up a gateway before using paper?+
No. A default gateway with working backends for Anthropic, OpenAI, and ChatGPT Codex traffic is provisioned when your organization is created. paperctl discovers it on login.
Is paperd a gateway?+
No. paperd is the local daemon on your machine — a loopback proxy that attaches your paper identity and forwards traffic to your organization's cloud gateway. The gateway is where capture and provider routing happen.
Can a gateway block or slow down my agent?+
Capture never does — it's fail-open, so a recording problem doesn't stop or slow the request, and requests up to 32 MiB are supported. Policy can: a control point for requests is part of what a gateway is for. Today the gateway enforces backend model allowlists; as paper ships organization policies (billing, compliance), a request that violates one would be rejected with an error that says why.
Copied to clipboard