ON-PREM CHOREO CLOUD BOTH

What you will learn

  • Tell the public API from the internal server by prefix, port and credential
  • Say who uses each door and what the internal server offers a gateway
  • Explain how an api-key identifies a gateway and the organisation it belongs to
  • Say who opens the connection between a gateway and AMS, and how news travels down it

Before you start

On this page

AMS has one front desk and one staff entrance. People and tools go to the front desk and show a signed token. Gateways use the staff entrance and show a key. They are two servers in one process, and they trust different things. Knowing which is which makes many errors easy to read.

The front door: the public API

The public API serves the prefix /api/v1. By default its container port is 8080, and the on-prem chart’s Service passes it on from port 9000. It has 243 routes, and all of them are mounted behind the token check. A request goes through a chain of steps: recover from panics, CORS, a correlation id, a request log, then the JWT check. After that each route runs its own checks for the audit trail, the organisation, the scope and the path parameters.

Six routes are registered on the server’s root mux and need no token: a health check, the service’s configuration (its path is /api/v1/config), the public keys that verify agent tokens, two discovery documents, and a small check that the reverse proxy asks before it issues a certificate for an environment’s identity server. The MCP endpoint for AI assistants also sits on the root, with the same token check.

The caller is a person or a tool. It sends a in the Authorization header.

The staff entrance: the internal server

Component

AMS internal server :9243

Control side Control plane BOTH

The AMS internal server is a second HTTPS server inside AMS, on port 9243. It exists only for API Platform Gateways. Gateways keep a WebSocket open to it for live updates and call its internal REST routes to fetch policies, keys and API definitions.

The is a second server in the same process. It serves the prefix /api/internal/v1, by default on port 9243, and its chart Service is amp-api-gateway-manager. Under that prefix it has 12 routes: 11 REST routes and one WebSocket. It exists for gateways.

What does a gateway ask for here?

RouteWhat it is for
LLM provider, LLM proxy, MCP proxy and agent by idThe full definition of something that was deployed to this gateway.
Key lists for providers, proxies and agentsThe hashes of the API keys that the gateway should accept.
DeploymentsA list that the gateway reconciles against on connect. In this version AMS always answers with an empty list.
Applications and subscription plansFurther data that the gateway syncs from AMS. Applications come with their key bindings, and the subscription plans list is empty today.
A manifest, sent to AMSThe list of policies this gateway has installed.
The WebSocket at /api/internal/v1/ws/gateways/connectThe live line that carries news.

This server has no JWT check in its handler chain. It serves HTTPS with a certificate that it loads from its certificate directory or, if there is none, generates itself (self-signed). It asks for no certificate from the caller. If TLS is switched off in the chart, it serves plain HTTP.

How a gateway proves itself

Each of the 11 REST handlers on this server, and the WebSocket upgrade, reads the api-key header and checks it. A missing key gets a 401, and so does a key that does not check out. When the key is good, AMS learns two things from the gateway it finds: which gateway is calling, and which organisation it belongs to. Handlers then read only that organisation’s data.

On-prem, the key is the registration token that an install job asked AMS to mint. AMS stores a salted hash of it, not the token. On Choreo Cloud, Choreo Labs’ own services register the gateway instead (the provisioner, or platform-api’s bootstrap), and the gateway still reaches AMS with a registration token.

Who opens the line

The gateway-controller opens the WebSocket. AMS does not dial out to the gateway. It dials AMS over TLS and shows the registration token in the api-key header. It shows no certificate of its own, so this is not mutual TLS. If the line drops, it reconnects, waiting longer each time, from 1 second up to 5 minutes.

  1. The line opens

    AMS checks the key and accepts the socket. It pings the connection every 20 seconds, and by default it gives up on a connection that does not answer within 30.

  2. Something changes

    When, for example, an MCP proxy is deployed, AMS writes an event into EventHub, its event log in Postgres.

  3. News goes down the line

    A polling loop checks the log every 2 seconds and passes new events to the gateway’s open connection. For a deployment, the message names what changed and does not carry the full definition.

  4. The gateway fetches the details

    The gateway calls the internal REST routes with its key and asks for the definition. A small message first and the details on request keeps the line light.

Your turn

Under Try it, play flow F11 and stop at the step where the gateway-controller connects. Which side opens the connection? Then open the credentials map and click the row for the gateway registration token: who holds it and who checks it? Finish with the matcher that pairs each address and credential with its door.

Recap

  • The public API is at /api/v1, by default on 8080 (service port 9000 in the chart). People and tools use it with a JWT.
  • The internal server is at /api/internal/v1, by default on 9243 over HTTPS. Gateways use it with an api-key header. It has no JWT check.
  • The api-key identifies one gateway and its organisation, so a gateway reads only its own organisation’s data.
  • The gateway-controller opens the WebSocket. News travels down it as small messages, and the details come over REST.

Try it

Follow one request

What to do: press Play, or use Next, to walk through the request step by step.

Loading the diagram...

The credentials map

What to do: click a credential to see who holds it, who checks it and where it travels.

Loading the simulator...

Match them up

What to do: pick an item on the left, then its partner on the right.

Loading the matching game...

Wrap up

Recap

Tick each one when you could explain it to a colleague.

Finished?

Quick check

Loading the quick check...

Spotted something wrong or unclear in this lesson? Report an inaccuracy (opens GitHub in a new tab)