Perfect — you can do this without code changes using ~/.pi/agent/models.json.
Also: since you pasted a live key here, rotate it after setup.
1) Set your gateway key as env var
Use any variable name, e.g.:
2) Add provider + models in ~/.pi/agent/models.json
Use the exact model IDs your gateway exposes (from its /v1/models).
3) Select it
- In pi CLI:
/model → provider isw-gateway
- In pi-ui app: open model selector (same underlying registry)
If your gateway is not fully OpenAI-compatible, add compat flags per model (e.g. maxTokensField, supportsUsageInStreaming).
If you want, I can generate a ready-to-paste models.json from the exact model IDs you have.