ADR-005: One first-party Vertex provider for every publisher, delegating the wire

Status

Accepted

Date

2026-09-07

Deciders

@bitskrieg (Chris Apsey)

Tags

architecture, providers, vertex

Relates

ADR-004 (package boundaries), #76

Context

Claude on Vertex is served by a first-party provider extension because pi’s stock providers lacked two things the agency needs: a region pinned per model — availability and quota are granted per (project, model, region) — and a probe that finds what a given project can call and writes the config. ADC expiry handling came with it.

Gemini and the Model-as-a-Service catalogue (xAI, OpenAI’s open weights, DeepSeek, Qwen, Moonshot, MiniMax) have the same shape on Vertex: per-model regions (Gemini 3.x Flash answers from global and us, 3.1 Pro Preview from global only, 2.5 from the regions; every MaaS model from global), per-project grants, the same ADC. pi ships a built-in google-vertex provider, but it takes one location for all models, is configured only by env or /login, and its static catalogue cannot say what a project can call. Using it would have given developers a second configuration style for the same platform, and the MaaS models have no pi provider at all.

The forces: one configuration surface for Vertex; no reimplementation of a wire protocol pi already speaks; provider ids and a config schema are developer-facing and hard to walk back once files exist on every box.

Decision

The Vertex extension becomes generic over publisher kinds. A catalog entry declares publisher: anthropic | google | openai-compatible (default anthropic); the extension registers one provider id per kind present in the file — vertex-anthropic, vertex-gemini, vertex-maas — and each kind delegates the wire to code that already speaks it, owning only the routing:

  • anthropic — the official Anthropic Vertex SDK, a client per (project, region), unchanged.

  • google — pi’s own Vertex Gemini adapter, taken from @earendil-works/pi-ai/providers/all (the alias surface an installed extension can resolve; deep pi-ai/api/* paths cannot), handed the project and the entry’s region per call through options.env.

  • openai-compatible — pi’s OpenAI-completions adapter through @earendil-works/pi-ai/compat, aimed at Vertex’s OpenAI-compatible endpoint with a bearer minted from ADC, cached and single-flight.

One config file (vertex-models.json), one probe with one endpoint shape per kind, one ADC retry pump around every kind. Every kind is registered with a literal placeholder key beside the oauth sentinel, so every kind appears in /model on install with no login. Packaged defaults are pinned from the agency project’s probe, each with a published rate; a model without a rate does not ship.

Alternatives considered

  • pi’s built-in google-vertex, fed its two env variables by our extension. Works for Gemini in one location; gives developers a second configuration style, no per-model region, no probe, nothing for MaaS. Rejected as the anti-pattern this decision exists to avoid.

  • A separate extension per publisher. Three config files, three probes, three ADC stories, and the config style still diverges. Rejected.

  • Writing the Gemini or OpenAI wire ourselves. pi-ai already implements both, with thinking mapping, tools, images and error shaping; a second implementation would drift from pi’s. Rejected — the routing is ours, the wire is pi’s.

  • Renaming the package now. @gadhs/pi-vertex-anthropic is a misnomer for three publishers, but the rename churns the registry, the meta package and every doc, and nothing here depends on it. Deferred to #77.

Consequences

  • One way to configure any model on Vertex; a fourth publisher is a fourth branch and a fourth provider id, not a new style.

  • The extension depends on two of pi-ai’s alias-surface entries staying stable (providers/all, /compat). Both are pi’s documented extension contract; a break there breaks the anthropic kind too, which already imports /compat.

  • The us/eu multi-region hosts live on .rep.googleapis.com; the maas kind and the probe share that table (vertex-host.mjs), the other two SDKs carry their own and agreed with it on the probe run.

  • Pre-publisher installs rename their override file; the old names are not aliased (pre-1.0).

  • pi’s built-in google-vertex is left alone; a developer who also configures it sees Gemini twice. Documented, not suppressed.

Edit this page · latest