Skip to main content
Pi is a terminal coding agent. It reaches the AI Gateway as a custom provider in its models file, so one access key covers every model you list there.

What you’ll need

Add the gateway as a provider

Export your access key so Pi can read it:
Add the gateway as a provider in ~/.pi/agent/models.json:
id is the model name Pi sends to the gateway: a model ID from the model catalog, or provider:model to pin a provider. It’s the only field a model entry needs, though you can add name, contextWindow, and maxTokens to label it and track context accurately.

Test the connection

Send a single prompt from the command line:
In an interactive session, run /model and pick one of the ngrok models instead. Confirm the request in AI Gateway observability in app.ngrok.ai.

Use a model you run yourself

To reach a model on your own machine, register it as a custom provider, then add its provider:model name to models, such as ollama:llama3.2. See Use a model you run yourself for the full setup.

Next steps