Skip to content
Opod

Core reference

Front doors and cell doors

Run extra gateway copies for one endpoint with --role gateway, or one URL for many endpoints with --role door and its routes file.

In short

A front door (opod up --role gateway) is an extra copy of one leader's gateway: it checks keys and routes to that leader's workers itself, so several of them spread client connections. A cell door (opod up --role door) is one URL in front of many leaders: it reads each request's model and forwards it, unchanged, to that endpoint.

OPOD_ADMIN_TOKEN=sk-orc-<admin-key> opod up --role gateway --leader http://leader:8080
opod up --role door --routes /etc/opod-door/routes.json

Opod has two kinds of door. Both are opod up with a --role.

AspectFront door (--role gateway)Cell door (--role door)
Servesone leader's endpointmany endpoints, chosen by model
Routes tothat leader's workers, itselfthe endpoint's leader, unchanged
Checks keysyes, like the leaderno; the endpoint's leader checks them
Store, enginenone of its ownnone
Needs--leader / OPOD_LEADER_URL and OPOD_ADMIN_TOKEN--routes / OPOD_DOOR_ROUTES

Front door

OPOD_ADMIN_TOKEN=sk-orc-<admin-key> opod up --role gateway --leader http://leader:8080

A front door is an extra copy of the gateway for one endpoint. Run several behind a load balancer when one leader process should not carry every client connection.

  • It serves /v1 and the probes only. No /admin/v1, no join surface, no engine. The worker registry, join tokens and gang calls stay with the leader.
  • It mirrors the leader's worker list and gangs (GET /admin/v1/nodes, which includes the worker tokens it needs to sign calls, and GET /admin/v1/shards) and routes to those workers itself.
  • It pushes its usage rows to the leader with POST /admin/v1/usage/push. The leader is the single writer of usage; rows are deduplicated by an id the door mints. The push also carries the door's in_flight and rpm_1m. From core v0.4.0 the leader adds the door's rows to its own queue for the usage push, so they reach the receiver with the leader's.
  • It polls GET /admin/v1/spend every 10 seconds for the live door count.
  • It fails at start when it cannot reach its leader, rather than serving 503s that look like an outage.
  • OPOD_GATEWAY_ID names the door in the leader's count (default: the hostname).
  • Its /loadz and its own time-to-first-token describe only its own traffic. Scale doors on the leader's /gatewayz, which totals all of them. See Probes.

Cell door

opod up --role door --routes /etc/opod-door/routes.json

A cell door is a name lookup, not a router. For each request it reads model, finds the endpoint in the routes file and forwards the request there unchanged, streaming included. It chooses no worker. On a plain route it retries nothing and falls back to nothing. It holds no credential: Authorization goes through as received and the endpoint's leader checks it.

  • GET /v1/models lists the models whose endpoint accepts the caller's key.

  • An unknown model answers OpenAI's 404 model_not_found.

  • The door's own errors use OpenAI's envelope, {"error": {"message", "type", "param", "code"}}:

    Statuserror.typeCause
    400invalid_request_errorThe body is not JSON, or not a JSON object when the door must rewrite model.
    400invalid_request_errorAn auto route: the request carries tools and no candidate has tools: true.
    404invalid_request_error (code: model_not_found)No route for the model, or no model in the body.
    502upstream_unavailableThe endpoint did not answer the door (a plain route, or the last candidate of an auto route). The door does not retry.

    An auto route moves to the next candidate when one is unreachable, answers 429 or 5xx, or answers 400 for a context-length error. The last candidate's answer goes to the client as it is.

  • It serves GET /v1/models, GET /v1/models/{id}, every POST /v1/… (forwarded), and /healthz, /readyz and /gatewayz. Every other path is 404.

  • It opens no store, starts no engine and mints no admin key.

  • It re-reads the routes file every 10 seconds. A file that repeats an alias is refused, and the last good file stays in force.

Routes file

The typed shape is DoorRoutes in core's pkg/adminapi.

{
  "revision": "2026-10-30.1",
  "routes": [
    { "alias": "qwen-coder", "upstream": "https://coder.internal:8080", "model": "qwen3-coder-30b", "ca": "-----BEGIN CERTIFICATE-----\n…" },
    { "alias": "llama-3.2-3b", "upstream": "http://small.internal:8080" },
    {
      "alias": "chat",
      "pick": "least-loaded",
      "maxHops": 1,
      "candidates": [
        { "alias": "big",   "upstream": "https://big.internal:8080",   "model": "qwen3-30b", "tools": true },
        { "alias": "small", "upstream": "http://small.internal:8080",  "model": "llama-3.2-3b" }
      ]
    }
  ]
}
Route fieldMeaning
aliasThe name a client sends as model. Unique in the file.
upstreamThe endpoint's base URL: scheme://host:port, no /v1.
modelWhen set and different from alias, the door rewrites the request's model to it and changes nothing else. Empty = the alias is the model id.
caPEM certificates trusted for an https upstream — exactly these, never the system roots. Empty = system roots, or plain http.
candidates[]Makes this an auto route: the door picks one candidate and falls back down the list on an unavailable answer. upstream, model and ca of the route are then unused.
pickfirst (default): the first candidate that can take the request. least-loaded: by each candidate's /loadz.
maxHopsHow many fallbacks one request may take. Default 1, at most len(candidates) - 1.
Candidate fieldMeaning
aliasThe candidate's own name. The response's X-Opod-Endpoint header names the one that answered.
upstream, model, caAs for a plain route.
toolsThe candidate's model can call tools. A request that carries tools skips candidates without it.

The revision the door serves from appears on its /gatewayz.

Last updated · Source: content/docs/core-reference/front-doors.mdx · View as Markdown