Pi

Pi supports OpenAI-compatible endpoints through models.json. No extension is needed · a provider entry with api: "openai-completions" is enough.

1. Export your key

export FREEGATE_API_KEY="fg_live_…"

Pi interpolates $NAME from the environment at request time, so the key never has to be written into the file · but the variable must be present in the shell that starts Pi.

2. Create the models file

mkdir -p ~/.pi/agent && ${EDITOR:-nano} ~/.pi/agent/models.json
{
  "$schema": "https://pi.dev/schemas/models.schema.json",
  "providers": {
    "freegate": {
      "baseUrl": "https://api.firesafety.men/v1",
      "api": "openai-completions",
      "apiKey": "$FREEGATE_API_KEY",
      "models": [
        { "id": "flint", "name": "Flint" },
        { "id": "glyph", "name": "Glyph Cluster" },
        { "id": "beam-contributor-free", "name": "Beam 1.0 Contributor" },
        { "id": "oss-120b", "name": "GPT-OSS 120B" },
        { "id": "oss-20b", "name": "GPT-OSS 20B" },
        { "id": "qwen38", "name": "Qwen 3.8 27B" },
        { "id": "allam-2-7b", "name": "ALLaM 2 7B" },
        { "id": "dd-v4-flash", "name": "DeepSeek V4 Flash" },
        { "id": "dd-v41-flash-fast", "name": "DeepSeek V4.1 Flash Fast" },
        { "id": "muse-spark-13", "name": "Muse Spark 1.3 Contributor" },
        { "id": "glm-53-flash", "name": "GLM 5.3 Flash" },
        { "id": "qwen37-flash", "name": "Qwen 3.7 Flash" },
        { "id": "hy4-flash", "name": "Tencent Hy4 Flash" },
        { "id": "kimi-k27", "name": "Kimi K2.7 Code" }
      ]
    }
  }
}

If the file already exists, merge the providers.freegate entry rather than replacing the file. The list above is the whole catalog, including paid models your account may not have; calling a locked one returns 403 model_not_allowed.

3. Select a model

Inside Pi, run /model and pick a freegate/* model. Ctrl+S makes it the default.

Capabilities and limits

  • Tool calling works. Tools and tool results are forwarded.
  • Images only on vision-capable models (see models).
  • Files · text-like files are inlined; binary formats are refused.
  • Clamped output. The operator's per-request ceiling applies (live value on status).

Troubleshooting

  • Model missing from /model? Pi hides models whose provider has no usable credential · re-check the env var in the shell that launched pi.
  • Validate the JSON before blaming the gateway: node -e "JSON.parse(require('fs').readFileSync(process.env.HOME + '/.pi/agent/models.json'))" (on Windows, point at %USERPROFILE%).
  • 401 · key invalid or revoked. 403 · model not available to your account.
  • 429 or 503 · a token/request allowance or the provider pool is spent; check status.