Pi
Pi builds its model picker only from ~/.pi/agent/models.json, never querying Gateway, so new catalog models appear only once you add them or regenerate the file. Use an alias entry to let a routing policy choose, or list models by hand or from the catalog. Shared setup: Building with coding agents.
Configure Pi
Export MERGE_GATEWAY_API_KEY, then add a provider with an alias entry and a fixed model:
apiKey reads your exported key with Pi’s $VAR syntax. Pi reloads the file whenever you open the picker: run pi, then /model, type merge, and select an entry.
Gotchas
- Set
contextWindow,maxTokens, andinputon every entry, or Pi assumes 128K context, 16K output, and text only - For an alias or
default_routingentry, setcontextWindowto the smallest context window among its routable models. Pi compacts against it, so a larger value can overflow the serving model. - Gateway clamps
maxTokensto the serving model’s output limit rather than letting the vendor reject it, so one value works across a policy’s models supportsReasoningEffort: falsestops Pi sendingreasoning_effort, which some vendors reject."reasoning": truelabels reasoning models in the picker.sendSessionAffinityHeaders: truegroups each Pi session into one thread in Logs
Generate the model list from the catalog
Script: build models.json from GET /v1/models
This writes every chat model Gateway offers you, with limits, modalities, and prices from each model’s first listed vendor, alias entry first. It merges into your models.json, keeping other providers and replacing the merge-gateway list.
limit=500 is the largest page /v1/models returns. If the response has "has_more": true, pass its next_cursor as ?cursor= for the rest.